Skip to content

Commit

Permalink
[NPU] set constant before copy data
Browse files Browse the repository at this point in the history
  • Loading branch information
FeixLiu committed Sep 1, 2021
1 parent 572bad8 commit 93985b1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions paddle/fluid/operators/coalesce_tensor_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ class CoalesceTensorOpKernel : public framework::OpKernel<T> {
auto out_tensors = context.MultiOutput<framework::LoDTensor>("Output");
size_t offset = 0;
if (context.Attr<bool>("copy_data")) {
#ifdef PADDLE_WITH_ASCEND_CL
framework::VisitDataType(
dtype,
FillConstantVisitor<DeviceContext>(
dev_ctx, fused_tensor, static_cast<float>(0.0), dtype, context));
#endif
for (size_t i = 0; i < in_var_names.size(); ++i) {
size_t len = static_cast<size_t>(in_tensors[i]->numel());
auto sub_tensor = fused_tensor->Slice(
Expand Down

1 comment on commit 93985b1

@paddle-bot-old
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congratulation! Your pull request passed all required CI. You could ask reviewer(s) to approve and merge. 🎉

Please sign in to comment.