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

【inplace api】Batch add inplace api gt_, ge_, lt_, le_, eq_, not_equal_, logical_and_, logical_or_, logical_xor_, logical_not_, divide_, floor_divide_, bitwise_and_ , bitwise_or_, bitwise_xor_, bitwise_not_ #55509

Merged
merged 84 commits into from
Aug 28, 2023

Conversation

GGBond8488
Copy link
Contributor

@GGBond8488 GGBond8488 commented Jul 18, 2023

PR types

Others

PR changes

APIs

Description

Pcard-72375
batch add inplace api as follow,and these api return tensor's dtype as same as input x

paddle.greater_than_
paddle.greater_equal_
paddle.less_than_
paddle.less_equal_
paddle.equal_
paddle.not_equal_
paddle.logical_and_
paddle.logical_or_
paddle.logical_xor_
paddle.logical_not_

will add inplace api as follow too

paddle.cast_
paddle.divide_
paddle.floor_divide_
paddle.bitwise_and_
paddle.bitwise_or_
paddle.bitwise_xor_
paddle.bitwise_not_
paddle.cumsum_
paddle.cumprod_
paddle.mod_
paddle.floor_mod_
paddle.multiply_
paddle.renorm_
paddle.gcd_
paddle.lcm_
paddle.ldexp_
paddle.where_

@paddle-bot
Copy link

paddle-bot bot commented Jul 18, 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.

@paddle-ci-bot
Copy link

paddle-ci-bot bot commented Jul 27, 2023

Sorry to inform you that fc4e297's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

@GGBond8488 GGBond8488 changed the title Batch add inplace api 2 【inplace api】Batch add inplace api gt_, ge_, lt_, le_, eq_, not_equal_, logical_and_, logical_or_, logical_xor_, logical_not_, divide_, floor_divide_, bitwise_and_ , bitwise_or_, bitwise_xor_, bitwise_not_ Aug 10, 2023
@@ -86,6 +86,8 @@ class MetaTensor {
// and it will be deleted in the future.
virtual bool is_tensor_array() const;

virtual TensorBase* tensor() const;
Copy link
Contributor

Choose a reason for hiding this comment

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

MetaTensor用于Meta推导,需要隔离数据访问,以避免开发时加trick在静态推导功能中操作tensor data,这是之前fluid设计的问题,所以原先是有意不增加访问tensor的接口的,现在也不建议增加

Copy link
Contributor Author

Choose a reason for hiding this comment

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

移回私有

@@ -380,8 +380,9 @@ void CompareRawInferMeta(const MetaTensor& x,
out->set_dims(make_ddim(out_dims_array));
out->share_lod(x);
}

out->set_dtype(DataType::BOOL);
if (out->tensor() == nullptr || out->tensor() != x.tensor()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. tensor是否为空原先就有方法可以判断
virtual bool operator!() const { return tensor_ == nullptr; }
  1. 需要判断是否是同一个tensor的话,可以增加is_same_tensor之类的接口,不建议直接暴露tensor指针

Copy link
Contributor Author

Choose a reason for hiding this comment

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

增加is_same_tensor进行判断

Copy link
Contributor

@chenwhql chenwhql left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@jeff41404 jeff41404 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@XiaoguangHu01 XiaoguangHu01 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@sunzhongkai588 sunzhongkai588 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 docs

文档cI又出bug了,之后如有问题我再单独@你修改~

@jeff41404 jeff41404 merged commit c5fc413 into PaddlePaddle:develop Aug 28, 2023
24 of 26 checks passed
BeingGod pushed a commit to BeingGod/Paddle that referenced this pull request Sep 9, 2023
…_, logical_and_, logical_or_, logical_xor_, logical_not_, divide_, floor_divide_, bitwise_and_ , bitwise_or_, bitwise_xor_, bitwise_not_ (PaddlePaddle#55509)

* tmp commit

* add atan2

* add inplace api

* fix error

* add inpalce divide

* add inplace api

* add more inplace

* add more inpalce

* fix logical_not error

* support sinh and cosh in cpu

* support asin, acos, atan, asinh, acosh, atanh in cpu

* fix typro

* fix typro

* mv out atan2 ldexp

* mv out atan2 ldexp

* support sinh and cosh in gpu

* support asin, acos, atan, asinh, acosh, atanh in gpu

* fix ge error

* fix dygraph commpare error

* fix dygraph commpare error

* check complex in python

* fix cast inpalce error

* open inplace test

* fix ops.yaml error

* mv cast inpalce to python

* fix coverage ci

* add last inplace

* fix inplace error

* fix cast error

* fix error

* add nan_to_num_

* fix typro

* fix sparse cast error

* remove gpu 4

* fix static cast error

* tmp commit

* add atan2

* add inplace api

* fix error

* add inpalce divide

* add inplace api

* add more inplace

* add more inpalce

* fix logical_not error

* fix typro

* fix typro

* mv out atan2 ldexp

* mv out atan2 ldexp

* fix ge error

* fix dygraph commpare error

* fix dygraph commpare error

* fix cast inpalce error

* open inplace test

* fix ops.yaml error

* mv cast inpalce to python

* fix coverage ci

* add last inplace

* fix inplace error

* fix cast error

* fix error

* add nan_to_num_

* fix typro

* fix sparse cast error

* remove gpu 4

* fix static cast error

* fix cast error

* fix

* Revert "check complex in python"

This reverts commit c822064.

* add renorm , fix error

* add coverage

* fix cumsum inpalce version error

* add cast inpalce impl

* rm test.log

* fix multiply_dyfunction and add multiply_backward test

* add and use is_same_tensor

* fix typro

* fix sone error

* fix typro

---------

Co-authored-by: Scotty <jmhgchn@gmail.com>
Co-authored-by: Scotty <527407973@qq.com>
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.

None yet

6 participants