class_docstr: Apply L2 normalization to the n-dimensional input tensor. That is, divide the input
  tensor by the square root of the sum of squares of all elements of the input.
  
  .. math::
     x_i \leftarrow \dfrac{x_i}{\sqrt{\sum{x_i^2} + \epsilon}}
  
  
  Parameters
  ----------
  x: tensor<[\*B, \*D], T> (Required)
      * Input tensor, ``rank(x) >= 3``.
      * ``*B`` refers to the leading dimensions.
      * ``*D`` refers to the spatial dimensions to be normalized. Must be rank 3: ``rank(*D) == 3``.
      * When ``rank(x) == 3``, in which ``rank(*B) == 0 and rank(*D) == 3``, the input is divided by
        the square root of the sum of squares of all elements.
      * For ranks greater than 3, in which ``rank(*B) >= 1 and rank(*D) == 3``,
        the leading dimensions \*B, starting from ``0`` to ``-4`` (inclusive),
        are all treated as batch. The L2 normalization are done batch-wise.
  epsilon: const T (Optional)
      * Small constant to avoid division by ``0``.
      * Optional, defaults to ``1e-6``.
  
  Returns
  -------
  tensor<[\*B, \*D], T>
      * Same type and shape as the input tensor ``x``.
  
  Attributes
  ----------
  T: fp16, fp32
class_docstr_tok: ["Apply","L2","normalization","to","the","n-dimensional","input","tensor",".","That","is",",","divide","the","input","tensor","by","the","square","root","of","the","sum","of","squares","of","all","elements","of","the","input",".","..","math",":",":","x_i","\\leftarrow","\\dfrac","{","x_i","}","{","\\sqrt","{","\\sum","{","x_i^2","}","+","\\epsilon","}","}","Parameters","--","--","--","--","--","x",":","tensor","<","[","\\","*","B",",","\\","*","D","]",",","T",">","(","Required",")","*","Input","tensor",",","``","rank","(","x",")",">","=","3","``",".","*","``","*","B","``","refers","to","the","leading","dimensions",".","*","``","*","D","``","refers","to","the","spatial","dimensions","to","be","normalized",".","Must","be","rank","3",":","``","rank","(","*","D",")","==","3","``",".","*","When","``","rank","(","x",")","==","3","``",",","in","which","``","rank","(","*","B",")","==","0","and","rank","(","*","D",")","==","3","``",",","the","input","is","divided","by","the","square","root","of","the","sum","of","squares","of","all","elements",".","*","For","ranks","greater","than","3",",","in","which","``","rank","(","*","B",")",">","=","1","and","rank","(","*","D",")","==","3","``",",","the","leading","dimensions","\\","*","B",",","starting","from","``","0","``","to","``","-4","``","(","inclusive",")",",","are","all","treated","as","batch",".","The","L2","normalization","are","done","batch-wise",".","epsilon",":","const","T","(","Optional",")","*","Small","constant","to","avoid","division","by","``","0","``",".","*","Optional",",","defaults","to","``","1e-6","``",".","Returns","--","--","--","-","tensor","<","[","\\","*","B",",","\\","*","D","]",",","T",">","*","Same","type","and","shape","as","the","input","tensor","``","x","``",".","Attributes","--","--","--","--","--","T",":","fp16",",","fp32"]
code: def value_inference(self):
      val = self.x.val
      eps = self.epsilon.val
      shape = self.x.shape
      rank = self.x.rank
      batch_dims = rank - 3
      if batch_dims == 0:
          square_sum = np.sum(val**2)
          output = val / np.power(square_sum + eps, 0.5)
      else:
          batch_dim_prod = np.prod(shape[:batch_dims])
          reshape_val = np.reshape(val, (batch_dim_prod, -1))
          square_sum = (
              np.sum(reshape_val * reshape_val, axis=1, keepdims=True)
              + eps
          )
          output = reshape_val / np.power(square_sum, 0.5)
          output = np.reshape(output, shape)
      return output
  
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 3 for calling the l2_norm obj's underlying member method code with example usage: obj.value_inference() and returns: output