Skip to content
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

[Tensor Operants & Prim] Tensor arithmetic operants support right scalar type #50563

Merged
merged 21 commits into from
Feb 23, 2023

Conversation

jiahy0825
Copy link
Contributor

@jiahy0825 jiahy0825 commented Feb 16, 2023

PR types

New features

PR changes

Others

Describe

本 PR 工作项点:

  1. 支持 Tensor +-*/ Scalar 运算符重载
  2. 扩充组合算子静态图模式下,full op 支持的数据类型
  3. 涉及 Scalar 的四则运算需要额外调用 fill_constant op,因此修改了组合算子单测

Items of this PR:

  1. Tensor arithmetic operants support right scalar type, e.g. Tensor +-*/ Scalar
  2. Support more datatype of full op in prim static mode.
  3. Scalar-relevant operants need to invoke fill_constant op, therefore modifying some unit tests of prim.

@paddle-bot
Copy link

paddle-bot bot commented Feb 16, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

Comment on lines +46 to +50
'fill_constant',
'elementwise_mul',
'fill_constant',
'elementwise_add',
'elementwise_mul',
Copy link
Contributor

Choose a reason for hiding this comment

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

这里是不重复了?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

此处表示的是算子的调用顺序,并未重复

Here represents the order of calling operators.

Copy link
Contributor

@JiabinYang JiabinYang left a comment

Choose a reason for hiding this comment

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

one comment

- add
- subtract
- multiply
- divide
- unsqueeze
- pow
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we don't need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

以加法为例,虽然用户不再需要调用 add 函数,可以直接调用 + 运算符。
但是重载后的 + 操作,实际依赖的还是 add 函数,因此需要保留这几项,自动生成 add 函数的声明。

Although users could invoke the + operant directly without calling the add function, in fact, the overloaded + operant relies on the add function. Hence, we need to keep these items to generate an add declaration automatically.

Copy link
Contributor

@JiabinYang JiabinYang left a comment

Choose a reason for hiding this comment

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

LGTM

@jiahy0825 jiahy0825 changed the title [Tensor Operants] Tensor arithmetic operants support right scalar type [Tensor Operants & Prim] Tensor arithmetic operants support right scalar type Feb 23, 2023
@jiahy0825 jiahy0825 merged commit 5f5a208 into PaddlePaddle:develop Feb 23, 2023
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.

5 participants