Skip to content

Commit

Permalink
【NPU】fix bug of using temp vector (PaddlePaddle#31963)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiqiu committed Apr 15, 2021
1 parent f5c50b5 commit 3489ae0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion paddle/fluid/operators/fill_constant_op_npu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ class FillConstantNPUKernel : public framework::OpKernel<T> {

Tensor tensor_tmp(data_type);
tensor_tmp.mutable_data<T>({1}, ctx.GetPlace());
TensorFromVector(std::vector<T>{value}, ctx.device_context(), &tensor_tmp);
std::vector<T> init = {value};
TensorFromVector(init, ctx.device_context(), &tensor_tmp);

out_var->mutable_data<T>(shape, place);
auto runner = NpuOpRunner("FillD", {tensor_tmp}, {*out_var},
Expand Down

0 comments on commit 3489ae0

Please sign in to comment.