[NPU] Support npu op where and where grad#34587
Merged
qili93 merged 3 commits intoPaddlePaddle:developfrom Aug 20, 2021
zhaoyinglia:add_where_op_npu
Merged
[NPU] Support npu op where and where grad#34587qili93 merged 3 commits intoPaddlePaddle:developfrom zhaoyinglia:add_where_op_npu
qili93 merged 3 commits intoPaddlePaddle:developfrom
zhaoyinglia:add_where_op_npu
Conversation
|
Thanks for your contribution! |
qili93
reviewed
Aug 19, 2021
| // limitations under the License. | ||
|
|
||
| #include "paddle/fluid/operators/where_op.h" | ||
| #include "paddle/fluid/framework/tensor_util.h" |
Contributor
There was a problem hiding this comment.
这个文件可以不要吧。paddle/fluid/framework/tensor_util.h
|
|
||
| class TestWhereDygraphAPI(unittest.TestCase): | ||
| def test_api(self): | ||
| with fluid.dygraph.guard(): |
Contributor
There was a problem hiding this comment.
改成 with fluid.dygraph.guard(paddle.NPUPlace(0)): 不然是跑在CPU上的
| cond = fluid.layers.data(name='cond', shape=[4], dtype='int32') | ||
| paddle.where(cond, x, y) | ||
|
|
||
| self.assertRaises(TypeError, test_type) |
Contributor
There was a problem hiding this comment.
TestWhereOpError不会实际跑Kernel,可以删掉
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PR types
New features
PR changes
OPs
Describe
[NPU] Support npu op where and where grad
运行结果:

