torchsparse icon indicating copy to clipboard operation
torchsparse copied to clipboard

[BUG] <RuntimeError: Tensors of type TensorImpl do not have sizes>

Open linzhenyuyuchen opened this issue 3 years ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior


Traceback (most recent call last):
  File "main.py", line 353, in <module>
    test_ckpt()
  File "main.py", line 305, in test_ckpt
    loss, scalar_outputs, outputs = test_sample(sample, save_scene)
  File "/home/codes/NeuralRecon/utils.py", line 24, in wrapper
    ret = func(*f_args, **f_kwargs)
  File "main.py", line 342, in test_sample
    outputs, loss_dict = model(sample, save_scene)
  File "/home/anaconda3/envs/neucon/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/anaconda3/envs/neucon/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 166, in forward
    return self.module(*inputs[0], **kwargs[0])
  File "/home/anaconda3/envs/neucon/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/codes/NeuralRecon/models/neuralrecon.py", line 82, in forward
    outputs, loss_dict = self.neucon_net(features, inputs, outputs)
  File "/home/anaconda3/envs/neucon/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/codes/NeuralRecon/models/neucon_network.py", line 158, in forward
    feat = self.sp_convs[i](point_feat)
  File "/home/anaconda3/envs/neucon/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/codes/NeuralRecon/models/modules.py", line 148, in forward
    x0 = initial_voxelize(z, self.pres, self.vres)
  File "/home/codes/NeuralRecon/ops/torchsparse_utils.py", line 19, in initial_voxelize
    pc_hash = F.sphash(torch.floor(new_float_coord).int())
  File "/home/anaconda3/envs/neucon/lib/python3.7/site-packages/torchsparse-1.4.0-py3.7-linux-x86_64.egg/torchsparse/nn/functional/hash.py", line 19, in sphash
    return torchsparse.backend.hash_cuda(coords)
RuntimeError: Tensors of type TensorImpl do not have sizes
Exception raised from sizes_custom at ../c10/core/TensorImpl.cpp:372 (most recent call first):
frame #0: c10::Error::Error(c10::SourceLocation, std::string) + 0x3e (0x7fb9abd691ee in /home/anaconda3/envs/neucon/lib/python3.7/site-packages/torch/lib/libc10.so)
frame #1: c10::detail::torchCheckFail(char const*, char const*, unsigned int, std::string const&) + 0x5c (0x7fb9abd445e8 in /home/anaconda3/envs/neucon/lib/python3.7/site-packages/torch/lib/libc10.so)
frame #2: c10::TensorImpl::sizes_custom() const + 0x75 (0x7fb9abd52185 in /home/anaconda3/envs/neucon/lib/python3.7/site-packages/torch/lib/libc10.so)
frame #3: at::TensorBase::size(long) const + 0x15 (0x7fb95f8c4f95 in /home/anaconda3/envs/neucon/lib/python3.7/site-packages/torchsparse-1.4.0-py3.7-linux-x86_64.egg/torchsparse/backend.cpython-37m-x86_64-linux-gnu.so)
frame #4: hash_cuda(at::Tensor) + 0x34 (0x7fb95f8c9014 in /home/anaconda3/envs/neucon/lib/python3.7/site-packages/torchsparse-1.4.0-py3.7-linux-x86_64.egg/torchsparse/backend.cpython-37m-x86_64-linux-gnu.so)
frame #5: <unknown function> + 0x1c97a (0x7fb95f8cf97a in /home/anaconda3/envs/neucon/lib/python3.7/site-packages/torchsparse-1.4.0-py3.7-linux-x86_64.egg/torchsparse/backend.cpython-37m-x86_64-linux-gnu.so)
frame #6: <unknown function> + 0x24c17 (0x7fb95f8d7c17 in /home/anaconda3/envs/neucon/lib/python3.7/site-packages/torchsparse-1.4.0-py3.7-linux-x86_64.egg/torchsparse/backend.cpython-37m-x86_64-linux-gnu.so)
<omitting python frames>


Expected Behavior

No response

Environment

- GCC: 7.5.0
- NVCC: 11.3
- PyTorch: 1.12.0+cu113
- PyTorch CUDA: 11.3
- TorchSparse: 1.4.0

Anything else?

The output of installation of torchsparse:

running install
/home/anaconda3/envs/neucon/lib/python3.7/site-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  setuptools.SetuptoolsDeprecationWarning,
/home/anaconda3/envs/neucon/lib/python3.7/site-packages/setuptools/command/easy_install.py:147: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  EasyInstallDeprecationWarning,
running bdist_egg
running egg_info
writing torchsparse.egg-info/PKG-INFO
writing dependency_links to torchsparse.egg-info/dependency_links.txt
writing top-level names to torchsparse.egg-info/top_level.txt
/home/anaconda3/envs/neucon/lib/python3.7/site-packages/torch/utils/cpp_extension.py:411: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
  warnings.warn(msg.format('we could not find ninja.'))
reading manifest file 'torchsparse.egg-info/SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'torchsparse.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
running build_ext
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/torchsparse


linzhenyuyuchen avatar Jul 22 '22 10:07 linzhenyuyuchen

torchsparse=1.4.0 is installed successfully with the warning above..

linzhenyuyuchen avatar Jul 22 '22 10:07 linzhenyuyuchen

Hi @Xiuyu-Li @zhijian-liu

This issue seems to be happening with torch>=1.12 Is there a fix for this ?

Would appreciate any help, thanks!

Best Regards Shivam

ShivamDuggal4 avatar Aug 19 '22 22:08 ShivamDuggal4

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