MCPcopy Create free account
hub / github.com/NVIDIA/MinkowskiEngine / _get_coordinate_map_key

Function _get_coordinate_map_key

MinkowskiEngine/MinkowskiSparseTensor.py:740–769  ·  view source on GitHub ↗

r"""Returns the coordinates map key.

(
    input: SparseTensor,
    coordinates: torch.Tensor = None,
    tensor_stride: StrideType = 1,
    expand_coordinates: bool = False,
)

Source from the content-addressed store, hash-verified

738
739
740def _get_coordinate_map_key(
741 input: SparseTensor,
742 coordinates: torch.Tensor = None,
743 tensor_stride: StrideType = 1,
744 expand_coordinates: bool = False,
745):
746 r"""Returns the coordinates map key."""
747 if coordinates is not None and not expand_coordinates:
748 assert isinstance(coordinates, (CoordinateMapKey, torch.Tensor, SparseTensor))
749 if isinstance(coordinates, torch.Tensor):
750 assert coordinates.ndim == 2
751 coordinate_map_key = CoordinateMapKey(
752 convert_to_int_list(tensor_stride, coordinates.size(1) - 1), ""
753 )
754
755 (
756 coordinate_map_key,
757 (unique_index, inverse_mapping),
758 ) = input._manager.insert_and_map(
759 coordinates, *coordinate_map_key.get_key()
760 )
761 elif isinstance(coordinates, SparseTensor):
762 coordinate_map_key = coordinates.coordinate_map_key
763 else: # CoordinateMapKey type due to the previous assertion
764 coordinate_map_key = coordinates
765 else: # coordinates is None
766 coordinate_map_key = CoordinateMapKey(
767 input.coordinate_map_key.get_coordinate_size()
768 )
769 return coordinate_map_key

Callers 4

forwardMethod · 0.90
forwardMethod · 0.90
forwardMethod · 0.90
forwardMethod · 0.90

Calls 6

get_keyMethod · 0.95
convert_to_int_listFunction · 0.90
CoordinateMapKeyClass · 0.85
get_coordinate_sizeMethod · 0.80
sizeMethod · 0.45
insert_and_mapMethod · 0.45

Tested by

no test coverage detected