docstr: Batch norm 1D is not optimised for 2D tensors. The first dimension is supposed to be
  the batch and therefore not very large. So we introduce a custom version that leverages BatchNorm1D
  in a more optimised way
docstr_tok: ["Batch","norm","1D","is","not","optimised","for","2D","tensors",".","The","first","dimension","is","supposed","to","be","the","batch","and","therefore","not","very","large",".","So","we","introduce","a","custom","version","that","leverages","BatchNorm1D","in","a","more","optimised","way"]
code: def _forward_sparse(self, x):
      """Batch norm 1D is not optimised for 2D tensors. The first dimension is supposed to be
      the batch and therefore not very large. So we introduce a custom version that leverages BatchNorm1D
      in a more optimised way
      """
      x = x.unsqueeze(2)
      x = x.transpose(0, 2)
      x = self.batch_norm(x)
      x = x.transpose(0, 2)
      return x.squeeze(dim=2)
  
imports: import numpy
  import torch
  from torch import nn
  from torch.nn.parameter import Parameter
label_desc: Use image node_id 3 for calling the FastBatchNorm1d obj's underlying member method code with example usage: obj._forward_sparse(x) and returns: x