class_docstr: Apply layer normalization to the n-dimensional input tensor:
  
  .. math::
     out = gamma * (input - E[x]) / sqrt(Var[x] + epsilon) + beta
  
  
  Parameters
  ----------
  x: tensor<\*?, T> (Required)
      * Input tensor.
  
  axes: const<[K], i32> (Optional)
      * Dimensions to perform layer normalization.
      * Default is ``None`` (all dimensions).
  
  gamma: const tensor<\*?, T>, T> (Optional)
      * if provided, the shape must be be ``x.shape[axes]``. For instance, if
        input ``x`` with shape ``(3,4,5,6)`` and ``axes = [2,3]``, gamma must have
        shape ``(5,6)``.
      * Default is all ones.
  
  beta: const tensor<\*?, T>, T> (Optional)
      * Same shape as gamma.
      * Default is all zeros.
  
  epsilon: const T (Optional)
      * Small constant to avoid division by ``0``.
      * Default is ``1e-5``.
  
  
  Returns
  -------
  tensor<\*?, T>:
   * Tensor with same shape and type as the input tensor ``x``.
  
  Attributes
  ----------
  T: fp16, fp32
class_docstr_tok: ["Apply","layer","normalization","to","the","n-dimensional","input","tensor",":","..","math",":",":","out","=","gamma","*","(","input","-","E","[","x","]",")","\/","sqrt","(","Var","[","x","]","+","epsilon",")","+","beta","Parameters","--","--","--","--","--","x",":","tensor","<","\\","*","?",",","T",">","(","Required",")","*","Input","tensor",".","axes",":","const","<","[","K","]",",","i32",">","(","Optional",")","*","Dimensions","to","perform","layer","normalization",".","*","Default","is","``","None","``","(","all","dimensions",")",".","gamma",":","const","tensor","<","\\","*","?",",","T",">",",","T",">","(","Optional",")","*","if","provided",",","the","shape","must","be","be","``","x.shape","[","axes","]","``",".","For","instance",",","if","input","``","x","``","with","shape","``","(","3,4,5,6",")","``","and","``","axes","=","[","2,3","]","``",",","gamma","must","have","shape","``","(","5,6",")","``",".","*","Default","is","all","ones",".","beta",":","const","tensor","<","\\","*","?",",","T",">",",","T",">","(","Optional",")","*","Same","shape","as","gamma",".","*","Default","is","all","zeros",".","epsilon",":","const","T","(","Optional",")","*","Small","constant","to","avoid","division","by","``","0","``",".","*","Default","is","``","1e-5","``",".","Returns","--","--","--","-","tensor","<","\\","*","?",",","T",">",":","*","Tensor","with","same","shape","and","type","as","the","input","tensor","``","x","``",".","Attributes","--","--","--","--","--","T",":","fp16",",","fp32"]
code: def value_inference(self):
      def np_layer_norm(x, axes, gamma, beta, epsilon=1e-5):
          rank = len(x.shape)
          axes = [axis + rank if axis < 0 else axis for axis in axes]
          normalized_shape = [
              x.shape[i] if i in axes else 1 for i in range(rank)
          ]
          gamma = (
              np.ones(shape=normalized_shape)
              if gamma is None
              else np.reshape(gamma, normalized_shape)
          )
          beta = (
              np.zeros(shape=normalized_shape)
              if beta is None
              else np.reshape(beta, normalized_shape)
          )
          num = x - np.mean(x, axis=tuple(axes), keepdims=True)
          dem = np.sqrt(
              np.sum(np.square(num), axis=tuple(axes), keepdims=True)
              / np.prod(normalized_shape)
              + epsilon
          )
          return num / dem * gamma + beta
  
      _axes = self.x.shape if self.axes is None else self.axes.val
      _gamma = None if self.gamma is None else self.gamma.val
      _beta = None if self.beta is None else self.beta.val
      return np_layer_norm(
          self.x.val, _axes, _gamma, _beta, self.epsilon.val
      )
  
imports: import numpy
  from coremltools.converters.mil.mil import DefaultInputs, InputSpec, Operation, TensorInputType, precondition, types
  from coremltools.converters.mil.mil.operation import VALUE
  from coremltools.converters.mil.mil.ops.defs._op_reqs import register_op
  from coremltools.converters.mil.mil.types.symbolic import any_symbolic
label_desc: Use image node_id 4 for calling the layer_norm obj's underlying member method code with example usage: obj.value_inference() and returns: np_layer_norm, unknown