Skip to content

Migration Guide from v0.4.x to 0.5.x

Chris Choy edited this page Aug 2, 2020 · 16 revisions

Sparse Tensor

Input Keywords

Abbreviated keywords to complete keywords.

import MinkowskiEngine as ME

...

# v0.4.x
sinput = ME.SparseTensor(feats, coords=coords)
manager = sinput.coords_man
key = sinput.coords_key
# v0.5.x
sinput = ME.SparseTensor(feats, coordinates=coords)
manager = sinput.coordinate_manager
key = sinput.coordinate_map_key

CUDA acceleration

In v0.4, the CUDA acceleration was supported for matrix multiplication (convolution), but from v0.5.0a, we provide CUDA backends for kernel map generation. However, to use the CUDA acceleration, you must provide coordinates as a CUDA tensor.

# v0.4.x
sinput = ME.SparseTensor(feats, coords=coords).to(0)
# v0.5.x
# sinput = ME.SparseTensor(feats, coordinates=coords).to(0) # throws an error. Not supported to prevent unnecessary CPU/GPU coordinate map construction
sinput = ME.SparseTensor(feats.to(0), coordinates=coords.to(0))
sinput = ME.SparseTensor(feats, coordinates=coords, device=0)
sinput = ME.SparseTensor(feats, coordinates=coords, device=feats.device)

force creation, allow duplicate coords

From v0.5, a new sparse tensor with the same tensor stride, will automatically be created without force_creation=True argument. Instead, a coordinate map key is a pair of tensor stride and a random string, which will be automatically populated to create a new coordinate map.

Similarly, allow duplicates are no longer required since the duplicates will be automatically resolved using quantization_mode.

# v0.4
sinput = ME.SparseTensor(feats, coords=coordinates)
sinput2 = ME.SparseTensor(new_feats, coords=new_coordinates, force_create=True, coords_man=sinput.coordinate_manager)
# v0.5
sinput = ME.SparseTensor(feats, coordinates=coordinates)
sinput2 = ME.SparseTensor(new_feats, coordinates=new_coordinates, coordinate_manager=sinput.coordinate_manager)

Convolution / ConvolutionTranspose

Keywords

Use the standard pytorch keywords.

# v0.4.x
conv = ME.MinkowskiConvolution(,... has_bias=False)
# v0.5.x
conv = ME.MinkowskiConvolution(,... bias=False)