From bc7a3afa687696541b032d56d1e9a8ca8e101c77 Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Tue, 30 Mar 2021 20:17:19 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90NPU=E3=80=91fix=20bug=20of=20using=20t?= =?UTF-8?q?emp=20vector=20(#31963)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- paddle/fluid/operators/fill_constant_op_npu.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/operators/fill_constant_op_npu.cc b/paddle/fluid/operators/fill_constant_op_npu.cc index 9d5499e00c8..eeacd09a9c5 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}, -- GitLab