Hello,

I have a model that has an LSTM layer and during the backward pass after almost 70 iterations of training without error, I suddenly get this error-

I have no idea how to go about debugging this.

Thanks

EDIT: (SOLVED) I was making an error in the inputs to pack_padded_sequence. The size of inputs was 3290800 but the argument lengths was 3290801, I wasn’t slicing my tensor correctly.

3 Likes

I have a similar error. But my input size is correct with the sequence length. [32,1,100] and argument length [32]. Do you have any clue what might the problem be? Thanks Here is my question on this forum

I think this relates to cpp code, and simply because of index error. I meet this error and solve it.

I am writing cuda code using cpp version’s torch, and I create a tensor of size 4*2, initially I guess in cpp it will be of 1D, but I got: IndexError: select(): index 4 out of range for tensor of size [4, 2] at dimension 0

Then I use xxx[i][j] and restrict i (0, 3), j (0, 1), and it works!

So check the index, and maybe you could use a higher dimension expression.