kentsommer / pytorch-value-iteration-networks

Pytorch implementation of Value Iteration Networks (NIPS 2016 best paper)
BSD 3-Clause "New" or "Revised" License
318 stars 62 forks source link

Inconsistent tensor sizes when starting training #2

Closed juancprzs closed 7 years ago

juancprzs commented 7 years ago

Hey there. I'm trying to run

python train.py --datafile dataset/gridworld_8x8.npz --imsize 8 --lr 0.005 --epochs 30 --k 10 --batch_size 128

But I get the following error

Number of Train Samples: 103926
Number of Test Samples: 17434
     Epoch | Train Loss | Train Error | Epoch Time
Traceback (most recent call last):
  File "train.py", line 147, in <module>
    train(net, trainloader, config, criterion, optimizer, use_GPU)
  File "train.py", line 40, in train
    outputs, predictions = net(X, S1, S2, config)
  File "/home/j1k1000o/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 224, in __call__
    result = self.forward(*input, **kwargs)
  File "/media/user_home2/j1k1000o/j1k/VINs/pytorch-value-iteration-networks/model.py", line 44, in forward
    q = F.conv2d(torch.cat([r, v], 1), 
  File "/home/j1k1000o/anaconda3/lib/python3.6/site-packages/torch/autograd/variable.py", line 897, in cat
    return Concat.apply(dim, *iterable)
  File "/home/j1k1000o/anaconda3/lib/python3.6/site-packages/torch/autograd/_functions/tensor.py", line 317, in forward
    return torch.cat(inputs, dim)
RuntimeError: inconsistent tensor sizes at /opt/conda/conda-bld/pytorch_1502009910772/work/torch/lib/THC/generic/THCTensorMath.cu:141

I've executed

./download_weights_and_datasets.sh

as well as

python ./dataset/make_training_data.py

And I'm running it on an Ubuntu 16.04, python 3.6 and with all the requirements installed.

Can you help me out?

kentsommer commented 7 years ago

Hi @j1k1000o

Please see 47dd60d243748268a88155b37b2e0d8f9769facd which fixes this issue.

Please pull and try again!

juancprzs commented 7 years ago

Thanks!!