class_docstr: Convert kitti points(N, >=3) to voxels.
  
  Please refer to `PVCNN <https://arxiv.org/abs/1907.03739>`_ for more
  details.
  
  Args:
      voxel_size (tuple or float): The size of voxel with the shape of [3].
      point_cloud_range (tuple or float): The coordinate range of voxel with
          the shape of [6].
      max_num_points (int): maximum points contained in a voxel. if
          max_points=-1, it means using dynamic_voxelize.
      max_voxels (int, optional): maximum voxels this function create.
          for second, 20000 is a good choice. Users should shuffle points
          before call this function because max_voxels may drop points.
          Default: 20000.
class_docstr_tok: ["Convert","kitti","points","(","N",",",">","=3",")","to","voxels",".","Please","refer","to","`","PVCNN","<","https",":","\/\/arxiv.org\/abs\/1907.03739",">","`","_","for","more","details",".","Args",":","voxel_size","(","tuple","or","float",")",":","The","size","of","voxel","with","the","shape","of","[","3","]",".","point_cloud_range","(","tuple","or","float",")",":","The","coordinate","range","of","voxel","with","the","shape","of","[","6","]",".","max_num_points","(","int",")",":","maximum","points","contained","in","a","voxel",".","if","max_points=-1",",","it","means","using","dynamic_voxelize",".","max_voxels","(","int",",","optional",")",":","maximum","voxels","this","function","create",".","for","second",",","20000","is","a","good","choice",".","Users","should","shuffle","points","before","call","this","function","because","max_voxels","may","drop","points",".","Default",":","20000","."]
code: def __init__(
      self,
      voxel_size,
      point_cloud_range,
      max_num_points,
      max_voxels=20000,
  ):
      super().__init__()
  
      self.voxel_size = voxel_size
      self.point_cloud_range = point_cloud_range
      self.max_num_points = max_num_points
      if isinstance(max_voxels, tuple):
          self.max_voxels = max_voxels
      else:
          self.max_voxels = _pair(max_voxels)
  
      point_cloud_range = torch.tensor(
          point_cloud_range, dtype=torch.float32
      )
      voxel_size = torch.tensor(voxel_size, dtype=torch.float32)
      grid_size = (
          point_cloud_range[3:] - point_cloud_range[:3]
      ) / voxel_size
      grid_size = torch.round(grid_size).long()
      input_feat_shape = grid_size[:2]
      self.grid_size = grid_size
      # the origin shape is as [x-len, y-len, z-len]
      # [w, h, d] -> [d, h, w]
      self.pcd_shape = [*input_feat_shape, 1][::-1]
  
file_path: lavis/lavis/common/annotator/uniformer/mmcv/ops/voxelize.py
imports: import torch
  from torch import nn
  from torch.autograd import Function
  from torch.nn.modules.utils import _pair
  from ..utils import ext_loader
label_desc: Use image node_id 1 to create a new Voxelization object from inherited base classes: nn with example: obj = Voxelization(voxel_size, point_cloud_range, max_num_points, max_voxels)