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

Deprecated #9

Open
raul1968 opened this issue Jul 20, 2019 · 2 comments
Open

Deprecated #9

raul1968 opened this issue Jul 20, 2019 · 2 comments

Comments

@raul1968
Copy link

/home/raul/Desktop/CapsNet-pytorch/net.py:28: UserWarning: Implicit dimension choice for softmax has been deprecated. Change the call to include dim=X as an argument.
c = F.softmax(self.b)
/home/raul/Desktop/CapsNet-pytorch/net.py:38: UserWarning: Implicit dimension choice for softmax has been deprecated. Change the call to include dim=X as an argument.
c = F.softmax(b_batch.view(-1, output_caps)).view(-1, input_caps, output_caps, 1)
Traceback (most recent call last):
File "/home/raul/Desktop/CapsNet-pytorch/net.py", line 275, in
train(epoch)
File "/home/raul/Desktop/CapsNet-pytorch/net.py", line 244, in train
100. * batch_idx / len(train_loader), loss.data[0]))
IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number

@luo3300612
Copy link

use loss.item() instead of loss.data[0]

@adambielski
Copy link
Owner

There were some breaking changes in newer PyTorch versions; I used version 0.3.0 when I was writing the code.

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

3 participants