From b5d8bd2f25d8000a82f21303017351c11cd21c04 Mon Sep 17 00:00:00 2001 From: limingshu <61349199+JamesLim-sy@users.noreply.github.com> Date: Tue, 23 Aug 2022 14:47:57 +0800 Subject: [PATCH] first commit (#45253) --- paddle/phi/kernels/shape_kernel.cc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/paddle/phi/kernels/shape_kernel.cc b/paddle/phi/kernels/shape_kernel.cc index f35b7e5444..d4dbdbaf17 100644 --- a/paddle/phi/kernels/shape_kernel.cc +++ b/paddle/phi/kernels/shape_kernel.cc @@ -23,12 +23,9 @@ template void ShapeKernel(const Context& ctx, const DenseTensor& input, DenseTensor* out) { - auto in_var = &input; - phi::DDim in_dims; - in_dims = in_var->dims(); - auto out_t = out; - out_t->Resize({in_dims.size()}); - auto out_data = ctx.template HostAlloc(out_t); + auto& in_dims = input.dims(); + out->Resize({in_dims.size()}); + auto out_data = ctx.template HostAlloc(out); for (int i = 0; i < in_dims.size(); ++i) { out_data[i] = in_dims[i]; } -- GitLab