未验证 提交 bc7a3afa 编写于 作者: L Leo Chen 提交者: GitHub

【NPU】fix bug of using temp vector (#31963)

上级 a6343afc
...@@ -65,7 +65,8 @@ class FillConstantNPUKernel : public framework::OpKernel<T> { ...@@ -65,7 +65,8 @@ class FillConstantNPUKernel : public framework::OpKernel<T> {
Tensor tensor_tmp(data_type); Tensor tensor_tmp(data_type);
tensor_tmp.mutable_data<T>({1}, ctx.GetPlace()); 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); out_var->mutable_data<T>(shape, place);
auto runner = NpuOpRunner("FillD", {tensor_tmp}, {*out_var}, auto runner = NpuOpRunner("FillD", {tensor_tmp}, {*out_var},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册