Skip to content

Commit

Permalink
feat: support torch>=1.11 (open-mmlab#1041)
Browse files Browse the repository at this point in the history
* feat: support torch>=1.11

Fix open-mmlab#900.
Support PyTorch version >= 1.11. Referring to pytorch/pytorch#66765 and https://github.com/pytorch/pytorch/wiki/TH-to-ATen-porting-guide.

* fix: Remove preproc torch version check macros
  • Loading branch information
yihuajack authored Aug 13, 2022
1 parent c233477 commit 9ff29e2
Show file tree
Hide file tree
Showing 10 changed files with 2 additions and 30 deletions.
3 changes: 0 additions & 3 deletions pcdet/ops/pointnet2/pointnet2_batch/src/ball_query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@ All Rights Reserved 2018.

#include <torch/serialize/tensor.h>
#include <vector>
#include <THC/THC.h>
#include <cuda.h>
#include <cuda_runtime_api.h>
#include "ball_query_gpu.h"

extern THCState *state;

#define CHECK_CUDA(x) do { \
if (!x.type().is_cuda()) { \
fprintf(stderr, "%s must be CUDA tensor at %s:%d\n", #x, __FILE__, __LINE__); \
Expand Down
3 changes: 0 additions & 3 deletions pcdet/ops/pointnet2/pointnet2_batch/src/group_points.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@ All Rights Reserved 2018.
#include <cuda.h>
#include <cuda_runtime_api.h>
#include <vector>
#include <THC/THC.h>
#include "group_points_gpu.h"

extern THCState *state;


int group_points_grad_wrapper_fast(int b, int c, int n, int npoints, int nsample,
at::Tensor grad_out_tensor, at::Tensor idx_tensor, at::Tensor grad_points_tensor) {
Expand Down
4 changes: 1 addition & 3 deletions pcdet/ops/pointnet2/pointnet2_batch/src/interpolate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,13 @@ All Rights Reserved 2018.

#include <torch/serialize/tensor.h>
#include <vector>
#include <THC/THC.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <cuda.h>
#include <cuda_runtime_api.h>
#include "interpolate_gpu.h"

extern THCState *state;


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) {
Expand All @@ -43,6 +40,7 @@ void three_interpolate_wrapper_fast(int b, int c, int m, int n,
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,
Expand Down
4 changes: 0 additions & 4 deletions pcdet/ops/pointnet2/pointnet2_batch/src/sampling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@ All Rights Reserved 2018.
#include <torch/serialize/tensor.h>
#include <ATen/cuda/CUDAContext.h>
#include <vector>
#include <THC/THC.h>

#include "sampling_gpu.h"

extern THCState *state;


int gather_points_wrapper_fast(int b, int c, int n, int npoints,
at::Tensor points_tensor, at::Tensor idx_tensor, at::Tensor out_tensor){
Expand Down
4 changes: 1 addition & 3 deletions pcdet/ops/pointnet2/pointnet2_stack/src/ball_query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@ All Rights Reserved 2019-2020.

#include <torch/serialize/tensor.h>
#include <vector>
#include <THC/THC.h>
#include <cuda.h>
#include <cuda_runtime_api.h>
#include "ball_query_gpu.h"

extern THCState *state;

#define CHECK_CUDA(x) do { \
if (!x.type().is_cuda()) { \
fprintf(stderr, "%s must be CUDA tensor at %s:%d\n", #x, __FILE__, __LINE__); \
Expand All @@ -28,6 +25,7 @@ extern THCState *state;
} while (0)
#define CHECK_INPUT(x) CHECK_CUDA(x);CHECK_CONTIGUOUS(x)


int ball_query_wrapper_stack(int B, int M, float radius, int nsample,
at::Tensor new_xyz_tensor, at::Tensor new_xyz_batch_cnt_tensor,
at::Tensor xyz_tensor, at::Tensor xyz_batch_cnt_tensor, at::Tensor idx_tensor) {
Expand Down
2 changes: 0 additions & 2 deletions pcdet/ops/pointnet2/pointnet2_stack/src/group_points.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ All Rights Reserved 2019-2020.
#include <cuda.h>
#include <cuda_runtime_api.h>
#include <vector>
#include <THC/THC.h>
#include "group_points_gpu.h"

extern THCState *state;
#define CHECK_CUDA(x) do { \
if (!x.type().is_cuda()) { \
fprintf(stderr, "%s must be CUDA tensor at %s:%d\n", #x, __FILE__, __LINE__); \
Expand Down
3 changes: 0 additions & 3 deletions pcdet/ops/pointnet2/pointnet2_stack/src/interpolate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,13 @@ All Rights Reserved 2019-2020.

#include <torch/serialize/tensor.h>
#include <vector>
#include <THC/THC.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <cuda.h>
#include <cuda_runtime_api.h>
#include "interpolate_gpu.h"

extern THCState *state;

#define CHECK_CUDA(x) do { \
if (!x.type().is_cuda()) { \
fprintf(stderr, "%s must be CUDA tensor at %s:%d\n", #x, __FILE__, __LINE__); \
Expand Down
3 changes: 0 additions & 3 deletions pcdet/ops/pointnet2/pointnet2_stack/src/sampling.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
#include <torch/serialize/tensor.h>
#include <ATen/cuda/CUDAContext.h>
#include <vector>
#include <THC/THC.h>

#include "sampling_gpu.h"

extern THCState *state;
#define CHECK_CUDA(x) do { \
if (!x.type().is_cuda()) { \
fprintf(stderr, "%s must be CUDA tensor at %s:%d\n", #x, __FILE__, __LINE__); \
Expand Down
3 changes: 0 additions & 3 deletions pcdet/ops/pointnet2/pointnet2_stack/src/vector_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,10 @@ All Rights Reserved 2020.

#include <torch/serialize/tensor.h>
#include <vector>
#include <THC/THC.h>
#include <cuda.h>
#include <cuda_runtime_api.h>
#include "vector_pool_gpu.h"

extern THCState *state;

#define CHECK_CUDA(x) do { \
if (!x.type().is_cuda()) { \
fprintf(stderr, "%s must be CUDA tensor at %s:%d\n", #x, __FILE__, __LINE__); \
Expand Down
3 changes: 0 additions & 3 deletions pcdet/ops/pointnet2/pointnet2_stack/src/voxel_query.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
#include <torch/serialize/tensor.h>
#include <vector>
#include <THC/THC.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <cuda.h>
#include <cuda_runtime_api.h>
#include "voxel_query_gpu.h"

extern THCState *state;

#define CHECK_CUDA(x) do { \
if (!x.type().is_cuda()) { \
fprintf(stderr, "%s must be CUDA tensor at %s:%d\n", #x, __FILE__, __LINE__); \
Expand Down

0 comments on commit 9ff29e2

Please sign in to comment.