MinkowskiEngine
MinkowskiEngine copied to clipboard
TensorField && SparseTensor
Hello!
It seems a bit confusing to me about the actual differences in between the TensorField and the SparseTensor, could someone help me with it?
Thanks!
Also I encounter the error when building sparse tensors, the quantization_mode can ONLY be set to RANDOM_SUBSAMPLE, or it will get an error:
pcd0_continuous = 10 * torch.rand((2048, 3), dtype=torch.float32)
pcd1_continuous = 10 * torch.rand((2048, 3), dtype=torch.float32)
feats0 = torch.rand((2048, 1), dtype=torch.float32)
feats1 = 2*torch.rand((2048, 1), dtype=torch.float32)
coords, feats = ME.utils.sparse_collate([pcd0_continuous, pcd1_continuous],
[feats0, feats1],
dtype=torch.float32,
)
TField = ME.TensorField(coordinates=coords,
features=feats,
device=torch.device('cuda'),
)
To reproduce the error, I run the following:
sp_tensor = TField.sparse()
Then I get:
File "/home/ghn/anaconda3/envs/fcgf/lib/python3.6/site-packages/MinkowskiEngine-0.5.2-py3.6-linux-x86_64.egg/MinkowskiEngine/sparse_matrix_functions.py", line 94, in spmm_average rows, cols, size[0], size[1], mat, cuda_spmm_alg RuntimeError: invalid argument at /home/ghn/MinkowskiEngine-0.5.2/src/spmm.cu:582
The error could be solved by explicitly setting to quantization_mode to RANDOM_SUBSAMPLE instead of UNWEIGHTED_AVERAGE:
TField.quantization_mode = ME.SparseTensorQuantizationMode.RANDOM_SUBSAMPLE
sp_tensor = TField.sparse()
Then it works fine.
Environment: OS: ubuntu 16.04 gcc: 7.3.0 cuda: 10.1 pytorch: 1.7.0 Mink: 0.5.2