Converting 2D to 3D

Hello,
I would like to ask about converting 2D to 3D since GRU layer accept input with 3D format

the issue that I have my data with n subjects(rows) and m features and I have the label for them.
so the dataset should look like n×m.
however what is the best representation for this 2D array to 3D???

Please Advise
Abeer

The input to nn.GRU should be [seq_len, batch_size, input_size]. In your case, you would have to add the batch dimension to your data. I assume the features are supposed to represent the “time dimension”.

Thanks a lot, I think in my case the seq_ len is 1