jimmase:

        input1 = self.cnn(input.view(batch_size*seq_len,C,H,W))               
        output, hidden = self.gru(input1.view(seq_len,-1,input_features))         
        pred = self.out1(output.view(-1,seq_len,hidden_size*2)) 



@ptrblck So looking at what you proposed, it works for formatting a 5-dimension input into a 3-dimension for the RNN. However, my architecture has a CNN model before the RNN that can only take 4-dimension inputs and not 5 dimensions. Also, the CNN outputs a 2-dimension output, which is the input to the RNN. So, how do I use the permute operation to format the 2-dimension CNN output into 3-dimension input to the RNN or how do I use the permute operation in my model?
For example,
output_features = 100 #number of output features of CNN
batch_size, seq_len, c, h, w = 2, 3, 4, 2, 2
x = torch.zeros(batch_size, seq_len, c, h, w)

input1 = self.cnn( x.view(batch_size * seq_len, c, h , w) )  # input1 shape = ( 6, 100)

output, hidden = self.gru(input1.permute ?????