Skip to content

Conversation

@YuanRisheng
Copy link
Contributor

PR types

Others

PR changes

OPs

Describe

elementwise_sub Kernel refactor

@paddle-bot-old
Copy link

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

Copy link
Contributor

@zyfncg zyfncg left a comment

Choose a reason for hiding this comment

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

LGTM


PD_DLL_DECL Tensor subtract(const Tensor& x, const Tensor& y) {
// 1. Get kernel signature and kernel
auto kernel_key_set = ParseKernelKeyByInputArgs(x);
Copy link
Contributor

Choose a reason for hiding this comment

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

目前对于add和sub,这里应该是不仅根据x来确定kernel类型,可以参考原先elementwise的GetExpectedKernelType

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的,这个我记个TODO,elementwise算子迁移后改一下

void ElementwiseSub(const CPUContext& dev_ctx,
const DenseTensor& x,
const DenseTensor& y,
int axis,
Copy link
Contributor

Choose a reason for hiding this comment

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

这个axis参数会在原先哪些场景用到,API已经没有这个参数了,我们能否去掉?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

不行,axis是用来broadcast用的

Copy link
Contributor

@Avin0323 Avin0323 left a comment

Choose a reason for hiding this comment

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

LGTM for PR-CI-OP-benchmark

@chenwhql chenwhql merged commit 36a9565 into PaddlePaddle:develop Nov 18, 2021
@YuanRisheng YuanRisheng deleted the elementwise_sub_refactor3 branch November 19, 2021 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants