Closed duygusar closed 6 years ago
I cast the type with image = image.astype(float) -since it is a numpy array- but this time I get RuntimeError: Expected object of type torch.FloatTensor but found type torch.DoubleTensor for argument #4 'mat1
I have casted explicitly to float64 (so that it is certainly not a double) and that solves that error but now I get a mismatch error. The network was working just fine with MNIST so I believe it is indeed a problem in my custom dataloader. Or could it be an inherent problem since this repository is using MNIST and is customized to handle a similar kind of data?
File "main.py", line 40, in main trainer.train() File "/home/duygu/recurrent-visual-attention-master/trainer.py", line 168, in train train_loss, train_acc = self.train_one_epoch(epoch) File "/home/duygu/recurrent-visual-attention-master/trainer.py", line 252, in train_one_epoch h_t, l_t, b_t, p = self.model(x, l_t, h_t) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 491, in call result = self.forward(*input, kwargs) File "/home/duygu/recurrent-visual-attention-master/model.py", line 101, in forward g_t = self.sensor(x, l_t_prev) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 491, in call result = self.forward(*input, *kwargs) File "/home/duygu/recurrent-visual-attention-master/modules.py", line 214, in forward phi_out = F.relu(self.fc1(phi)) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 491, in call 307440 1 result = self.forward(input, kwargs) File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/linear.py", line 55, in forward return F.linear(input, self.weight, self.bias) File "/usr/local/lib/python3.5/dist-packages/torch/nn/functional.py", line 992, in linear return torch.addmm(bias, input, weight.t()) RuntimeError: size mismatch, m1: [32 x 192], m2: [64 x 128] at /pytorch/aten/src/TH/generic/THTensorMath.c:2033
Hello I want to use recurrent visual attention with my own dataset so I have a custom dataloader which looks like below. I have run the code with MNIST without any trouble but with my own dataset I am facing issues.
Other main change I have made is closing off the parameter intake for validation size and shuffling (as I am using a pre-existing train, validation and test split and I have already shuffled these splits)
And my last change is,while iterating at trainer.py train_one_epoch(self, epoch) function. I have changed this part because formerly the x,y was being returned as strings of "image" and "labels" - headers of the pyton dictionary rather than the values in batches.
But now I get issues that I can not figure out:
Without the GPU, I get this error:
Also is there any modifications that we can do to use GPU (frankly, I have chosen this implementation thinking GPU is supported so I am a little discouraged with other comments saying it is not)? I could potentially try it out. But of course, most crucial part is that I have a running example and to ensure I am not doing anything wrong (kind of difficult to track as I am new to pytorch).
Thanks.