Skip to content

Commit

Permalink
fix unique_kernel support axis=-1
Browse files Browse the repository at this point in the history
  • Loading branch information
sprouteer committed Dec 22, 2022
1 parent 866f492 commit ad9bf65
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions paddle/phi/kernels/cpu/unique_kernel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ void UniqueRawKernel(const Context& context,
return_counts));
} else {
int axis_value = axis[0];
axis_value = (axis_value == -1) ? (x.dims().size() - 1) : axis_value;
phi::VisitDataTypeTiny(
dtype,
phi::funcs::UniqueDimFunctor<Context, T>(context,
Expand Down
1 change: 1 addition & 0 deletions paddle/phi/kernels/gpu/unique_kernel.cu
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ void UniqueRawKernel(const Context& context,
} else {
// 'axis' is required.
int axis_value = axis[0];
axis_value = (axis_value == -1) ? (x.dims().size() - 1) : axis_value;
phi::VisitDataTypeTiny(dtype,
UniqueDimsCUDAFunctor<Context, T>(context,
x,
Expand Down

0 comments on commit ad9bf65

Please sign in to comment.