Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add unique_op #9819

Merged
merged 10 commits into from
Dec 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lite/kernels/host/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ add_kernel(distribute_fpn_proposals_compute_host Host extra SRCS distribute_fpn_
add_kernel(collect_fpn_proposals_compute_host Host extra SRCS collect_fpn_proposals_compute.cc)
add_kernel(flip_compute_host Host extra SRCS flip_compute.cc)
add_kernel(unique_with_counts_compute Host extra SRCS unique_with_counts_compute.cc)
add_kernel(unique_compute Host extra SRCS unique_compute.cc)
add_kernel(roi_align_compute Host extra SRCS roi_align_compute.cc)
add_kernel(box_clip_compute Host extra SRCS box_clip_compute.cc)
add_kernel(gaussian_random_compute Host extra SRCS gaussian_random_compute.cc)
Expand Down
15 changes: 15 additions & 0 deletions lite/kernels/host/index_select_compute.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ void Index_selectCompute<T>::Run() {
auto index_ddim = index->dims();
auto output_ddim = output->dims();

if (param.dim < 0) param.dim += input_ddim.size();

int left = input_ddim.count(0, param.dim);
int middle = input_ddim[param.dim];
int right = input_ddim.count(param.dim + 1, input_ddim.size());
Expand Down Expand Up @@ -72,6 +74,19 @@ REGISTER_LITE_KERNEL(index_select,

#ifdef LITE_BUILD_EXTRA

REGISTER_LITE_KERNEL(index_select,
kHost,
kAny,
kNCHW,
paddle::lite::kernels::host::Index_selectCompute<int64_t>,
int64)
.BindInput("X", {LiteType::GetTensorTy(TARGET(kHost), PRECISION(kInt64))})
.BindOutput("Out", {LiteType::GetTensorTy(TARGET(kHost), PRECISION(kAny))})
.BindInput("Index",
{LiteType::GetTensorTy(TARGET(kHost), PRECISION(kInt64))})
.BindPaddleOpVersion("index_select", 1)
.Finalize();

REGISTER_LITE_KERNEL(index_select,
kHost,
kAny,
Expand Down
Loading