MinkowskiPooling池化(上)
MinkowskiPooling池化(上)
 
如果內核大小等于跨步大小(例如kernel_size = [2,1],跨步= [2,1]),則引擎將更快地生成與池化函數相對應的輸入輸出映射。
 如果使用U網絡架構,請使用相同功能的轉置版本進行上采樣。例如pool = MinkowskiSumPooling(kernel_size = 2,stride = 2,D = D),然后使用 unpool = MinkowskiPoolingTranspose(kernel_size = 2,stride = 2,D = D)。
 
stride (int, or list, optional):卷積層的步幅大小。如果使用非同一性,則輸出坐標至少為stride ×× tensor_stride 遠。給出列表時,長度必須為D;每個元素將用于特定軸的步幅大小。
 dilation (int, or list, optional):卷積內核的擴展大小。給出列表時,長度必須為D,并且每個元素都是軸特定的膨脹。所有元素必須> 0。
 kernel_generator (MinkowskiEngine.KernelGenerator, optional):定義自定義內核形狀。
 dimension(int):定義所有輸入和網絡的空間的空間尺寸。例如,圖像在2D空間中,網格和3D形狀在3D空間中。
 當kernel_size ==跨度時,不支持自定義內核形狀。
 cpu() → T
 將所有模型參數和緩沖區移至CPU。
 Returns:
 Module: self
 cuda(device: Optional[Union[int, torch.device]] = None) → T
 將所有模型參數和緩沖區移至GPU。
 這也使關聯的參數并緩沖不同的對象。因此,在構建優化程序之前,如果模塊在優化過程中可以在GPU上運行,則應調用它。
 Arguments:
 device (int, optional): if specified, all parameters will be
 copied to that device
 Returns:
 Module: self
 double() → T
 將所有浮點參數和緩沖區強制轉換為double數據類型。
 返回值:
 模塊:self
 float() →T
 將所有浮點參數和緩沖區強制轉換為float數據類型。
 返回值:
 模塊:self
 forward(input: SparseTensor.SparseTensor, coords: Union[torch.IntTensor, MinkowskiCoords.CoordsKey, SparseTensor.SparseTensor] = None)
 input (MinkowskiEngine.SparseTensor):輸入稀疏張量以對其進行卷積。
 coords ((torch.IntTensor, MinkowskiEngine.CoordsKey, MinkowskiEngine.SparseTensor), optional):如果提供,則在提供的坐標上生成結果。默認情況下沒有。
 to(*args, **kwargs)
 Moves and/or casts the parameters and buffers.
 This can be called as
 to(device=None, dtype=None, non_blocking=False)
 to(dtype, non_blocking=False)
 to(tensor, non_blocking=False)
 to(memory_format=torch.channels_last)
 其簽名類似于torch.Tensor.to(),但僅接受所需dtype的浮點s。另外,此方法將僅將浮點參數和緩沖區強制轉換為dtype (如果給定的話)。device如果給定了整數參數和緩沖區 ,dtype不變。當 non_blocking被設置時,它試圖轉換/如果可能異步相對于移動到主機,例如,移動CPU張量與固定內存到CUDA設備。
 此方法local修改模塊。
 Args:
 device (torch.device): the desired device of the parameters
 and buffers in this module
 dtype (torch.dtype): the desired floating point type of
 the floating point parameters and buffers in this module
 tensor (torch.Tensor): Tensor whose dtype and device are the desired
 dtype and device for all parameters and buffers in this module
 memory_format (torch.memory_format): the desired memory
 format for 4D parameters and buffers in this module (keyword only argument)
 Returns:
 Module: self
 Example:
linear = nn.Linear(2, 2)
linear.weight
Parameter containing:
tensor([[ 0.1913, -0.3420],
[-0.5113, -0.2325]])linear.to(torch.double)
Linear(in_features=2, out_features=2, bias=True)linear.weight
Parameter containing:
tensor([[ 0.1913, -0.3420],
[-0.5113, -0.2325]], dtype=torch.float64)gpu1 = torch.device(“cuda:1”)
linear.to(gpu1, dtype=torch.half, non_blocking=True)
Linear(in_features=2, out_features=2, bias=True)linear.weight
Parameter containing:
tensor([[ 0.1914, -0.3420],
[-0.5112, -0.2324]], dtype=torch.float16, device=‘cuda:1’)cpu = torch.device(“cpu”)
linear.to(cpu)
Linear(in_features=2, out_features=2, bias=True)linear.weight
Parameter containing:
tensor([[ 0.1914, -0.3420],
[-0.5112, -0.2324]], dtype=torch.float16)
type(dst_type: Union[torch.dtype, str]) → T
Casts all parameters and buffers to dst_type.
Arguments:
dst_type (type or string): the desired type
Returns:
Module: self
MinkowskiAvgPooling
平均層首先計算輸入要素的基數,每個輸出的輸入要素數,然后將輸入要素的總和除以基數。對于密集的張量,基數是一個常數,即內核的體積。但是,對于張量稀疏,基數取決于每個輸出的輸入特征的數量而變化。因此,稀疏張量的平均池化不等于傳統的密集張量的平均池化層。請參考MinkowskiSumPooling等效層。
 如果內核大小等于跨步大小(例如kernel_size = [2,1],跨步= [2,1]),則引擎將更快地生成與池化函數相對應的輸入輸出映射。
 如果使用U網絡架構,請使用相同功能的轉置版本進行上采樣。例如pool = MinkowskiSumPooling(kernel_size = 2,stride = 2,D = D),然后使用 unpool = MinkowskiPoolingTranspose(kernel_size = 2,stride = 2,D = D)。
 init(kernel_size=- 1, stride=1, dilation=1, kernel_generator=None, dimension=None)
 高維稀疏平均池化層。
 kernel_size (int, optional): the size of the kernel in the output tensor. If not provided, region_offset should be RegionType.CUSTOM and region_offset should be a 2D matrix with size N×DN×D such that it lists all NN offsets in D-dimension.
 stride (int, or list, optional): stride size of the convolution layer. If non-identity is used, the output coordinates will be at least stride ×× tensor_stride away. When a list is given, the length must be D; each element will be used for stride size for the specific axis.
 dilation (int, or list, optional): dilation size for the convolution kernel. When a list is given, the length must be D and each element is an axis specific dilation. All elements must be > 0.
 kernel_generator (MinkowskiEngine.KernelGenerator, optional): define custom kernel shape.
 dimension (int): the spatial dimension of the space where all the inputs and the network are defined. For example, images are in a 2D space, meshes and 3D shapes are in a 3D space.
 當kernel_size ==跨度時,不支持自定義內核形狀。
 cpu() →T
 將所有模型參數和緩沖區移至CPU。
 返回值:
 模塊:self
 cuda(device: Optional[Union[int, torch.device]] = None) → T
 所有模型參數和緩沖區移至GPU。
 這也使關聯的參數并緩沖不同的對象。因此,在構建優化程序之前,如果模塊在優化過程中可以在GPU上運行,則應調用它。
 Arguments:
 device (int, optional): if specified, all parameters will be
 copied to that device
 Returns:
 Module: self
 double() → T
 將所有浮點參數和緩沖區強制轉換為double數據類型。
 返回值:
 模塊:self
 float() →T
 將所有浮點參數和緩沖區強制轉換為float數據類型。
 返回值:
 模塊:self
 forward(input: SparseTensor.SparseTensor, coords: Union[torch.IntTensor, MinkowskiCoords.CoordsKey, SparseTensor.SparseTensor] = None)
 input (MinkowskiEngine.SparseTensor): Input sparse tensor to apply a convolution on.
 coords ((torch.IntTensor, MinkowskiEngine.CoordsKey, MinkowskiEngine.SparseTensor), optional): If provided, generate results on the provided coordinates. None by default.
 to(*args, **kwargs)
 Moves and/or casts the parameters and buffers.
 This can be called as
 to(device=None, dtype=None, non_blocking=False)
 to(dtype, non_blocking=False)
 to(tensor, non_blocking=False)
 to(memory_format=torch.channels_last)
 其簽名類似于torch.Tensor.to(),但僅接受所需dtype的浮點s。另外,此方法將僅將浮點參數和緩沖區強制轉換為dtype (如果給定的話)。device如果給定了整數參數和緩沖區 ,dtype不變。當 non_blocking被設置時,它試圖轉換/如果可能異步相對于移動到主機,例如,移動CPU張量與固定內存到CUDA設備。
 This method modifies the module in-place.
 Args:
 device (torch.device): the desired device of the parameters
 and buffers in this module
 dtype (torch.dtype): the desired floating point type of
 the floating point parameters and buffers in this module
 tensor (torch.Tensor): Tensor whose dtype and device are the desired
 dtype and device for all parameters and buffers in this module
 memory_format (torch.memory_format): the desired memory
 format for 4D parameters and buffers in this module (keyword only argument)
 Returns:
 Module: self
 Example:
linear = nn.Linear(2, 2)
linear.weight
Parameter containing:
tensor([[ 0.1913, -0.3420],
[-0.5113, -0.2325]])linear.to(torch.double)
Linear(in_features=2, out_features=2, bias=True)linear.weight
Parameter containing:
tensor([[ 0.1913, -0.3420],
[-0.5113, -0.2325]], dtype=torch.float64)gpu1 = torch.device(“cuda:1”)
linear.to(gpu1, dtype=torch.half, non_blocking=True)
Linear(in_features=2, out_features=2, bias=True)linear.weight
Parameter containing:
tensor([[ 0.1914, -0.3420],
[-0.5112, -0.2324]], dtype=torch.float16, device=‘cuda:1’)cpu = torch.device(“cpu”)
linear.to(cpu)
Linear(in_features=2, out_features=2, bias=True)linear.weight
Parameter containing:
tensor([[ 0.1914, -0.3420],
[-0.5112, -0.2324]], dtype=torch.float16)
type(dst_type: Union[torch.dtype, str]) → T
Casts all parameters and buffers to dst_type.
Arguments:
dst_type (type or string): the desired type
Returns:
Module: self
MinkowskiSumPooling
class MinkowskiEngine.MinkowskiSumPooling(kernel_size, stride=1, dilation=1, kernel_generator=None, dimension=None)
Sum all input features within a kernel.
平均層首先計算輸入要素的基數,每個輸出的輸入要素數,然后將輸入要素的總和除以基數。對于密集的張量,基數是一個常數,即內核的體積。但是,對于張量稀疏,基數根據每個輸出的輸入特征數而變化。因此,用基數對輸入特征求平均可能不等于密集張量的常規平均池。該層提供了一種不將總和除以基數的方法。
 如果內核大小等于跨步大小(例如kernel_size = [2,1],跨步= [2,1]),則引擎將更快地生成與池化函數相對應的輸入輸出映射。
 如果使用U網絡架構,請使用相同功能的轉置版本進行上采樣。例如pool = MinkowskiSumPooling(kernel_size = 2,stride = 2,D = D),然后使用 unpool = MinkowskiPoolingTranspose(kernel_size = 2,stride = 2,D = D)。
 init(kernel_size, stride=1, dilation=1, kernel_generator=None, dimension=None)
 a high-dimensional sum pooling layer
 Args:
 kernel_size (int, optional): the size of the kernel in the output tensor. If not provided, region_offset should be RegionType.CUSTOM and region_offset should be a 2D matrix with size N×DN×D such that it lists all NN offsets in D-dimension.
 stride (int, or list, optional): stride size of the convolution layer. If non-identity is used, the output coordinates will be at least stride ×× tensor_stride away. When a list is given, the length must be D; each element will be used for stride size for the specific axis.
 dilation (int, or list, optional): dilation size for the convolution kernel. When a list is given, the length must be D and each element is an axis specific dilation. All elements must be > 0.
 kernel_generator (MinkowskiEngine.KernelGenerator, optional): define custom kernel shape.
 dimension (int): the spatial dimension of the space where all the inputs and the network are defined. For example, images are in a 2D space, meshes and 3D shapes are in a 3D space.
 當kernel_size ==跨度時,不支持自定義內核形狀。
 cpu() →T
 將所有模型參數和緩沖區移至CPU。
 返回值:
 模塊:self
 cuda(device: Optional[Union[int, torch.device]] = None) → T
 將所有模型參數和緩沖區移至GPU。
 這也使關聯的參數并緩沖不同的對象。因此,在構建優化程序之前,如果模塊在優化過程中可以在GPU上運行,則應調用它。
 參數:
 device (int, optional): if specified, all parameters will be
 copied to that device
 Returns:
 Module: self
 double() → T
 將所有浮點參數和緩沖區強制轉換為double數據類型。
 返回值:
 模塊:self
 float() →T
 將所有浮點參數和緩沖區強制轉換為float數據類型。
 返回值:
 模塊:self
 forward(input: SparseTensor.SparseTensor, coords: Union[torch.IntTensor, MinkowskiCoords.CoordsKey, SparseTensor.SparseTensor] = None)
 input (MinkowskiEngine.SparseTensor): Input sparse tensor to apply a convolution on.
 coords ((torch.IntTensor, MinkowskiEngine.CoordsKey, MinkowskiEngine.SparseTensor), optional): If provided, generate results on the provided coordinates. None by default.
 to(*args, **kwargs)
 Moves and/or casts the parameters and buffers.
 This can be called as
 to(device=None, dtype=None, non_blocking=False)
 to(dtype, non_blocking=False)
 to(tensor, non_blocking=False)
 to(memory_format=torch.channels_last)
 其簽名類似于torch.Tensor.to(),但僅接受所需dtype的浮點s。另外,此方法將僅將浮點參數和緩沖區強制轉換為dtype (如果給定的話)。device如果給定了整數參數和緩沖區 ,dtype不變。當 non_blocking被設置時,它試圖轉換/如果可能異步相對于移動到主機,例如,移動CPU張量與固定內存到CUDA設備。
 請參見下面的示例。
 Args:
 device (torch.device): the desired device of the parameters
 and buffers in this module
 dtype (torch.dtype): the desired floating point type of
 the floating point parameters and buffers in this module
 tensor (torch.Tensor): Tensor whose dtype and device are the desired
 dtype and device for all parameters and buffers in this module
 memory_format (torch.memory_format): the desired memory
 format for 4D parameters and buffers in this module (keyword only argument)
 Returns:
 Module: self
 Example:
linear = nn.Linear(2, 2)
linear.weight
Parameter containing:
tensor([[ 0.1913, -0.3420],
[-0.5113, -0.2325]])linear.to(torch.double)
Linear(in_features=2, out_features=2, bias=True)linear.weight
Parameter containing:
tensor([[ 0.1913, -0.3420],
[-0.5113, -0.2325]], dtype=torch.float64)gpu1 = torch.device(“cuda:1”)
linear.to(gpu1, dtype=torch.half, non_blocking=True)
Linear(in_features=2, out_features=2, bias=True)linear.weight
Parameter containing:
tensor([[ 0.1914, -0.3420],
[-0.5112, -0.2324]], dtype=torch.float16, device=‘cuda:1’)cpu = torch.device(“cpu”)
linear.to(cpu)
Linear(in_features=2, out_features=2, bias=True)linear.weight
Parameter containing:
tensor([[ 0.1914, -0.3420],
[-0.5112, -0.2324]], dtype=torch.float16)
type(dst_type: Union[torch.dtype, str]) → T
Casts all parameters and buffers to dst_type.
Arguments:
dst_type (type or string): the desired type
Returns:
Module: self
總結
以上是生活随笔為你收集整理的MinkowskiPooling池化(上)的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: 稀疏张量基础
- 下一篇: MinkowskiPooling池化(下
