class_docstr: LayerNorm that supports two data formats: channels_last (default) or channels_first.
  The ordering of the dimensions in the inputs. channels_last corresponds to inputs with
  shape (batch_size, height, width, channels) while channels_first corresponds to inputs
  with shape (batch_size, channels, height, width).
class_docstr_tok: ["LayerNorm","that","supports","two","data","formats",":","channels_last","(","default",")","or","channels_first",".","The","ordering","of","the","dimensions","in","the","inputs",".","channels_last","corresponds","to","inputs","with","shape","(","batch_size",",","height",",","width",",","channels",")","while","channels_first","corresponds","to","inputs","with","shape","(","batch_size",",","channels",",","height",",","width",")","."]
code: def forward(self, x: torch.Tensor) -> torch.Tensor:
      if self.data_format == "channels_last":
          return F.layer_norm(
              x, self.normalized_shape, self.weight, self.bias, self.eps
          )
      elif self.data_format == "channels_first":
          # [batch_size, channels, height, width]
          mean = x.mean(1, keepdim=True)
          var = (x - mean).pow(2).mean(1, keepdim=True)
          x = (x - mean) / torch.sqrt(var + self.eps)
          x = self.weight[:, None, None] * x + self.bias[:, None, None]
          return x
  
imports: import torch
  import torch.nn
  import torch.nn.functional
label_desc: Use image node_id 2 for calling the LayerNorm obj's underlying member method code with example usage: obj.forward(x) and returns: F, x