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

[PTen] Add cast method for Tensor and rename to method to copy_to #37423

Merged

Conversation

chenwhql
Copy link
Contributor

@chenwhql chenwhql commented Nov 22, 2021

PR types

Function optimization

PR changes

APIs

Describe

[PTen] Add cast method for Tensor and rename to method to copy_to

本PR修改内容如下:

  1. 添加Tensor.cast方法的实现及单测,和原先自定义算子体系兼容
  2. 将to方法重命名为copy_to方法,原因包括
  • 原计划to是包含copy_to和cast的一个方法,但cast在Python端是一个正式api,没必要将其功能整合到to,属于过度设计,因此,如果cast不整合到to方法,那么to方法仅承载copy的功能,那么还是copy_to的命名比较合理
  • 根据晓伟在上个PR的评论,to方法在paddle命名空间下有重名风险

@paddle-bot-old
Copy link

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

"2.3, and will be removed in version 2.4, please use `to` "
"method instead. "
"2.3, and will be removed in version 2.4, please use "
"`copy_to` method without template argumentinstead. "
Copy link
Contributor

Choose a reason for hiding this comment

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

argument instead

Copy link
Contributor Author

@chenwhql chenwhql Nov 23, 2021

Choose a reason for hiding this comment

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

I will fix this in next pr, thx

@chenwhql chenwhql merged commit 90dad8b into PaddlePaddle:develop Nov 23, 2021
Zjq9409 pushed a commit to Zjq9409/Paddle that referenced this pull request Dec 10, 2021
…ddlePaddle#37423)

* rename to api to copy_to

* support cast method for tensor

* fix compile failed
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.

3 participants