From 69c1034ddb285798619380537802ea0ff03aeba6 Mon Sep 17 00:00:00 2001 From: Chia-Lun Hsu Date: Fri, 29 Jul 2022 23:29:22 +0800 Subject: [PATCH] Fix integer division error (#163) --- torchsparse/nn/functional/downsample.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/torchsparse/nn/functional/downsample.py b/torchsparse/nn/functional/downsample.py index 500f285..75347cf 100644 --- a/torchsparse/nn/functional/downsample.py +++ b/torchsparse/nn/functional/downsample.py @@ -24,8 +24,9 @@ def spdownsample( if all(stride[k] in [1, kernel_size[k]] for k in range(3)): coords = coords.clone() - coords[:, :3] = torch.div(coords[:, :3], - sample_stride).trunc() * sample_stride + coords[:, :3] = torch.div( + coords[:, :3], + sample_stride.float()).trunc() * sample_stride # type: ignore else: offsets = get_kernel_offsets(kernel_size, tensor_stride,