prakashpandey9 / Text-Classification-Pytorch

Text classification using deep learning models in Pytorch
MIT License
809 stars 239 forks source link

Use of permute in RCNN #15

Open jtquisenberry opened 3 years ago

jtquisenberry commented 3 years ago

On lines 63 and 73 of Text-Classification-Pytorch/models/RCNN.py, function permute is used.

input = input.permute(1, 0, 2) # input.size() = (num_sequences, batch_size, embedding_length)
...
y = y.permute(0, 2, 1) # y.size() = (batch_size, hidden_size, num_sequences)

Could you please explain why it is necessary or useful to permute the dimensions of these tensors?