facebookresearch / SparseConvNet

Submanifold sparse convolutional networks
https://github.com/facebookresearch/SparseConvNet
Other
2.04k stars 332 forks source link

how to transfer batch of (B,C,H,W) to sparse tensor? DenseToSparse()? #221

Closed bobonpu1 closed 2 years ago

bobonpu1 commented 2 years ago

the data are in the form of (B,C,H,W). I would like to transfer it to the sparse tensor. If is it right to use DenseToSparse() directly?

btgraham commented 2 years ago

If the input is actually spatially-sparse (i.e. you have columns of C zeros in the input tensor) you can do that. Although depending on how the input is formed, it might be more efficient to use InputLayer (https://github.com/facebookresearch/SparseConvNet#hello-world)