Compute the grid index given xyz_w. Args: points: (b, n, 3) grid_size: (b, 3) long. number of grid cells in x y z. center: (b, 3) center of the grid grid_width: (b, 3) length (full width) of the grid in xyz mode: 'subidx': return sub idx 'ind': return linear index Returns: grid_idx: if mode == 'subidx': (*, n, 3) long elif mode == 'ind': (*, n) long valid_mask: (b, n) bool cell_counts: (b,
| 187 | // grid_idx = z_idx + y_dix * grid_size_z + x_idx * (grid_size_y * grid_size_z) |
| 188 | // |
| 189 | std::tuple<torch::Tensor, torch::Tensor, torch::Tensor> get_grid_idx( |
| 190 | const torch::Tensor & points, // (*, n, 3), float |
| 191 | const torch::Tensor & grid_size, // (*, 3), long |
| 192 | const torch::Tensor & grid_center, // (*, 3), float |
| 193 | const torch::Tensor & grid_width, // (*, 3), float |
| 194 | const std::string & mode = "ind" |
| 195 | ) { |
| 196 | |
| 197 | CHECK_INPUT(points); |
| 198 | CHECK_INPUT(grid_size); |
| 199 | CHECK_INPUT(grid_center); |
| 200 | CHECK_INPUT(grid_width); |
| 201 | |
| 202 | return get_grid_idx_cuda(points, grid_size, grid_center, grid_width, mode); |
| 203 | } |
| 204 | |
| 205 | |
| 206 |
nothing calls this directly
no outgoing calls
no test coverage detected