Skip to content

Commit

Permalink
readd share tensor impl methods
Browse files Browse the repository at this point in the history
  • Loading branch information
chenwhql committed Oct 20, 2021
1 parent 04cf058 commit ab8db2d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions paddle/fluid/framework/pten_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,20 @@ std::shared_ptr<pten::DenseTensor> MakeTensorImpl<pten::DenseTensor>(
pten::TransToPtDataLayout(tensor.layout()));
}

template <>
void ShareTensorImpl<pten::DenseTensor>(pten::DenseTensor* tensor_impl,
LoDTensor* out) {
out->ResetHolderWithType(tensor_impl->allocation(),
pten::TransToProtoVarType(tensor_impl->data_type()));
}

template <>
void ShareTensorImpl<pten::DenseTensor>(pten::DenseTensor* tensor_impl,
Tensor* out) {
out->ResetHolderWithType(tensor_impl->allocation(),
pten::TransToProtoVarType(tensor_impl->data_type()));
}

std::shared_ptr<pten::TensorBase> InputVariableToPtTensor(
const framework::Variable& variable, const pten::TensorArgDef& arg_def) {
auto expected_place = pten::TransToFluidPlace(arg_def.backend);
Expand Down

0 comments on commit ab8db2d

Please sign in to comment.