Skip to content

Commit

Permalink
fit for pp
Browse files Browse the repository at this point in the history
  • Loading branch information
FeixLiu committed Jan 1, 2024
1 parent b165539 commit 14017a4
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions paddle/fluid/pybind/eager_method.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1078,12 +1078,17 @@ static PyObject* tensor__share_underline_tensor_to(TensorObject* self,
EAGER_TRY
paddle::Tensor* src_ptr =
&(reinterpret_cast<TensorObject*>(PyTuple_GET_ITEM(args, 0))->tensor);
PADDLE_ENFORCE_EQ(self->tensor.initialized(),
true,
platform::errors::InvalidArgument(
"Tensor %s has not been initialized! please initialize "
"src tensor before share_buffer_with to other.",
self->tensor.name()));
if (!self->tensor.initialized()) {
PADDLE_ENFORCE(self->tensor.is_dist_tensor() &&
!phi::distributed::IsCurRankInMesh(
static_cast<phi::distributed::DistTensor*>(
self->tensor.impl().get())
->process_mesh()),
platform::errors::InvalidArgument(
"Tensor %s has not been initialized! Please initialize "
"src tensor before share_buffer_with to other.",
self->tensor.name()));
}
src_ptr->set_impl(self->tensor.impl());
RETURN_PY_NONE

Expand Down

0 comments on commit 14017a4

Please sign in to comment.