original_docstring: Convert sequence of identical (legacy) Open3D geometry types to
      attribute-tensor dictionary. The geometry seequence forms a batch of data.
      Custom attributes are not supported.
  
      TODO: This involves a data copy. Add support for List[Open3D geometry]
      directly to add_3d() if needed.
  
      Args:
          o3d_geometry_list (Iterable): Iterable (list / tuple / sequence
              generator) of Open3D Tensor geometry types.
  
      Returns:
          Dict[str: numpy.array]: Dictionary of property names and corresponding
          Numpy arrays.
      
docstring: Convert sequence of identical (legacy) Open3D geometry types to
  attribute-tensor dictionary. The geometry seequence forms a batch of data.
  Custom attributes are not supported.
  
  This involves a data copy. Add support for List[Open3D geometry]
  directly to add_3d() if needed.
docstring_tokens: Convert sequence of identical ( legacy ) Open3D geometry types to attribute - tensor dictionary . The geometry seequence forms a batch of data . Custom attributes are not supported . This involves a data copy . Add support for List [ Open3D geometry ] directly to add_3d () if needed .
code: def to_dict_batch(o3d_geometry_list):
      """Convert sequence of identical (legacy) Open3D geometry types to
      attribute-tensor dictionary. The geometry seequence forms a batch of data.
      Custom attributes are not supported.
  
      TODO: This involves a data copy. Add support for List[Open3D geometry]
      directly to add_3d() if needed.
  
      Args:
          o3d_geometry_list (Iterable): Iterable (list / tuple / sequence
              generator) of Open3D Tensor geometry types.
  
      Returns:
          Dict[str: numpy.array]: Dictionary of property names and corresponding
          Numpy arrays.
      """
      if len(o3d_geometry_list) == 0:
          return {}
      if isinstance(o3d_geometry_list[0], o3d.geometry.PointCloud):
          vertex_positions = []
          vertex_colors = []
          vertex_normals = []
          for geometry in o3d_geometry_list:
              vertex_positions.append(np.asarray(geometry.points))
              vertex_colors.append(np.asarray(geometry.colors))
              vertex_normals.append(np.asarray(geometry.normals))
  
          geo_dict = {
              'vertex_positions': np.stack(vertex_positions, axis=0),
              'vertex_colors': np.stack(vertex_colors, axis=0),
              'vertex_normals': np.stack(vertex_normals, axis=0),
          }
  
      elif isinstance(o3d_geometry_list[0], o3d.geometry.TriangleMesh):
          vertex_positions = []
          vertex_colors = []
          vertex_normals = []
          triangle_indices = []
          for geometry in o3d_geometry_list:
              vertex_positions.append(np.asarray(geometry.vertices))
              vertex_colors.append(np.asarray(geometry.vertex_colors))
              vertex_normals.append(np.asarray(geometry.vertex_normals))
              triangle_indices.append(np.asarray(geometry.triangles))
  
          geo_dict = {
              'vertex_positions': np.stack(vertex_positions, axis=0),
              'vertex_colors': np.stack(vertex_colors, axis=0),
              'vertex_normals': np.stack(vertex_normals, axis=0),
              'triangle_indices': np.stack(triangle_indices, axis=0),
          }
  
      elif isinstance(o3d_geometry_list[0], o3d.geometry.LineSet):
          vertex_positions = []
          line_colors = []
          line_indices = []
          for geometry in o3d_geometry_list:
              vertex_positions.append(np.asarray(geometry.points))
              line_colors.append(np.asarray(geometry.colors))
              line_indices.append(np.asarray(geometry.lines))
  
          geo_dict = {
              'vertex_positions': np.stack(vertex_positions, axis=0),
              'line_colors': np.stack(line_colors, axis=0),
              'line_indices': np.stack(line_indices, axis=0),
          }
  
      else:
          raise NotImplementedError(
              f"Geometry type {type(o3d_geometry_list[0])} is not suported yet.")
  
      # remove empty arrays
      for prop in tuple(geo_dict.keys()):
          if geo_dict[prop].size == 0:
              del geo_dict[prop]
      return geo_dict
code_tokens: def to_dict_batch ( o3d_geometry_list ) : if len ( o3d_geometry_list ) == 0 : return { } if isinstance ( o3d_geometry_list [ 0 ] , o3d . geometry . PointCloud ) : vertex_positions = [ ] vertex_colors = [ ] vertex_normals = [ ] for geometry in o3d_geometry_list : vertex_positions . append ( np . asarray ( geometry . points ) ) vertex_colors . append ( np . asarray ( geometry . colors ) ) vertex_normals . append ( np . asarray ( geometry . normals ) ) geo_dict = { 'vertex_positions' : np . stack ( vertex_positions , axis = 0 ) , 'vertex_colors' : np . stack ( vertex_colors , axis = 0 ) , 'vertex_normals' : np . stack ( vertex_normals , axis = 0 ) , } elif isinstance ( o3d_geometry_list [ 0 ] , o3d . geometry . TriangleMesh ) : vertex_positions = [ ] vertex_colors = [ ] vertex_normals = [ ] triangle_indices = [ ] for geometry in o3d_geometry_list : vertex_positions . append ( np . asarray ( geometry . vertices ) ) vertex_colors . append ( np . asarray ( geometry . vertex_colors ) ) vertex_normals . append ( np . asarray ( geometry . vertex_normals ) ) triangle_indices . append ( np . asarray ( geometry . triangles ) ) geo_dict = { 'vertex_positions' : np . stack ( vertex_positions , axis = 0 ) , 'vertex_colors' : np . stack ( vertex_colors , axis = 0 ) , 'vertex_normals' : np . stack ( vertex_normals , axis = 0 ) , 'triangle_indices' : np . stack ( triangle_indices , axis = 0 ) , } elif isinstance ( o3d_geometry_list [ 0 ] , o3d . geometry . LineSet ) : vertex_positions = [ ] line_colors = [ ] line_indices = [ ] for geometry in o3d_geometry_list : vertex_positions . append ( np . asarray ( geometry . points ) ) line_colors . append ( np . asarray ( geometry . colors ) ) line_indices . append ( np . asarray ( geometry . lines ) ) geo_dict = { 'vertex_positions' : np . stack ( vertex_positions , axis = 0 ) , 'line_colors' : np . stack ( line_colors , axis = 0 ) , 'line_indices' : np . stack ( line_indices , axis = 0 ) , } else : raise NotImplementedError ( f"Geometry type {type(o3d_geometry_list[0])} is not suported yet." ) for prop in tuple ( geo_dict . keys ( ) ) : if geo_dict [ prop ] . size == 0 : del geo_dict [ prop ] return geo_dict
short_docstring: Convert sequence of identical (legacy) Open3D geometry types to
  attribute-tensor dictionary.
short_docstring_tokens: Convert sequence of identical ( legacy ) Open3D geometry types to attribute - tensor dictionary .
comment: """Convert sequence of identical (legacy) Open3D geometry types to
      attribute-tensor dictionary. The geometry seequence forms a batch of data.
      Custom attributes are not supported.
  
      TODO: This involves a data copy. Add support for List[Open3D geometry]
      directly to add_3d() if needed.
  
      Args:
          o3d_geometry_list (Iterable): Iterable (list / tuple / sequence
              generator) of Open3D Tensor geometry types.
  
      Returns:
          Dict[str: numpy.array]: Dictionary of property names and corresponding
          Numpy arrays.
      """$SEP$# remove empty arrays