facebookresearch / SparseConvNet

Submanifold sparse convolutional networks
https://github.com/facebookresearch/SparseConvNet
Other
2.05k stars 333 forks source link

AttributeError: 'int' object has no attribute 'item' #35

Closed fengxiuyaun closed 6 years ago

fengxiuyaun commented 6 years ago

hi, when i run hello_world.py, I got a error: File "/home/XXX/software/anaconda2/envs/pytorch_py3/lib/python3.6/site-packages/sparseconvnet-0.1.1-py3.6.egg/sparseconvnet/submanifoldConvolution.py", line 22, in init self.filter_volume = self.filter_size.prod().item() AttributeError: 'int' object has no attribute 'item' How can I deal with. Thanks

btgraham commented 6 years ago

Are you using PyTorch master? (https://github.com/facebookresearch/SparseConvNet#pytorch-setup) SparseConvNet had to be upgraded recently to be compatible with the latest PyTorch changes. If you are on master, the following code should work:

import sparseconvnet as scn
scn.SubmanifoldConvolution(3,4,4,3,False).filter_size.prod().item()

If you are already on master, please give a minimal example of code that fails.

fengxiuyaun commented 6 years ago

Thanks! I sloved it. thank you.

fengxiuyaun commented 6 years ago

hi, Could you share me example of Kaggle Diabetic Retinopathy Detection, 2015? thanks

AutumnWormSun commented 6 years ago

@fengxiuyaun I encountered the same problem! Environment: Python 3.6, Pytorch 0.31, SparseConvNet 0.11

Error: self.filter_volume = self.filter_size.prod().item() AttributeError: 'int' object has no attribute 'item'

Code: import sparseconvnet as scn scn.SubmanifoldConvolution(3,4,4,3,False).filter_size.prod().item()

@btgraham Example and demo you showed both throw exception. There must be some bugs.

btgraham commented 6 years ago

@AutumnWormSun Please use PyTorch master: https://github.com/facebookresearch/SparseConvNet#pytorch-setup

btgraham commented 6 years ago

@fengxiuyaun The Diabetes example is described here https://www.kaggle.com/c/diabetic-retinopathy-detection/discussion/15801 I am not going to import it into this repo as it is not recent research. Regards Ben

AutumnWormSun commented 6 years ago

@btgraham Thanks! I will try.