-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Compatible with torch 3rd #74402
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
Compatible with torch 3rd #74402
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
…Paddle/Paddle into compatible-with-torch-3rd
…ass to avoid warnings
…Paddle/Paddle into compatible-with-torch-3rd
SigureMo
left a comment
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.
一些 TODO,发版后会持续优化
| # Add paddle_includes to pass CI, for more details, | ||
| # please refer to the comments in `paddle/tests/custom_op/utils.py`` | ||
| paddle_includes = [] | ||
| for site_packages_path in getsitepackages(): |
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.
重复的模板代码,一次要改十多处,后续提取成公共逻辑
| classes_[qualified_name] = | ||
| std::make_unique<ClassRegistration>(namespace_name, class_name); | ||
| // TODO(SigureMo): Use vlog for debug logging | ||
| // std::cout << "Registered class: " << qualified_name << std::endl; |
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.
后续拆分到 .cpp 并使用 VLOG 打印
| inline at::Tensor empty(at::IntArrayRef size, | ||
| ::std::optional<at::ScalarType> dtype, | ||
| ::std::optional<at::Layout> layout, | ||
| ::std::optional<at::Device> device, | ||
| ::std::optional<bool> pin_memory, | ||
| ::std::optional<at::MemoryFormat> memory_format) { | ||
| PD_CHECK(!layout.has_value(), "`layout` is not supported now."); | ||
| PD_CHECK(!(pin_memory.has_value() && pin_memory.value() != false), | ||
| "`pin_memory` other than False is not supported now."); | ||
| PD_CHECK(!(memory_format.has_value() && | ||
| memory_format.value() != c10::MemoryFormat::Contiguous), | ||
| "`MemoryFormat` other than Contiguous is not supported now."); | ||
|
|
||
| return paddle::experimental::empty( | ||
| size._PD_ToPaddleIntArray(), | ||
| compat::_PD_AtenScalarTypeToPhiDataType( | ||
| dtype.value_or(c10::get_default_dtype())), | ||
| device.value_or(at::kCPU)._PD_GetInner()); | ||
| } |
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.
能否把这些头文件的实现逻辑放到.cc中,否则使用时很容易编译体积膨胀
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.
能否把这些头文件的实现逻辑放到.cc中,否则使用时很容易编译体积膨胀
好的,后续统一调整一下,一开始这样写主要是和torch的结构统一。
XiaoguangHu01
left a comment
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.
LGTM
PR Category
User Experience
PR Types
New features
Description
pcard-67164
convert torch C++ api to paddle api