diff --git a/paddle/fluid/operators/expand_op_npu.cc b/paddle/fluid/operators/expand_op_npu.cc index e32e706742fa5..ed10ff69f8391 100644 --- a/paddle/fluid/operators/expand_op_npu.cc +++ b/paddle/fluid/operators/expand_op_npu.cc @@ -57,16 +57,13 @@ class ExpandNPUKernel : public framework::OpKernel { "of dimensions (%d) of the input.", expand_times.size(), static_cast(in_dims.size()))); auto* out0 = context.Output("Out"); + out0->mutable_data(context.device_context().GetPlace()); framework::DDim out_dims(in_dims); for (size_t i = 0; i < expand_times.size(); ++i) { out_dims[i] *= expand_times[i]; } out0->Resize(out_dims); - - framework::LoDTensor expand_times_t; - TensorFromVector(expand_times, context.device_context(), &expand_times_t); - - auto runner = NpuOpRunner("Tile", {*in0, expand_times_t}, {*out0}); + auto runner = NpuOpRunner("TileD", {*in0}, {*out0}, {{"multiples", expand_times}}); auto stream = context.template device_context() .stream();