csyanbin / TPN-pytorch

Pytorch Code for ICLR19 paper: Learning to Propagate Labels: Transductive Propagation Network for Few-shot Learning.
175 stars 29 forks source link

view size is not compatible with input tensor's size #6

Closed MichalisLazarou closed 3 years ago

MichalisLazarou commented 4 years ago

when I run the code I get the following error:

Traceback (most recent call last): File "train.py", line 280, in <module> main() File "train.py", line 210, in main loss, acc = model(inputs) File "/home/michalislazarou/anaconda3/envs/metal/lib/python3.7/site-packages/torch/nn/modules/module.py", line 550, in __call__ result = self.forward(*input, **kwargs) File "/home/michalislazarou/PhD/TPN-torch/models.py", line 170, in forward emb_all = self.encoder(inp).view(-1,1600) RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.

bozhenhhu commented 3 years ago

I use .reshape(...), and it is fixed