Skip to content

Commit

Permalink
fix xpu expand
Browse files Browse the repository at this point in the history
  • Loading branch information
yunyaoXYY committed Feb 21, 2023
1 parent 6624842 commit 91ab26c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 0 additions & 1 deletion paddle/phi/kernels/xpu/expand_as_kernel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ void ExpandAs(const Context& context,
}
}
if (target_shape.size() == 0) {
std::cout << "XYY Debug, debug the 「Tensor holds no memory」" << std::endl;
phi::DDim out_dims = phi::make_ddim(target_shape);
out->Resize(out_dims);
context.template Alloc<T>(out);
Expand Down
4 changes: 4 additions & 0 deletions paddle/phi/kernels/xpu/expand_kernel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ void ExpandKernel(const Context& ctx,
rank));

if (shape_size == 0) {
phi::DDim out_dims = phi::make_ddim(final_expand_shape);
out->Resize(out_dims);
context.template Alloc<T>(out);

int r = xpu::copy<XPUType>(ctx.x_context(),
reinterpret_cast<const XPUType*>(x.data<T>()),
reinterpret_cast<XPUType*>(out->data<T>()),
Expand Down

0 comments on commit 91ab26c

Please sign in to comment.