diff --git a/paddle/fluid/operators/fill_constant_op_npu.cc b/paddle/fluid/operators/fill_constant_op_npu.cc index 9d5499e00c82f6c562c0bfd115ae89753bf37c6e..eeacd09a9c5c5b90ad4f92e7098841b12f7f837b 100644 --- a/paddle/fluid/operators/fill_constant_op_npu.cc +++ b/paddle/fluid/operators/fill_constant_op_npu.cc @@ -65,7 +65,8 @@ class FillConstantNPUKernel : public framework::OpKernel { Tensor tensor_tmp(data_type); tensor_tmp.mutable_data({1}, ctx.GetPlace()); - TensorFromVector(std::vector{value}, ctx.device_context(), &tensor_tmp); + std::vector init = {value}; + TensorFromVector(init, ctx.device_context(), &tensor_tmp); out_var->mutable_data(shape, place); auto runner = NpuOpRunner("FillD", {tensor_tmp}, {*out_var},