gram-ai / capsule-networks

A PyTorch implementation of the NIPS 2017 paper "Dynamic Routing Between Capsules".
https://arxiv.org/abs/1710.09829
1.73k stars 315 forks source link

RuntimeError on line 113 #13

Open MarkNo1 opened 6 years ago

MarkNo1 commented 6 years ago

Hi, first of all great work, then I found that the line 113 :

y = Variable(torch.sparse.torch.eye(NUM_CLASSES)).cuda().index_select(dim=0, index=max_length_indices.data)

produce: RuntimeError: index_select(): argument 'index' must be Variable, not torch.cuda.LongTensor

I resolve this issue removing the '.data' from the 'max_length_indices'.

Torch Version: 0.4.0a0+96ceb91

Regards

unsuthee commented 6 years ago

I have experienced the same runtime error. I want to confirm that the above workaround fixes the error.

I use pyTorch 0.3.1.post2