MinkowskiPooling

MinkowskiMaxPooling

class MinkowskiEngine.MinkowskiMaxPooling(kernel_size, stride=1, dilation=1, kernel_generator=None, dimension=None)

稀疏张量的最大池化层。

\[y^c_\mathbf{u} = \max_{\mathbf{i} \in \mathcal{N}^D(\mathbf{u}, \mathcal{C}^\text{in})} x^c_{\mathbf{u} + \mathbf{i}} \; \text{for} \; \mathbf{u} \in \mathcal{C}^\text{out}\]

其中 \(y^c_\mathbf{u}\) 是通道 \(c\) 和坐标 \(\mathbf{u}\) 处的特征。

注意

如果内核大小等于步长大小,例如 kernel_size = [2, 1], stride = [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)

用于稀疏张量的高维最大池化层。

Args

kernel_size (int, optional): 输出张量中内核的大小。如果未提供,则 region_offset 应该为 RegionType.CUSTOM 并且 region_offset 应该是一个大小为 \(N\times D\) 的 2D 矩阵,这样它列出了 D 维中的所有 \(N\) 偏移量。

stride (int, or list, optional): 卷积层的步长大小。 如果使用非恒等变换,则输出坐标将至少远离 stride \(\times\) tensor_stride。 当给出列表时,长度必须为 D; 每个元素将用于特定轴的步长大小。

dilation (int, or list, optional): 卷积内核的扩张大小。 当给出列表时,长度必须为 D,并且每个元素都是轴特定的扩张。 所有元素必须 > 0。

kernel_generator (MinkowskiEngine.KernelGenerator, optional): 定义自定义内核形状。

dimension (int): 定义所有输入和网络的空间的空间维度。 例如,图像位于 2D 空间中,网格和 3D 形状位于 3D 空间中。

警告

当 kernel_size == stride 时,不支持自定义内核形状。

cpu() → T

将所有模型参数和缓冲区移动到 CPU。

返回值

Module: self

cuda(device: Optional[Union[int, torch.device]] = None) → T

将所有模型参数和缓冲区移动到 GPU。

这也使得相关的参数和缓冲区成为不同的对象。 因此,如果在优化时模块将位于 GPU 上,则应在构建优化器之前调用它。

参数
device (int, optional): 如果指定,所有参数都将

复制到该设备

返回值

Module: self

double() → T

将所有浮点参数和缓冲区转换为 double 数据类型。

返回值

Module: self

float() → T

将所有浮点参数和缓冲区转换为 float 数据类型。

返回值

Module: self

forward(input: MinkowskiSparseTensor.SparseTensor, coordinates: Optional[Union[torch.IntTensor, MinkowskiEngineBackend._C.CoordinateMapKey, MinkowskiSparseTensor.SparseTensor]] = None)

input (MinkowskiEngine.SparseTensor): 要在其上应用卷积的输入稀疏张量。

coordinates ((torch.IntTensor, MinkowskiEngine.CoordsKey, MinkowskiEngine.SparseTensor), optional): 如果提供,则在提供的坐标上生成结果。 默认为 None。

to(*args, **kwargs)

移动和/或转换参数和缓冲区。

可以调用为

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。 此外,此方法只会将浮点参数和缓冲区转换为 dtype(如果给出)。 如果给出了 device,则整数参数和缓冲区将以不变的 dtype 移动 device。 设置 non_blocking 时,如果可能,它会尝试相对于主机异步转换/移动,例如,将具有固定内存的 CPU 张量移动到 CUDA 设备。

有关示例,请参见下文。

注意

此方法就地修改模块。

Args
device (torch.device): 此模块中参数所需的设备

和缓冲区

dtype (torch.dtype):此模块中浮点参数和缓冲区的所需浮点类型

此模块中浮点参数和缓冲区的所需浮点类型

tensor (torch.Tensor):Tensor,其 dtype 和 device 是此模块中所有参数和缓冲区的所需 dtype 和 device

dtype 和 device 是此模块中所有参数和缓冲区的所需 dtype 和 device

memory_format (torch.memory_format):此模块中 4D 参数和缓冲区的所需内存格式(仅关键字参数)

format for 4D parameters and buffers in this module (keyword only argument)

返回值

Module: self

示例

>>> 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

将所有参数和缓冲区转换为 dst_type

参数

dst_type (type or string):所需的类型

返回值

Module: self

MinkowskiAvgPooling

class MinkowskiEngine.MinkowskiAvgPooling(kernel_size=- 1, stride=1, dilation=1, kernel_generator=None, dimension=None)

对内核内的输入特征进行平均。

\[\mathbf{y}_\mathbf{u} = \frac{1}{|\mathcal{N}^D(\mathbf{u}, \mathcal{C}^\text{in})|} \sum_{\mathbf{i} \in \mathcal{N}^D(\mathbf{u}, \mathcal{C}^\text{in})} \mathbf{x}_{\mathbf{u} + \mathbf{i}} \; \text{for} \; \mathbf{u} \in \mathcal{C}^\text{out}\]

对于 \(\mathcal{C}^\text{out}\) 中的每个输出 \(\mathbf{u}\),对输入特征进行平均。

注意

平均层首先计算输入特征的基数,每个输出的输入特征数量,并将输入特征的总和除以基数。对于密集张量,基数是一个常数,即内核的体积。但是,对于稀疏张量,基数根据每个输出的输入特征数量而变化。因此,稀疏张量的平均池化不等同于密集张量的传统平均池化层。请参考 MinkowskiSumPooling 以获取等效层。

注意

如果内核大小等于步长大小,例如 kernel_size = [2, 1], stride = [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)

高维稀疏平均池化层。

Args

kernel_size (int, optional): 输出张量中内核的大小。如果未提供,则 region_offset 应该为 RegionType.CUSTOM 并且 region_offset 应该是一个大小为 \(N\times D\) 的 2D 矩阵,这样它列出了 D 维中的所有 \(N\) 偏移量。

stride (int, or list, optional): 卷积层的步长大小。 如果使用非恒等变换,则输出坐标将至少远离 stride \(\times\) tensor_stride。 当给出列表时,长度必须为 D; 每个元素将用于特定轴的步长大小。

dilation (int, or list, optional): 卷积内核的扩张大小。 当给出列表时,长度必须为 D,并且每个元素都是轴特定的扩张。 所有元素必须 > 0。

kernel_generator (MinkowskiEngine.KernelGenerator, optional): 定义自定义内核形状。

dimension (int): 定义所有输入和网络的空间的空间维度。 例如,图像位于 2D 空间中,网格和 3D 形状位于 3D 空间中。

警告

当 kernel_size == stride 时,不支持自定义内核形状。

cpu() → T

将所有模型参数和缓冲区移动到 CPU。

返回值

Module: self

cuda(device: Optional[Union[int, torch.device]] = None) → T

将所有模型参数和缓冲区移动到 GPU。

这也使得相关的参数和缓冲区成为不同的对象。 因此,如果在优化时模块将位于 GPU 上,则应在构建优化器之前调用它。

参数
device (int, optional): 如果指定,所有参数都将

复制到该设备

返回值

Module: self

double() → T

将所有浮点参数和缓冲区转换为 double 数据类型。

返回值

Module: self

float() → T

将所有浮点参数和缓冲区转换为 float 数据类型。

返回值

Module: self

forward(input: MinkowskiSparseTensor.SparseTensor, coordinates: Optional[Union[torch.IntTensor, MinkowskiEngineBackend._C.CoordinateMapKey, MinkowskiSparseTensor.SparseTensor]] = None)

input (MinkowskiEngine.SparseTensor): 要在其上应用卷积的输入稀疏张量。

coordinates ((torch.IntTensor, MinkowskiEngine.CoordsKey, MinkowskiEngine.SparseTensor), optional): 如果提供,则在提供的坐标上生成结果。 默认为 None。

to(*args, **kwargs)

移动和/或转换参数和缓冲区。

可以调用为

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。 此外,此方法只会将浮点参数和缓冲区转换为 dtype(如果给出)。 如果给出了 device,则整数参数和缓冲区将以不变的 dtype 移动 device。 设置 non_blocking 时,如果可能,它会尝试相对于主机异步转换/移动,例如,将具有固定内存的 CPU 张量移动到 CUDA 设备。

有关示例,请参见下文。

注意

此方法就地修改模块。

Args
device (torch.device): 此模块中参数所需的设备

和缓冲区

dtype (torch.dtype):此模块中浮点参数和缓冲区的所需浮点类型

此模块中浮点参数和缓冲区的所需浮点类型

tensor (torch.Tensor):Tensor,其 dtype 和 device 是此模块中所有参数和缓冲区的所需 dtype 和 device

dtype 和 device 是此模块中所有参数和缓冲区的所需 dtype 和 device

memory_format (torch.memory_format):此模块中 4D 参数和缓冲区的所需内存格式(仅关键字参数)

format for 4D parameters and buffers in this module (keyword only argument)

返回值

Module: self

示例

>>> 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

将所有参数和缓冲区转换为 dst_type

参数

dst_type (type or string):所需的类型

返回值

Module: self

MinkowskiSumPooling

class MinkowskiEngine.MinkowskiSumPooling(kernel_size, stride=1, dilation=1, kernel_generator=None, dimension=None)

对内核内的所有输入特征求和。

\[\mathbf{y}_\mathbf{u} = \sum_{\mathbf{i} \in \mathcal{N}^D(\mathbf{u}, \mathcal{C}^\text{in})} \mathbf{x}_{\mathbf{u} + \mathbf{i}} \; \text{for} \; \mathbf{u} \in \mathcal{C}^\text{out}\]

对于 \(\mathcal{C}^\text{out}\) 中的每个输出 \(\mathbf{u}\),对输入特征进行平均。

注意

平均层首先计算输入特征的基数,每个输出的输入特征数量,并将输入特征的总和除以基数。对于密集张量,基数是一个常数,即内核的体积。但是,对于稀疏张量,基数根据每个输出的输入特征数量而变化。因此,使用基数对输入特征进行平均可能不等同于密集张量的传统平均池化。此层提供了一种替代方法,该方法不将总和除以基数。

注意

如果内核大小等于步长大小,例如 kernel_size = [2, 1], stride = [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)

高维求和池化层

Args

kernel_size (int, optional): 输出张量中内核的大小。如果未提供,则 region_offset 应该为 RegionType.CUSTOM 并且 region_offset 应该是一个大小为 \(N\times D\) 的 2D 矩阵,这样它列出了 D 维中的所有 \(N\) 偏移量。

stride (int, or list, optional): 卷积层的步长大小。 如果使用非恒等变换,则输出坐标将至少远离 stride \(\times\) tensor_stride。 当给出列表时,长度必须为 D; 每个元素将用于特定轴的步长大小。

dilation (int, or list, optional): 卷积内核的扩张大小。 当给出列表时,长度必须为 D,并且每个元素都是轴特定的扩张。 所有元素必须 > 0。

kernel_generator (MinkowskiEngine.KernelGenerator, optional): 定义自定义内核形状。

dimension (int): 定义所有输入和网络的空间的空间维度。 例如,图像位于 2D 空间中,网格和 3D 形状位于 3D 空间中。

警告

当 kernel_size == stride 时,不支持自定义内核形状。

cpu() → T

将所有模型参数和缓冲区移动到 CPU。

返回值

Module: self

cuda(device: Optional[Union[int, torch.device]] = None) → T

将所有模型参数和缓冲区移动到 GPU。

这也使得相关的参数和缓冲区成为不同的对象。 因此,如果在优化时模块将位于 GPU 上,则应在构建优化器之前调用它。

参数
device (int, optional): 如果指定,所有参数都将

复制到该设备

返回值

Module: self

double() → T

将所有浮点参数和缓冲区转换为 double 数据类型。

返回值

Module: self

float() → T

将所有浮点参数和缓冲区转换为 float 数据类型。

返回值

Module: self

forward(input: MinkowskiSparseTensor.SparseTensor, coordinates: Optional[Union[torch.IntTensor, MinkowskiEngineBackend._C.CoordinateMapKey, MinkowskiSparseTensor.SparseTensor]] = None)

input (MinkowskiEngine.SparseTensor): 要在其上应用卷积的输入稀疏张量。

coordinates ((torch.IntTensor, MinkowskiEngine.CoordsKey, MinkowskiEngine.SparseTensor), optional): 如果提供,则在提供的坐标上生成结果。 默认为 None。

to(*args, **kwargs)

移动和/或转换参数和缓冲区。

可以调用为

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。 此外,此方法只会将浮点参数和缓冲区转换为 dtype(如果给出)。 如果给出了 device,则整数参数和缓冲区将以不变的 dtype 移动 device。 设置 non_blocking 时,如果可能,它会尝试相对于主机异步转换/移动,例如,将具有固定内存的 CPU 张量移动到 CUDA 设备。

有关示例,请参见下文。

注意

此方法就地修改模块。

Args
device (torch.device): 此模块中参数所需的设备

和缓冲区

dtype (torch.dtype):此模块中浮点参数和缓冲区的所需浮点类型

此模块中浮点参数和缓冲区的所需浮点类型

tensor (torch.Tensor):Tensor,其 dtype 和 device 是此模块中所有参数和缓冲区的所需 dtype 和 device

dtype 和 device 是此模块中所有参数和缓冲区的所需 dtype 和 device

memory_format (torch.memory_format):此模块中 4D 参数和缓冲区的所需内存格式(仅关键字参数)

format for 4D parameters and buffers in this module (keyword only argument)

返回值

Module: self

示例

>>> 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

将所有参数和缓冲区转换为 dst_type

参数

dst_type (type or string):所需的类型

返回值

Module: self

MinkowskiPoolingTranspose

class MinkowskiEngine.MinkowskiPoolingTranspose(kernel_size, stride, dilation=1, kernel_generator=None, expand_coordinates=False, dimension=None)

用于稀疏张量的池化转置层。

对特征进行反池化,并将其除以贡献的非零元素的数量。

__init__(kernel_size, stride, dilation=1, kernel_generator=None, expand_coordinates=False, dimension=None)

用于稀疏张量的高维反池化层。

Args

kernel_size (int, optional): 输出张量中内核的大小。如果未提供,则 region_offset 应该为 RegionType.CUSTOM 并且 region_offset 应该是一个大小为 \(N\times D\) 的 2D 矩阵,这样它列出了 D 维中的所有 \(N\) 偏移量。

stride (int, or list, optional): 卷积层的步长大小。 如果使用非恒等变换,则输出坐标将至少远离 stride \(\times\) tensor_stride。 当给出列表时,长度必须为 D; 每个元素将用于特定轴的步长大小。

dilation (int, or list, optional): 卷积内核的扩张大小。 当给出列表时,长度必须为 D,并且每个元素都是轴特定的扩张。 所有元素必须 > 0。

kernel_generator (MinkowskiEngine.KernelGenerator, optional): 定义自定义内核形状。

expand_coordinates (bool, optional): 强制生成新坐标。当为 True 时,输出坐标将是内核形状和输入坐标的外积。默认为 False

dimension (int): 定义所有输入和网络的空间的空间维度。 例如,图像位于 2D 空间中,网格和 3D 形状位于 3D 空间中。

cpu() → T

将所有模型参数和缓冲区移动到 CPU。

返回值

Module: self

cuda(device: Optional[Union[int, torch.device]] = None) → T

将所有模型参数和缓冲区移动到 GPU。

这也使得相关的参数和缓冲区成为不同的对象。 因此,如果在优化时模块将位于 GPU 上,则应在构建优化器之前调用它。

参数
device (int, optional): 如果指定,所有参数都将

复制到该设备

返回值

Module: self

double() → T

将所有浮点参数和缓冲区转换为 double 数据类型。

返回值

Module: self

float() → T

将所有浮点参数和缓冲区转换为 float 数据类型。

返回值

Module: self

forward(input: MinkowskiSparseTensor.SparseTensor, coordinates: Optional[Union[torch.IntTensor, MinkowskiEngineBackend._C.CoordinateMapKey, MinkowskiSparseTensor.SparseTensor]] = None)

input (MinkowskiEngine.SparseTensor): 要在其上应用卷积的输入稀疏张量。

coordinates ((torch.IntTensor, MinkowskiEngine.CoordsKey, MinkowskiEngine.SparseTensor), optional): 如果提供,则在提供的坐标上生成结果。 默认为 None。

to(*args, **kwargs)

移动和/或转换参数和缓冲区。

可以调用为

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。 此外,此方法只会将浮点参数和缓冲区转换为 dtype(如果给出)。 如果给出了 device,则整数参数和缓冲区将以不变的 dtype 移动 device。 设置 non_blocking 时,如果可能,它会尝试相对于主机异步转换/移动,例如,将具有固定内存的 CPU 张量移动到 CUDA 设备。

有关示例,请参见下文。

注意

此方法就地修改模块。

Args
device (torch.device): 此模块中参数所需的设备

和缓冲区

dtype (torch.dtype):此模块中浮点参数和缓冲区的所需浮点类型

此模块中浮点参数和缓冲区的所需浮点类型

tensor (torch.Tensor):Tensor,其 dtype 和 device 是此模块中所有参数和缓冲区的所需 dtype 和 device

dtype 和 device 是此模块中所有参数和缓冲区的所需 dtype 和 device

memory_format (torch.memory_format):此模块中 4D 参数和缓冲区的所需内存格式(仅关键字参数)

format for 4D parameters and buffers in this module (keyword only argument)

返回值

Module: self

示例

>>> 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

将所有参数和缓冲区转换为 dst_type

参数

dst_type (type or string):所需的类型

返回值

Module: self

MinkowskiGlobalMaxPooling

class MinkowskiEngine.MinkowskiGlobalMaxPooling(mode=<PoolingMode.GLOBAL_MAX_POOLING_PYTORCH_INDEX: 11>)

将所有输入特征最大池化到一个原点的输出特征。

\[\mathbf{y} = \max_{\mathbf{i} \in \mathcal{C}^\text{in}} \mathbf{x}_{\mathbf{i}}\]
__init__(mode=<PoolingMode.GLOBAL_MAX_POOLING_PYTORCH_INDEX: 11>)

将稀疏坐标减少为原点的点,即,将每个点云减少为原点的一个点,返回 batch_size 个点 [[0, 0, …, 0], [0, 0, …, 1],, [0, 0, …, 2]],其中坐标的最后一个元素是批次索引。

cpu() → T

将所有模型参数和缓冲区移动到 CPU。

返回值

Module: self

cuda(device: Optional[Union[int, torch.device]] = None) → T

将所有模型参数和缓冲区移动到 GPU。

这也使得相关的参数和缓冲区成为不同的对象。 因此,如果在优化时模块将位于 GPU 上,则应在构建优化器之前调用它。

参数
device (int, optional): 如果指定,所有参数都将

复制到该设备

返回值

Module: self

double() → T

将所有浮点参数和缓冲区转换为 double 数据类型。

返回值

Module: self

float() → T

将所有浮点参数和缓冲区转换为 float 数据类型。

返回值

Module: self

forward(input, coordinates: Optional[Union[torch.IntTensor, MinkowskiEngineBackend._C.CoordinateMapKey, MinkowskiSparseTensor.SparseTensor]] = None)

定义每次调用时执行的计算。

应该被所有子类重写。

注意

尽管 forward 过程的配方需要在该函数中定义,但应该在此之后调用 Module 实例,而不是直接调用此函数,因为前者会处理已注册的钩子,而后者会默默地忽略它们。

to(*args, **kwargs)

移动和/或转换参数和缓冲区。

可以调用为

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。 此外,此方法只会将浮点参数和缓冲区转换为 dtype(如果给出)。 如果给出了 device,则整数参数和缓冲区将以不变的 dtype 移动 device。 设置 non_blocking 时,如果可能,它会尝试相对于主机异步转换/移动,例如,将具有固定内存的 CPU 张量移动到 CUDA 设备。

有关示例,请参见下文。

注意

此方法就地修改模块。

Args
device (torch.device): 此模块中参数所需的设备

和缓冲区

dtype (torch.dtype):此模块中浮点参数和缓冲区的所需浮点类型

此模块中浮点参数和缓冲区的所需浮点类型

tensor (torch.Tensor):Tensor,其 dtype 和 device 是此模块中所有参数和缓冲区的所需 dtype 和 device

dtype 和 device 是此模块中所有参数和缓冲区的所需 dtype 和 device

memory_format (torch.memory_format):此模块中 4D 参数和缓冲区的所需内存格式(仅关键字参数)

format for 4D parameters and buffers in this module (keyword only argument)

返回值

Module: self

示例

>>> 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

将所有参数和缓冲区转换为 dst_type

参数

dst_type (type or string):所需的类型

返回值

Module: self

MinkowskiGlobalAvgPooling

class MinkowskiEngine.MinkowskiGlobalAvgPooling(mode=<PoolingMode.GLOBAL_AVG_POOLING_PYTORCH_INDEX: 10>)
__init__(mode=<PoolingMode.GLOBAL_AVG_POOLING_PYTORCH_INDEX: 10>)

将稀疏坐标减少为原点的点,即,将每个点云减少为原点的一个点,返回 batch_size 个点 [[0, 0, …, 0], [0, 0, …, 1],, [0, 0, …, 2]],其中坐标的最后一个元素是批次索引。

cpu() → T

将所有模型参数和缓冲区移动到 CPU。

返回值

Module: self

cuda(device: Optional[Union[int, torch.device]] = None) → T

将所有模型参数和缓冲区移动到 GPU。

这也使得相关的参数和缓冲区成为不同的对象。 因此,如果在优化时模块将位于 GPU 上,则应在构建优化器之前调用它。

参数
device (int, optional): 如果指定,所有参数都将

复制到该设备

返回值

Module: self

double() → T

将所有浮点参数和缓冲区转换为 double 数据类型。

返回值

Module: self

float() → T

将所有浮点参数和缓冲区转换为 float 数据类型。

返回值

Module: self

forward(input: MinkowskiSparseTensor.SparseTensor, coordinates: Optional[Union[torch.IntTensor, MinkowskiEngineBackend._C.CoordinateMapKey, MinkowskiSparseTensor.SparseTensor]] = None)

定义每次调用时执行的计算。

应该被所有子类重写。

注意

尽管 forward 过程的配方需要在该函数中定义,但应该在此之后调用 Module 实例,而不是直接调用此函数,因为前者会处理已注册的钩子,而后者会默默地忽略它们。

to(*args, **kwargs)

移动和/或转换参数和缓冲区。

可以调用为

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。 此外,此方法只会将浮点参数和缓冲区转换为 dtype(如果给出)。 如果给出了 device,则整数参数和缓冲区将以不变的 dtype 移动 device。 设置 non_blocking 时,如果可能,它会尝试相对于主机异步转换/移动,例如,将具有固定内存的 CPU 张量移动到 CUDA 设备。

有关示例,请参见下文。

注意

此方法就地修改模块。

Args
device (torch.device): 此模块中参数所需的设备

和缓冲区

dtype (torch.dtype):此模块中浮点参数和缓冲区的所需浮点类型

此模块中浮点参数和缓冲区的所需浮点类型

tensor (torch.Tensor):Tensor,其 dtype 和 device 是此模块中所有参数和缓冲区的所需 dtype 和 device

dtype 和 device 是此模块中所有参数和缓冲区的所需 dtype 和 device

memory_format (torch.memory_format):此模块中 4D 参数和缓冲区的所需内存格式(仅关键字参数)

format for 4D parameters and buffers in this module (keyword only argument)

返回值

Module: self

示例

>>> 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

将所有参数和缓冲区转换为 dst_type

参数

dst_type (type or string):所需的类型

返回值

Module: self

MinkowskiGlobalSumPooling

class MinkowskiEngine.MinkowskiGlobalSumPooling(mode=<PoolingMode.GLOBAL_SUM_POOLING_PYTORCH_INDEX: 9>)
__init__(mode=<PoolingMode.GLOBAL_SUM_POOLING_PYTORCH_INDEX: 9>)

将稀疏坐标减少为原点的点,即,将每个点云减少为原点的一个点,返回 batch_size 个点 [[0, 0, …, 0], [0, 0, …, 1],, [0, 0, …, 2]],其中坐标的最后一个元素是批次索引。

cpu() → T

将所有模型参数和缓冲区移动到 CPU。

返回值

Module: self

cuda(device: Optional[Union[int, torch.device]] = None) → T

将所有模型参数和缓冲区移动到 GPU。

这也使得相关的参数和缓冲区成为不同的对象。 因此,如果在优化时模块将位于 GPU 上,则应在构建优化器之前调用它。

参数
device (int, optional): 如果指定,所有参数都将

复制到该设备

返回值

Module: self

double() → T

将所有浮点参数和缓冲区转换为 double 数据类型。

返回值

Module: self

float() → T

将所有浮点参数和缓冲区转换为 float 数据类型。

返回值

Module: self

forward(input: MinkowskiSparseTensor.SparseTensor, coordinates: Optional[Union[torch.IntTensor, MinkowskiEngineBackend._C.CoordinateMapKey, MinkowskiSparseTensor.SparseTensor]] = None)

定义每次调用时执行的计算。

应该被所有子类重写。

注意

尽管 forward 过程的配方需要在该函数中定义,但应该在此之后调用 Module 实例,而不是直接调用此函数,因为前者会处理已注册的钩子,而后者会默默地忽略它们。

to(*args, **kwargs)

移动和/或转换参数和缓冲区。

可以调用为

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。 此外,此方法只会将浮点参数和缓冲区转换为 dtype(如果给出)。 如果给出了 device,则整数参数和缓冲区将以不变的 dtype 移动 device。 设置 non_blocking 时,如果可能,它会尝试相对于主机异步转换/移动,例如,将具有固定内存的 CPU 张量移动到 CUDA 设备。

有关示例,请参见下文。

注意

此方法就地修改模块。

Args
device (torch.device): 此模块中参数所需的设备

和缓冲区

dtype (torch.dtype):此模块中浮点参数和缓冲区的所需浮点类型

此模块中浮点参数和缓冲区的所需浮点类型

tensor (torch.Tensor):Tensor,其 dtype 和 device 是此模块中所有参数和缓冲区的所需 dtype 和 device

dtype 和 device 是此模块中所有参数和缓冲区的所需 dtype 和 device

memory_format (torch.memory_format):此模块中 4D 参数和缓冲区的所需内存格式(仅关键字参数)

format for 4D parameters and buffers in this module (keyword only argument)

返回值

Module: self

示例

>>> 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

将所有参数和缓冲区转换为 dst_type

参数

dst_type (type or string):所需的类型

返回值

Module: self