-
Notifications
You must be signed in to change notification settings - Fork 5.9k
[NPU] Add exp and exp_grad npu op #34612
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
Conversation
paddle/fluid/operators/exp_op_npu.cc
Outdated
|
|
||
| REGISTER_OP_NPU_KERNEL( | ||
| exp, ops::ExpNPUKernel<paddle::platform::NPUDeviceContext, float>, | ||
|
|
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.
Remove this empty line
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.
Why forward kernel dones't register int/int64
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.
paddle/fluid/operators/exp_op_npu.cc
Outdated
|
|
||
| REGISTER_OP_NPU_KERNEL( | ||
| exp_grad, ops::ExpGradNPUKernel<paddle::platform::NPUDeviceContext, float>, | ||
|
|
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.
Remove this empty line
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.
done
| self.__class__.use_npu = True | ||
|
|
||
|
|
||
| class TestExpNPUOPFloat64(TestExpNPUOP): |
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.
why not add unittest of int / int64?
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.
移除了反向中的int/int64 kernel的注册,与前向类型保持一致
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 | ||
| */ |
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.
activation相关的算子都写在activation_op_npu.cc文件里面,这个exp_op.cc和exp_op_npu.cc都不需要
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.
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"); | ||
| } |
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.
参考activation_op.cc中的ExpOpMaker, Paddle的EXP算子没有以上三个attribute,请根据Paddle算子的输入和运算逻辑进行实现。
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.
删除了代码中的三个attribute
qili93
left a comment
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.
LGTM

PR types
New features
PR changes
OPs
Describe
[NPU] Add exp and exp_grad npu op


