Skip to content

[NPU] Support npu op where and where grad#34587

Merged
qili93 merged 3 commits intoPaddlePaddle:developfrom
zhaoyinglia:add_where_op_npu
Aug 20, 2021
Merged

[NPU] Support npu op where and where grad#34587
qili93 merged 3 commits intoPaddlePaddle:developfrom
zhaoyinglia:add_where_op_npu

Conversation

@zhaoyinglia
Copy link
Contributor

PR types

New features

PR changes

OPs

Describe

[NPU] Support npu op where and where grad

运行结果:
截屏2021-08-03 下午9 01 40
截屏2021-08-03 下午9 00 26

@paddle-bot-old
Copy link

paddle-bot-old bot commented Aug 3, 2021

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

JZ-LIANG
JZ-LIANG previously approved these changes Aug 19, 2021
Copy link
Contributor

@JZ-LIANG JZ-LIANG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

// limitations under the License.

#include "paddle/fluid/operators/where_op.h"
#include "paddle/fluid/framework/tensor_util.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个文件可以不要吧。paddle/fluid/framework/tensor_util.h

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已更新


class TestWhereDygraphAPI(unittest.TestCase):
def test_api(self):
with fluid.dygraph.guard():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改成 with fluid.dygraph.guard(paddle.NPUPlace(0)): 不然是跑在CPU上的

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已更新

cond = fluid.layers.data(name='cond', shape=[4], dtype='int32')
paddle.where(cond, x, y)

self.assertRaises(TypeError, test_type)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TestWhereOpError不会实际跑Kernel,可以删掉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已更新

Copy link
Contributor

@qili93 qili93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@qili93 qili93 merged commit d082955 into PaddlePaddle:develop Aug 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants