-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SCU][Paddle TensorRT No.31]Add greater_equal and greater_equal_ converter #69770
Open
wwwuyan
wants to merge
6
commits into
PaddlePaddle:develop
Choose a base branch
from
wwwuyan:greater_equal
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e916d8d
greater_equal and greater_equal_
wwwuyan 0a02dce
test succeed
wwwuyan ee01773
solve conflict
wwwuyan 1ed3684
update logic.py
wwwuyan 991ea50
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into…
wwwuyan 5882b68
reuse
wwwuyan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,3 +44,21 @@ def not_equal_converter(network, paddle_op, inputs): | |
not_layer = network.add_unary(layer_output, trt.UnaryOperation.NOT) | ||
layer_output = not_layer.get_output(0) | ||
return layer_output | ||
|
||
|
||
@converter_registry.register("pd_op.greater_equal", trt_version="8.x") | ||
@converter_registry.register("pd_op.greater_equal_", trt_version="8.x") | ||
def greater_equal_converter(network, paddle_op, inputs): | ||
greater_layer_output = add_elementwise_layer( | ||
network, paddle_op, inputs, trt.ElementWiseOperation.GREATER | ||
) | ||
equal_layer_output = add_elementwise_layer( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里写的不对,参考pd_op.remainder,应该就第一个需要add_elementwise_layer |
||
network, paddle_op, inputs, trt.ElementWiseOperation.EQUAL | ||
) | ||
or_layer = add_elementwise_layer( | ||
network, | ||
paddle_op, | ||
[greater_layer_output, equal_layer_output], | ||
trt.ElementWiseOperation.OR, | ||
) | ||
return or_layer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,36 @@ def test_trt_result(self): | |
self.check_trt_result() | ||
|
||
|
||
class TestGreaterEqualRTPattern(TensorRTBaseTest): | ||
def setUp(self): | ||
self.python_api = paddle.greater_equal | ||
self.api_args = { | ||
"x": np.random.randn(2, 3).astype("float32"), | ||
"y": np.random.randn(2, 3).astype("float32"), | ||
} | ||
self.program_config = {"feed_list": ["x", "y"]} | ||
self.min_shape = {"x": [1, 3], "y": [1, 3]} | ||
self.max_shape = {"x": [5, 3], "y": [5, 3]} | ||
|
||
def test_trt_result(self): | ||
self.check_trt_result() | ||
|
||
|
||
class TestGreaterEqual_RTPattern(TensorRTBaseTest): | ||
def setUp(self): | ||
self.python_api = paddle.greater_equal_ | ||
self.api_args = { | ||
"x": np.random.randn(2, 3).astype("float32"), | ||
"y": np.random.randn(2, 3).astype("float32"), | ||
} | ||
self.program_config = {"feed_list": ["x", "y"]} | ||
self.min_shape = {"x": [1, 3], "y": [1, 3]} | ||
self.max_shape = {"x": [5, 3], "y": [5, 3]} | ||
|
||
def test_trt_result(self): | ||
self.check_trt_result() | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 加一个Marker单测,为了过ci |
||
class TestLessThanFloat32TRTPattern(TensorRTBaseTest): | ||
def setUp(self): | ||
self.python_api = paddle.less_than | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pd_op.greater_than不符合这里的检查规则吗