-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
[AutoParallel] tensor.cc support auto parallel #58656
[AutoParallel] tensor.cc support auto parallel #58656
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
paddle/phi/api/lib/tensor.cc
Outdated
@@ -213,6 +217,10 @@ T *Tensor::mutable_data() { | |||
if (is_dense_tensor()) { | |||
return static_cast<phi::DenseTensor *>(impl_.get()) | |||
->mutable_data<T>(place()); | |||
} else if (is_dist_tensor()) { | |||
return static_cast<phi::distributed::DistTensor *>(impl_.get()) |
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.
欢哥,unsafe_mutable_value()
会直接修改DistTensor
的local value,应该尽可能的少使用,必须要使用的地方建议用VLOG打印一些调试信息,不然之后debug会困难
paddle/phi/api/lib/tensor.cc
Outdated
@@ -274,6 +286,10 @@ template <typename T> | |||
const T *Tensor::data() const { | |||
if (is_dense_tensor()) { | |||
return static_cast<phi::DenseTensor *>(impl_.get())->data<T>(); | |||
} else if (is_dist_tensor()) { | |||
return static_cast<phi::distributed::DistTensor *>(impl_.get()) | |||
->unsafe_mutable_value() |
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.
这一类建议用static_cast<phi::distributed::DistTensor *>(impl_.get())->value()->data<T>()
,尽可能少开放直接修改DistTensor的接口
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
* tensor.cc support auto parallel
* tensor.cc support auto parallel
* tensor.cc support auto parallel
* tensor.cc support auto parallel
PR types
Others
PR changes
Others
Description
tensor.cc支持AutoParallel
Pcard-73145