def forward( self, input: SparseTensor, coordinates: Union[torch.IntTensor, CoordinateMapKey, SparseTensor] = None, ): # Get a new coordinate map key or extract one from the coordinates if input._manager.number_of_unique_batch_indices() == 1: out_coordinate_map_key = input._manager.origin() output, _ = input.F.max(0, True) else: out_coordinate_map_key = _get_coordinate_map_key( input, coordinates) output = self.pooling.apply( input.F, self.pooling_mode, input.coordinate_map_key, out_coordinate_map_key, input._manager, ) return SparseTensor( output, coordinate_map_key=out_coordinate_map_key, coordinate_manager=input.coordinate_manager, )
def forward( self, input: SparseTensor, coordinates: Union[torch.IntTensor, CoordinateMapKey, SparseTensor] = None, ): r""" :attr:`input` (`MinkowskiEngine.SparseTensor`): Input sparse tensor to apply a convolution on. :attr:`coordinates` ((`torch.IntTensor`, `MinkowskiEngine.CoordsKey`, `MinkowskiEngine.SparseTensor`), optional): If provided, generate results on the provided coordinates. None by default. """ assert isinstance(input, SparseTensor) assert input.D == self.dimension # Get a new coordinate map key or extract one from the coordinates out_coordinate_map_key = _get_coordinate_map_key(input, coordinates) outfeat = self.pooling.apply( input.F, self.pooling_mode, self.kernel_generator, input.coordinate_map_key, out_coordinate_map_key, input._manager, ) return SparseTensor( outfeat, coordinate_map_key=out_coordinate_map_key, coordinate_manager=input.coordinate_manager, )
def forward( self, input, coordinates: Union[torch.IntTensor, CoordinateMapKey, SparseTensor] = None, ): # Get a new coordinate map key or extract one from the coordinates if isinstance(input, ME.TensorField): in_coordinate_map_key = input.coordinate_field_map_key out_coordinate_map_key = CoordinateMapKey( input.coordinate_field_map_key.get_coordinate_size()) else: in_coordinate_map_key = input.coordinate_map_key out_coordinate_map_key = _get_coordinate_map_key( input, coordinates) output = self.pooling.apply( input.F, self.pooling_mode, in_coordinate_map_key, out_coordinate_map_key, input._manager, ) return SparseTensor( output, coordinate_map_key=out_coordinate_map_key, coordinate_manager=input.coordinate_manager, )
def forward( self, input: SparseTensor, coordinates: Union[torch.Tensor, CoordinateMapKey, SparseTensor] = None, ): r""" :attr:`input` (`MinkowskiEngine.SparseTensor`): Input sparse tensor to apply a convolution on. :attr:`coordinates` ((`torch.IntTensor`, `MinkowskiEngine.CoordinateMapKey`, `MinkowskiEngine.SparseTensor`), optional): If provided, generate results on the provided coordinates. None by default. """ assert isinstance(input, SparseTensor) assert input.D == self.dimension if self.use_mm: # If the kernel_size == 1, the convolution is simply a matrix # multiplication out_coordinate_map_key = input.coordinate_map_key outfeat = input.F.mm(self.kernel) else: # Get a new coordinate_map_key or extract one from the coords out_coordinate_map_key = _get_coordinate_map_key( input, coordinates, self.kernel_generator.expand_coordinates) outfeat = self.conv.apply( input.F, self.kernel, self.kernel_generator, self.convolution_mode, input.coordinate_map_key, out_coordinate_map_key, input._manager, ) if self.bias is not None: outfeat += self.bias return SparseTensor( outfeat, coordinate_map_key=out_coordinate_map_key, coordinate_manager=input._manager, )
def forward( self, input: SparseTensor, coordinates: Union[torch.IntTensor, CoordinateMapKey, SparseTensor] = None, ): # Get a new coordinate map key or extract one from the coordinates out_coordinate_map_key = _get_coordinate_map_key(input, coordinates) output = self.pooling.apply( input.F, self.pooling_mode, input.coordinate_map_key, out_coordinate_map_key, input._manager, ) return SparseTensor( output, coordinate_map_key=out_coordinate_map_key, coordinate_manager=input.coordinate_manager, )