From 321f1783356b71939a5515f88893e4aaf7e331f5 Mon Sep 17 00:00:00 2001 From: inter Date: Sun, 21 Sep 2025 20:19:20 +0800 Subject: [PATCH] Add File --- .../pointnet2_batch/src/interpolate.cpp | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 pcdet/ops/pointnet2/pointnet2_batch/src/interpolate.cpp diff --git a/pcdet/ops/pointnet2/pointnet2_batch/src/interpolate.cpp b/pcdet/ops/pointnet2/pointnet2_batch/src/interpolate.cpp new file mode 100644 index 0000000..1c18e27 --- /dev/null +++ b/pcdet/ops/pointnet2/pointnet2_batch/src/interpolate.cpp @@ -0,0 +1,56 @@ +/* +batch version of point interpolation, modified from the original implementation of official PointNet++ codes. +Written by Shaoshuai Shi +All Rights Reserved 2018. +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include "interpolate_gpu.h" + + +void three_nn_wrapper_fast(int b, int n, int m, at::Tensor unknown_tensor, + at::Tensor known_tensor, at::Tensor dist2_tensor, at::Tensor idx_tensor) { + const float *unknown = unknown_tensor.data(); + const float *known = known_tensor.data(); + float *dist2 = dist2_tensor.data(); + int *idx = idx_tensor.data(); + + three_nn_kernel_launcher_fast(b, n, m, unknown, known, dist2, idx); +} + + +void three_interpolate_wrapper_fast(int b, int c, int m, int n, + at::Tensor points_tensor, + at::Tensor idx_tensor, + at::Tensor weight_tensor, + at::Tensor out_tensor) { + + const float *points = points_tensor.data(); + const float *weight = weight_tensor.data(); + float *out = out_tensor.data(); + const int *idx = idx_tensor.data(); + + three_interpolate_kernel_launcher_fast(b, c, m, n, points, idx, weight, out); +} + + +void three_interpolate_grad_wrapper_fast(int b, int c, int n, int m, + at::Tensor grad_out_tensor, + at::Tensor idx_tensor, + at::Tensor weight_tensor, + at::Tensor grad_points_tensor) { + + const float *grad_out = grad_out_tensor.data(); + const float *weight = weight_tensor.data(); + float *grad_points = grad_points_tensor.data(); + const int *idx = idx_tensor.data(); + + three_interpolate_grad_kernel_launcher_fast(b, c, n, m, grad_out, idx, weight, grad_points); +}