PyTorch LinearLayer+BatchNorm1d with a 3D input
I would like to apply a BatchNorm1d after a Linear. My input is a 3D multivariate time series of shape [batch_size, n_variables, timesteps]. The Linear performs the linear transformation on the third dimension so that the new shape is [batch_size, n_variables, LinearLayer_out_features]. My problem occurs with the BatchNorm1d, I would like to apply it on the third dimension but, for a 3D input, BatchNorm1d operation is done over the second dimension (even for a 3D tensor). Do you have any suggestion on how to do that?

Why not transpose the input to BatchNorm1d and then transpose it back?
m=Linear(.....)
m=torch.transpose(BatchNorm1D(torch.transpose(m,1,2)),1,2)

This doesn't create a copy of your tensor.
https://pytorch.org/docs/stable/generated/torch.transpose.html
