11#include "torch/script.h"
15 const torch::Tensor& row_splits,
16 const torch::Tensor& voxel_size,
17 const torch::Tensor& points_range_min,
18 const torch::Tensor& points_range_max,
19 const int64_t max_points_per_voxel,
20 const int64_t max_voxels,
21 torch::Tensor& voxel_coords,
22 torch::Tensor& voxel_point_indices,
23 torch::Tensor& voxel_point_row_splits,
24 torch::Tensor& voxel_batch_splits);
26#ifdef BUILD_CUDA_MODULE
28void VoxelizeCUDA(
const torch::Tensor&
points,
29 const torch::Tensor& row_splits,
30 const torch::Tensor& voxel_size,
31 const torch::Tensor& points_range_min,
32 const torch::Tensor& points_range_max,
33 const int64_t max_points_per_voxel,
34 const int64_t max_voxels,
35 torch::Tensor& voxel_coords,
36 torch::Tensor& voxel_point_indices,
37 torch::Tensor& voxel_point_row_splits,
38 torch::Tensor& voxel_batch_splits);
41#ifdef BUILD_SYCL_MODULE
44 const torch::Tensor& row_splits,
45 const torch::Tensor& voxel_size,
46 const torch::Tensor& points_range_min,
47 const torch::Tensor& points_range_max,
48 const int64_t max_points_per_voxel,
49 const int64_t max_voxels,
50 torch::Tensor& voxel_coords,
51 torch::Tensor& voxel_point_indices,
52 torch::Tensor& voxel_point_row_splits,
53 torch::Tensor& voxel_batch_splits);
59 : device_type(device_type), device_idx(device_idx) {}
62 voxel_coords = torch::empty({rows, cols},
64 .device(device_type, device_idx));
65 *ptr = voxel_coords.data_ptr<int32_t>();
71 .device(device_type, device_idx));
72 *ptr = voxel_point_indices.data_ptr<int64_t>();
76 voxel_point_row_splits =
78 .device(device_type, device_idx));
79 *ptr = voxel_point_row_splits.data_ptr<int64_t>();
85 .device(device_type, device_idx));
86 *ptr = voxel_batch_splits.data_ptr<int64_t>();
89 const torch::Tensor&
VoxelCoords()
const {
return voxel_coords; }
91 return voxel_point_indices;
94 return voxel_point_row_splits;
99 torch::Tensor voxel_coords;
100 torch::Tensor voxel_point_indices;
101 torch::Tensor voxel_point_row_splits;
102 torch::Tensor voxel_batch_splits;
103 torch::DeviceType device_type;
TorchDtype_t ToTorchDtype< int64_t >()
Definition TorchHelper.h:82
TorchDtype_t ToTorchDtype< int32_t >()
Definition TorchHelper.h:78
void VoxelizeSYCLDispatch(const torch::Tensor &points, const torch::Tensor &row_splits, const torch::Tensor &voxel_size, const torch::Tensor &points_range_min, const torch::Tensor &points_range_max, const int64_t max_points_per_voxel, const int64_t max_voxels, torch::Tensor &voxel_coords, torch::Tensor &voxel_point_indices, torch::Tensor &voxel_point_row_splits, torch::Tensor &voxel_batch_splits)
Definition VoxelizeOpKernelSYCL.cpp:19
Definition VoxelizeOpKernel.h:56
const torch::Tensor & VoxelPointIndices() const
Definition VoxelizeOpKernel.h:90
void AllocVoxelPointRowSplits(int64_t **ptr, int64_t num)
Definition VoxelizeOpKernel.h:75
void AllocVoxelBatchSplits(int64_t **ptr, int64_t num)
Definition VoxelizeOpKernel.h:82
void AllocVoxelCoords(int32_t **ptr, int64_t rows, int64_t cols)
Definition VoxelizeOpKernel.h:61
const torch::Tensor & VoxelPointRowSplits() const
Definition VoxelizeOpKernel.h:93
const torch::Tensor & VoxelBatchSplits() const
Definition VoxelizeOpKernel.h:96
void AllocVoxelPointIndices(int64_t **ptr, int64_t num)
Definition VoxelizeOpKernel.h:68
const torch::Tensor & VoxelCoords() const
Definition VoxelizeOpKernel.h:89
VoxelizeOutputAllocator(torch::DeviceType device_type, int device_idx)
Definition VoxelizeOpKernel.h:58
void VoxelizeCPU(const torch::Tensor &points, const torch::Tensor &row_splits, const torch::Tensor &voxel_size, const torch::Tensor &points_range_min, const torch::Tensor &points_range_max, const int64_t max_points_per_voxel, const int64_t max_voxels, torch::Tensor &voxel_coords, torch::Tensor &voxel_point_indices, torch::Tensor &voxel_point_row_splits, torch::Tensor &voxel_batch_splits)
Definition VoxelizeOpKernel.cpp:18