mit-han-lab / torchsparse

[MICRO'23, MLSys'22] TorchSparse: Efficient Training and Inference Framework for Sparse Convolution on GPUs.
https://torchsparse.mit.edu
MIT License
1.19k stars 138 forks source link

How to obtain shape information of a three-dimensional sparse tensor, similar to (32,32,32)? #261

Closed Shixiaomeng7 closed 9 months ago

Shixiaomeng7 commented 10 months ago

Is there an existing issue for this?

Current Behavior

I want to output the specific shapes of each dimension of sparse voxels, but use. spatial Shape and other commands always prompt 'SparseTensor' object has no attribute 'spatial Shape ', please help.

Expected Behavior

No response

Environment

- GCC:
- NVCC:
- PyTorch:
- PyTorch CUDA:
- TorchSparse:

Anything else?

No response

ys-2020 commented 10 months ago

Hi. I think that should be spatial_range instead of spatial_Shape. The definition of SparseTensor can be found here.

Shixiaomeng7 commented 10 months ago

Hi. I think that should be spatial_range instead of spatial_Shape. The definition of SparseTensor can be found here.

Thank you so much for your answer! But I think I found the problem, I found the spatial_range you mentioned in Torchsparse2.0.0 was passed in as an attribute to SparseTensor, but I am using version 1.4.0. Upon checking, it was found that the only attributes passed in to SparseTensor are coords and feats, so it should not be possible to view the specific shape. Anyway, thank you so much for your answer and help me solve the problem.