class_docstr: LayerNorm for channels_first tensors with 2d spatial dimensions (ie N, C, H, W).
  
  Experimental implementation w/ manual norm for tensors non-contiguous tensors.
  
  This improves throughput in some scenarios (tested on Ampere GPU), esp w/ channels_last
  layout. However, benefits are not always clear and can perform worse on other GPUs.
class_docstr_tok: ["LayerNorm","for","channels_first","tensors","with","2d","spatial","dimensions","(","ie","N",",","C",",","H",",","W",")",".","Experimental","implementation","w\/","manual","norm","for","tensors","non-contiguous","tensors",".","This","improves","throughput","in","some","scenarios","(","tested","on","Ampere","GPU",")",",","esp","w\/","channels_last","layout",".","However",",","benefits","are","not","always","clear","and","can","perform","worse","on","other","GPUs","."]
code: def forward(self, x) -> torch.Tensor:
      if _is_contiguous(x):
          x = F.layer_norm(
              x.permute(0, 2, 3, 1),
              self.normalized_shape,
              self.weight,
              self.bias,
              self.eps,
          ).permute(0, 3, 1, 2)
      else:
          x = _layer_norm_cf(x, self.weight, self.bias, self.eps)
      return x
  
imports: import numbers
  from typing import Tuple
  import torch
  import torch.nn
  import torch.nn.functional
  from .fast_norm import is_fast_norm, fast_group_norm, fast_layer_norm, fast_rms_norm
label_desc: Use image node_id 2 for calling the LayerNormExp2d obj's underlying member method code with example usage: obj.forward(x) and returns: x