0

I am running EDITNTS: https://github.com/yuedongP/EditNTS without teacher forcing on some training data. When I run main.py I get the error:

  File "/home/jba5337/work/ds440w/EditNTS-Google/editnts.py", line 252, in forward
    output_t = torch.cat((output_edits, attn_applied_org_t, c, hidden_words[0]),
RuntimeError: Sizes of tensors must match except in dimension 2. Expected size 32 but got size 1 for tensor number 3 in the list.

Here is what happens when I print hidden_words[0] :

tensor([[[-0.0416,  0.0551, -0.0872,  ..., -0.0875, -0.1643,  0.0418],
         [-0.0386,  0.0519, -0.0938,  ..., -0.0947, -0.1444,  0.0253],
         [-0.0422,  0.0700, -0.1075,  ..., -0.0686, -0.1279,  0.0555],
         ...,
         [-0.0455,  0.0651, -0.1089,  ..., -0.0852, -0.1483,  0.0665],
         [-0.0375,  0.0454, -0.0936,  ..., -0.0627, -0.1144,  0.0709],
         [-0.0375,  0.0626, -0.1139,  ..., -0.0896, -0.1489,  0.0344]]],
       device='cuda:0', grad_fn=<CudnnRnnBackward0>)

torch.Size([1, 32, 400])

As you see the size of the tensor is [1,32,400] when is should be [32,1,400] . This is how hidden_words[0] is initialized. Is there a way to correct this?

            embedded_words = self.embedding(decoder_input_word)
            output_words, hidden_words = self.rnn_words(embedded_words, hidden_org)

1 Answers1

0

You can do something like this to change the channels order

X_train = X_train.permute(1,0,2)
Maen
  • 725
  • 7
  • 10