mit-han-lab / torchsparse

[MICRO'23, MLSys'22] TorchSparse: Efficient Training and Inference Framework for Sparse Convolution on GPUs.

Home Page:https://torchsparse.mit.edu

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to modify tensor for U-Net decoder?

poodarchu opened this issue · comments

commented

I build a sparse U-Net (without skip connection) for 3d point cloud segmentation.

Suppose the input is of shape 16000x3, the output of encoder is 1000x3. I want to check the individual value of the encoder output.

enc_out:
feats: 1000x128
coords: 1000x4 (B, X, Y, Z)
spatial_range: (64x64x8)

Here I want to create a new SparseTensor with
new_out:
feats: enc_out.feats[10:11, :],
coords: enc_out.coords[10:11, ]
spatial_range: enc_out.spatial_range
stride: enc_out.stride.

But it fails when I try to pass the new_out to U-net decoder.

File "/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/lib/python3.8/site-packages/torch/nn/modules/container.py", line 217, in forward
input = module(input)
File "/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/torchsparse/torchsparse/nn/modules/conv.py", line 98, in forward
return F.conv3d(
File "/torchsparse/torchsparse/nn/functional/conv/conv.py", line 138, in conv3d
kmap = F.transpose_kernel_map(
File "/torchsparse/torchsparse/nn/functional/conv/kmap/build_kmap.py", line 233, in transpose_kernel_map
kmap["out_in_map"], make_divisible(kmap["sizes"][0], cta_M)
TypeError: 'NoneType' object is not subscriptable

How should I adjust the values in cmap, kmap and hashmaps to achieve my goal?