MCPcopy Create free account
hub / github.com/apple/ml-pointersect / get_grid_idx

Function get_grid_idx

pointersect/pr/cuda/pr_cuda.cpp:189–203  ·  view source on GitHub ↗

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,

Source from the content-addressed store, hash-verified

187// grid_idx = z_idx + y_dix * grid_size_z + x_idx * (grid_size_y * grid_size_z)
188//
189std::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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected