[NPU] Add exp and exp_grad npu op #34612
Merged
qili93 merged 6 commits intoPaddlePaddle:developfrom Aug 11, 2021
Merged
Conversation
Aurelius84
reviewed
Aug 6, 2021
paddle/fluid/operators/exp_op_npu.cc
Outdated
|
|
||
| REGISTER_OP_NPU_KERNEL( | ||
| exp, ops::ExpNPUKernel<paddle::platform::NPUDeviceContext, float>, | ||
|
|
Contributor
There was a problem hiding this comment.
Why forward kernel dones't register int/int64
Contributor
Author
paddle/fluid/operators/exp_op_npu.cc
Outdated
|
|
||
| REGISTER_OP_NPU_KERNEL( | ||
| exp_grad, ops::ExpGradNPUKernel<paddle::platform::NPUDeviceContext, float>, | ||
|
|
| self.__class__.use_npu = True | ||
|
|
||
|
|
||
| class TestExpNPUOPFloat64(TestExpNPUOP): |
Contributor
There was a problem hiding this comment.
why not add unittest of int / int64?
Contributor
Author
There was a problem hiding this comment.
移除了反向中的int/int64 kernel的注册,与前向类型保持一致
qili93
requested changes
Aug 10, 2021
paddle/fluid/operators/exp_op.cc
Outdated
| This File can make gcc to compile './exp_op_npu.cc' . | ||
| If this file is deleted, exp_op_npu will not be compiled! | ||
| Refer to ./activation_op.cc to get ExpOP definition | ||
| */ |
Contributor
There was a problem hiding this comment.
activation相关的算子都写在activation_op_npu.cc文件里面,这个exp_op.cc和exp_op_npu.cc都不需要
Contributor
Author
There was a problem hiding this comment.
activation相关的算子都写在activation_op_npu.cc文件里面,这个exp_op.cc和exp_op_npu.cc都不需要
已经将实现代码放入activation_op_npu.cc文件中,删除了exp_op.cc和exp_op_npu.cc文件
paddle/fluid/operators/exp_op_npu.cc
Outdated
| } | ||
| if (ctx.HasAttr("shift")) { | ||
| attr_input["shift"] = ctx.Attr<float>("shift"); | ||
| } |
Contributor
There was a problem hiding this comment.
参考activation_op.cc中的ExpOpMaker, Paddle的EXP算子没有以上三个attribute,请根据Paddle算子的输入和运算逻辑进行实现。
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] Add exp and exp_grad npu op


