The nn.Linear layer transforms shape in the form (N,*,in_features) -> (N,*,out_features). I have found myself multiple times trying to apply batch normalization after a linear layer. However, because the default nn.BatchNormNd layers only apply over the dimension 1 (corresponding to channels in the convolutional layers), I can only directly compose nn.Linear and nn.BatchNormNd if there are no additional dimensions input into nn.Linear. If there are more dimensions, I have to transpose the last dimension into the channel dimension before and after the batch normalization. Is there a better way to do this?