Skip to content
This repository has been archived by the owner on Sep 27, 2020. It is now read-only.

using for custom dataset #1

Closed
KyonP opened this issue Dec 18, 2017 · 1 comment
Closed

using for custom dataset #1

KyonP opened this issue Dec 18, 2017 · 1 comment

Comments

@KyonP
Copy link

KyonP commented Dec 18, 2017

Hi, I'm trying to apply your code to a sequential image dataset.

However, whenever I tried to input concatenated images (Batch x Timeseries x Channels x Width x Height), it gives following error.



<ipython-input-40-c130ba752793> in forward(self, input, h, c)
     29         input = input.cuda()
     30 
---> 31         combined = torch.cat((input, h), dim=1)
     32 
     33         A = self.conv(combined)

TypeError: cat received an invalid combination of arguments - got (tuple, dim=int), but expected one of:
 * (sequence[torch.cuda.FloatTensor] seq)
 * (sequence[torch.cuda.FloatTensor] seq, int dim)
      didn't match because some of the arguments have invalid types: (tuple, dim=int)

It seems like something is wrong with .cuda() declaration.

So I looked into those two Variables input and h

input has torch.FloatTensor type,

h has torch.autograd.variable.Variable type.

From this article, those two Variables have to be changed to same data type.

My question is,

i) Have you undergone the same issue like this?

ii) I've tried to change the data type of h by h.cuda() didn't work. I'm not used to Pytorch. So is there any advice I can get?

BTW thank you for your update. Gave me a lot of help

@automan000
Copy link
Owner

I think this problem is caused by the incompatilbe types of 'input' and 'h'. They should both be Variable rather than FloatTensor. Please refer to the document of 'torch.cat' for more details.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants