NVIDIA / MinkowskiEngine

Minkowski Engine is an auto-diff neural network library for high-dimensional sparse tensors
https://nvidia.github.io/MinkowskiEngine
Other
2.43k stars 360 forks source link

the shapes of tensor before to_sparse() and dense() are sometimes not the same #559

Open wulipc opened 1 year ago

wulipc commented 1 year ago

Describe the bug

I found the shapes of tensor before to_sparse() and dense() are sometimes not the same, and I saved a bug data, named x.npy, for easy reproduction.

Any information will be appreciated.


To Reproduce

import torch
import numpy as np
import MinkowskiEngine as ME

dense_tensor = np.load("x.npy")
dense_tensor = torch.from_numpy(dense_tensor)
print("before shape", dense_tensor.shape)

# to_sparse -> dense
sparse_tensor = ME.to_sparse(dense_tensor)
print("after shape", sparse_tensor.dense()[0].shape)

Input

Please download x.npy from here: https://drive.google.com/file/d/1NKxBB4z7IpY8CmNEmRxG9y65V0GYez-q/view?usp=sharing

Output before shape torch.Size([1, 128, 56, 56]) after shape torch.Size([1, 128, 48, 56])


Expected behavior The shapes of tensor before to_sparse() and dense() should be the same at all times.


ENV

==========System========== Linux-4.19.91-009.ali4000.alios7.x86_64-x86_64-with-glibc2.31 DISTRIB_ID=Ubuntu DISTRIB_RELEASE=20.04 DISTRIB_CODENAME=focal DISTRIB_DESCRIPTION="Ubuntu 20.04.5 LTS" 3.9.15 (main, Nov 24 2022, 14:31:59) [GCC 11.2.0] ==========Pytorch========== 1.12.1+cu113 torch.cuda.is_available(): True ==========NVIDIA-SMI========== /usr/bin/nvidia-smi Driver Version 470.182.03 CUDA Version 11.4 VBIOS Version 88.00.80.00.01 Image Version G503.0203.00.05 GSP Firmware Version N/A ==========NVCC========== /usr/local/cuda/bin/nvcc nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2021 NVIDIA Corporation Built on Mon_May__3_19:15:13_PDT_2021 Cuda compilation tools, release 11.3, V11.3.109 Build cuda_11.3.r11.3/compiler.29920130_0 ==========CC========== /usr/bin/c++ c++ (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0 Copyright (C) 2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

==========MinkowskiEngine========== 0.5.4 MinkowskiEngine compiled with CUDA Support: True NVCC version MinkowskiEngine is compiled: 11030 CUDART version MinkowskiEngine is compiled: 11030


Additional context Add any other context about the problem here.