Skip to content

Commit fba8f03

Browse files
wanghuancoderjiahy0825
authored andcommitted
refine unsqueeze_kernel (PaddlePaddle#58275)
1 parent fa7dec5 commit fba8f03

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

paddle/phi/kernels/unsqueeze_kernel.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ void UnsqueezeInferKernel(const Context& dev_ctx,
2727
DenseTensor* out) {
2828
auto x_dims = x.dims();
2929
auto out_dims = out->dims();
30-
if (axes.FromTensor()) {
30+
if (axes.FromTensor() && out->dims()[0] == -1) {
3131
out_dims = funcs::GetUnsqueezeShape(axes.GetData(), x_dims);
3232
}
3333
out->Resize(out_dims);

0 commit comments

Comments
 (0)