my tensor shape is 8 X 5 X 512 (N X C X L) and i want to apply batchnorm on L how to do it??
You should try using torch.nn.BatchNorm1d(). Please find the relevant info on this pytorch page.
batchnorm1d normalize over C in N X C X L
permute the input tensor and swap
L before applying the batchnorm and swap it back afterwards.