Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: module 'torch.sparse' has no attribute 'torch' #17

Open
jinserk opened this issue Mar 7, 2018 · 1 comment
Open

AttributeError: module 'torch.sparse' has no attribute 'torch' #17

jinserk opened this issue Mar 7, 2018 · 1 comment

Comments

@jinserk
Copy link

jinserk commented Mar 7, 2018

I'm using pytorch 0.4.0a0+792daeb and met the following attribute error:

Traceback (most recent call last):
  File "capsule_network.py", line 267, in <module>
    engine.train(processor, get_iterator(True), maxepoch=NUM_EPOCHS, optimizer=optimizer)
  File "/home/jbaik/.pyenv/versions/3.6.4/lib/python3.6/site-packages/torchnet-0.0.1-py3.6.egg/torchnet/engine/engine.py", line 39, in train
  File "/home/jbaik/.pyenv/versions/3.6.4/lib/python3.6/site-packages/torch/optim/adam.py", line 53, in step
    loss = closure()
  File "/home/jbaik/.pyenv/versions/3.6.4/lib/python3.6/site-packages/torchnet-0.0.1-py3.6.egg/torchnet/engine/engine.py", line 28, in closure
  File "capsule_network.py", line 190, in processor
    labels = torch.sparse.torch.eye(NUM_CLASSES).index_select(dim=0, index=labels)
AttributeError: module 'torch.sparse' has no attribute 'torch'

I guess the torch.sparse.torch might be removed recently, so what I have to do for a workaround?

@jinserk
Copy link
Author

jinserk commented Mar 7, 2018

I replaced torch.sparse.torch.eye to torch.eye and it seems to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant