Open
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
What precision used in the convolution? How can I improve the accuracy?
from torchsparse import SparseTensor
from torchsparse import nn as spnn
import torch
from torchsparse.nn import functional as F
conv_config = F.conv_config.get_default_conv_config()
conv_config.kmap_mode = "hashmap"
F.conv_config.set_global_conv_config(conv_config)
torch.manual_seed(0)
p = torch.zeros((10, 4))
p[:,1:] = torch.randint(0, 100, (10, 3))
c = torch.rand((10, 3))*2**9
sp = SparseTensor(feats=c.float(), coords=p.int()).cuda()
conv = spnn.Conv3d(3, 3, (1, 1, 2), stride=(1, 1, 2)).cuda()
a = torch.cat((torch.eye(3), torch.zeros((3, 3))), 1)
b = torch.cat((torch.zeros((3, 3)), torch.eye(3)), 1)
conv.kernel.data = torch.cat((a[None, ...], b[None, ...]), 0).float().cuda()
print(sp.F)
print(conv.kernel.data)
print(conv(sp).F)
tensor([[156.2112, 477.1842, 90.0660],
[138.1548, 77.1480, 16.2404],
[106.5624, 476.0571, 370.2319],
[380.0762, 269.4634, 124.7530],
[299.3113, 16.9742, 71.0230],
[124.0243, 417.5201, 406.0982],
[142.4653, 246.7629, 419.7275],
[510.4981, 357.6018, 290.5838],
[427.6445, 105.2666, 303.7041],
[ 57.5218, 78.5699, 123.7546]], device='cuda:0')
tensor([[[1., 0., 0., 0., 0., 0.],
[0., 1., 0., 0., 0., 0.],
[0., 0., 1., 0., 0., 0.]],
[[0., 0., 0., 1., 0., 0.],
[0., 0., 0., 0., 1., 0.],
[0., 0., 0., 0., 0., 1.]]], device='cuda:0')
tensor([[510.2500, 357.5000, 290.5000, 0.0000, 0.0000, 0.0000],
[ 0.0000, 0.0000, 0.0000, 427.5000, 105.2500, 303.5000],
[ 0.0000, 0.0000, 0.0000, 106.5000, 476.0000, 370.0000],
[ 0.0000, 0.0000, 0.0000, 156.1250, 477.0000, 90.0625],
[299.2500, 16.9688, 71.0000, 0.0000, 0.0000, 0.0000],
[ 0.0000, 0.0000, 0.0000, 138.1250, 77.1250, 16.2344],
[ 57.5000, 78.5625, 123.7500, 0.0000, 0.0000, 0.0000],
[124.0000, 417.5000, 406.0000, 0.0000, 0.0000, 0.0000],
[380.0000, 269.2500, 124.7500, 0.0000, 0.0000, 0.0000],
[142.3750, 246.7500, 419.5000, 0.0000, 0.0000, 0.0000]],
device='cuda:0', grad_fn=<ImplicitGEMMConvolutionFuntionBackward>)
Expected Behavior
The value in out should same as the input except 0.00, e.g., the first row should be:
[510.4981, 357.6018, 290.5838, 0.0000, 0.0000, 0.0000]
Environment
- GCC: Ubuntu 7.5.0-6ubuntu2
- NVCC: 11.6
- PyTorch: '1.13.1'
- PyTorch CUDA: cuda-11.6 & Nivida 4090
- TorchSparse:Version: 2.1.0
Anything else?
No response
Metadata
Metadata
Assignees
Labels
No labels