adambielski / CapsNet-pytorch

PyTorch implementation of NIPS 2017 paper Dynamic Routing Between Capsules
BSD 3-Clause "New" or "Revised" License
489 stars 73 forks source link

Error using with_reconstruction flag #4

Closed w4zir closed 6 years ago

w4zir commented 6 years ago

When using reconstruction flag, I get the following error:

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) 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 "net.py", line 274, in train(epoch) File "net.py", line 230, in train output, probs = model(data, target) File "/home/khan/anaconda3/envs/kt/lib/python3.6/site-packages/torch/nn/modules/module.py", line 325, in call result = self.forward(*input, *kwargs) File "net.py", line 137, in forward reconstruction = self.reconstruction_net(x, target) File "/home/khan/anaconda3/envs/kt/lib/python3.6/site-packages/torch/nn/modules/module.py", line 325, in call result = self.forward(input, **kwargs) File "net.py", line 119, in forward mask.scatter(1, target.data.view(-1, 1), 1.) RuntimeError: scatter() received an invalid combination of arguments - got (int, torch.cuda.LongTensor, float), but expected one of:

adambielski commented 6 years ago

What's the PyTorch version that you're using? If you're using the 0.3.0 that was just released there might be some incompatibility, try downgrading to 0.2.0

w4zir commented 6 years ago

Yes, I am using pytorch 0.3.0 since I have cuda9 installed. 0.2.0 had some issues with cuda9. Can you guide me on how can I resolve the incompatibility. Would also help other users too.

adambielski commented 6 years ago

Check this branch https://github.com/adambielski/CapsNet-pytorch/tree/pytorch-0.3.0 I haven't tested it on GPU yet, once I do, I'll merge it with master

w4zir commented 6 years ago

Works fine now. Thanks.