MinkowskiInterpolation¶
MinkowskiInterpolation¶
-
class
MinkowskiEngine.
MinkowskiInterpolation
(return_kernel_map=False, return_weights=False)¶ Sample linearly interpolated features at the provided points.
-
__init__
(return_kernel_map=False, return_weights=False)¶ Sample linearly interpolated features at the specified coordinates.
- Args:
return_kernel_map
(bool): In addition to the sampled features, the layer returns the kernel map as a pair of input row indices and output row indices. False by default.return_weights
(bool): When True, return the linear interpolation weights. False by default.
-
cpu
() → T¶ Moves all model parameters and buffers to the CPU.
- Returns:
Module: self
-
cuda
(device: Optional[Union[int, torch.device]] = None) → T¶ Moves all model parameters and buffers to the GPU.
This also makes associated parameters and buffers different objects. So it should be called before constructing optimizer if the module will live on GPU while being optimized.
- Arguments:
- device (int, optional): if specified, all parameters will be
copied to that device
- Returns:
Module: self
-
double
() → T¶ Casts all floating point parameters and buffers to
double
datatype.- Returns:
Module: self
-
float
() → T¶ Casts all floating point parameters and buffers to float datatype.
- Returns:
Module: self
-
forward
(input: MinkowskiSparseTensor.SparseTensor, tfield: torch.Tensor)¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
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)¶
Its signature is similar to
torch.Tensor.to()
, but only accepts floating point desireddtype
s. In addition, this method will only cast the floating point parameters and buffers todtype
(if given). The integral parameters and buffers will be moveddevice
, if that is given, but with dtypes unchanged. Whennon_blocking
is set, it tries to convert/move asynchronously with respect to the host if possible, e.g., moving CPU Tensors with pinned memory to CUDA devices.See below for examples.
Note
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)
- device (
- 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
-