torchsparse icon indicating copy to clipboard operation
torchsparse copied to clipboard

[BUG] Voxelization results differ significantly between the CPU and CUDA implementation

Open alexanderswerdlow opened this issue 3 years ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

Using spvoxelize with CUDA tensors results in voxel features greater than the largest value in the input (thus it cannot be the correct result since it is an average). Switching to the CPU implementation produces the correct result.

E.g. the following does not work:

inserted_feat = torchsparse.nn.functional.spvoxelize(feats.float(), idx_query, counts)

However, this does work:

inserted_feat = torchsparse.nn.functional.spvoxelize(feats.float().to('cpu'), idx_query.to('cpu'), counts.to('cpu'))

Expected Behavior

Assuming the counts variable is computed correctly, the resulting voxel values should be averages and thus less than the maximum value in feats.

Environment

- GCC: gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
- NVCC: Cuda compilation tools, release 11.3, V11.3.109
- PyTorch: 1.11.0+cu113
- PyTorch CUDA: 11.3
- TorchSparse: 1.4.0 (Built from commit: 67c90d1)

alexanderswerdlow avatar May 10 '22 23:05 alexanderswerdlow

@alexanderswerdlow, thank you for reporting this issue! Could you please provide a short code snippet to reproduce this bug? Thanks!

zhijian-liu avatar May 23 '22 04:05 zhijian-liu

Since TorchSparse has been upgraded to v2.1.0, could you please attempt to install the latest version? I will now close this issue, but please don't hesitate to reopen it if the problem persists.

zhijian-liu avatar Jul 15 '23 01:07 zhijian-liu