Solved by jerinphilip in post #2 
              
              
                If I remember correctly, these typically used to happen with old codes. Earlier nn.Linear perhaps didn’t support multidimensional inputs (*,*, H). So a hack was to convert (T, B, H) to (TxB, H) to pass through the Linear layer. It doesn’t make a difference to Linear so long as the final dimension wa…