-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Split byref op #9956
Split byref op #9956
Conversation
07de995
to
93b3c25
Compare
93b3c25
to
c6d7c2b
Compare
paddle/fluid/framework/tensor_impl.h
Outdated
@@ -162,6 +162,37 @@ inline Tensor& Tensor::ShareDataWith(const Tensor& src) { | |||
return *this; | |||
} | |||
|
|||
inline Tensor& Tensor::ShareDataWith(const Tensor* src, size_t offset) { |
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.
Can we use Tensor::Slice
instead of this new function?
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.
Done.
paddle/fluid/framework/tensor.h
Outdated
@@ -176,6 +176,34 @@ class Tensor { | |||
std::type_index type_; | |||
}; | |||
|
|||
template <typename Place> | |||
struct SharedPlaceholderImpl : public Placeholder { |
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.
Please delete the unused function.
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!
Resolves #9675
Split tensors using shared data to reduce copying when doing distributed training. Currently split by axis0 is supported only.