-
Notifications
You must be signed in to change notification settings - Fork 5.9k
[Compat] Add more constructors for compatible at::Tensor
#76307
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
[Compat] Add more constructors for compatible at::Tensor
#76307
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
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.
Pull Request Overview
This pull request implements copy/move semantics for ATen compatibility layer tensor classes and updates the mutable_data_ptr implementation to use the correct API. The changes improve the API compatibility with PyTorch's ATen library by removing TODO placeholders and implementing standard C++ special member functions.
- Implements copy and move constructors/assignment operators for
TensorandTensorBaseclasses - Changes
mutable_data_ptr()to calldata<T>()instead ofmutable_data<T>() - Removes unused
EmptyTensor.hinclude and addsUtils.hinclude to main ATen header
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| paddle/phi/api/include/compat/ATen/core/TensorMethods.cpp | Updates mutable_data_ptr() to use data<T>() API |
| paddle/phi/api/include/compat/ATen/core/TensorBody.h | Implements copy/move constructors and assignment operators for Tensor class |
| paddle/phi/api/include/compat/ATen/core/TensorBase.h | Adds special member functions (copy/move constructors, destructor, assignment operators) to TensorBase |
| paddle/phi/api/include/compat/ATen/Utils.h | Removes unused EmptyTensor.h include |
| paddle/phi/api/include/compat/ATen/ATen.h | Adds Utils.h include to main header |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
Pull Request Overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
at::Tensorat::Tensor
at::Tensorat::Tensor
PR Category
Execute Infrastructure
PR Types
Improvements
Description
补全
at::Tensor构造函数接口,避免移动构造和拷贝构造触发默认的浅拷贝