Rnn - Runtimeerror: Input Must Have 3 Dimensions, Got 2
I’m getting the following error: RuntimeError: input must have 3 dimensions, got 2 I have a single feature column that I am trying to feed into a GRU neural net. Below are my d
Solution 1:
As suggested by the error you got, the input tensor shape expected by the GRU is three dimensional with shape (batch_size, seq_len, input_size)
1
But you are feeding a tensor of shape (10, 5). You said your input has one feature value, so you should add a dimension for input_size of size 1. This can be done like this
sample_x.unsqueeze(-1)
Post a Comment for "Rnn - Runtimeerror: Input Must Have 3 Dimensions, Got 2"