code: def einsum(
      equation: str,
      *operands: Union[ivy.Array, ivy.NativeArray],
      out: Optional[ivy.Array] = None,
  ) -> ivy.Array:
      """Sum the product of the elements of the input operands along dimensions
      specified using a notation based on the Einstein summation convention.
  
      Parameters
      ----------
      equation
          A str describing the contraction, in the same format as numpy.einsum.
      operands
          seq of arrays, the inputs to contract (each one an ivy.Array), whose shapes
          should be consistent with equation.
      out
          optional output array, for writing the result to.
  
      Returns
      -------
      ret
          The array with sums computed.
  
      Examples
      --------
      With :class:`ivy.Array` input:
  
      >>> x = ivy.array([[0, 1, 2], [3, 4, 5], [6, 7, 8]])
      >>> y = ivy.einsum('ii', x)
      >>> print(y)
      ivy.array(12)
  
      >>> x = ivy.array([[0, 1, 2], [3, 4, 5], [6, 7, 8]])
      >>> z = ivy.einsum('ij -> j', x)
      >>> print(z)
      ivy.array([ 9, 12, 15])
  
      >>> A = ivy.array([0, 1, 2])
      >>> B = ivy.array([[ 0,  1,  2,  3],
      ...                [ 4,  5,  6,  7],
      ...                [ 8,  9, 10, 11]])
      >>> C = ivy.einsum('i,ij->i', A, B)
      >>> print(C)
      ivy.array([ 0, 22, 76])
  
      >>> A = ivy.array([[1, 1, 1],
      ...                [2, 2, 2],
      ...                [5, 5, 5]])
      >>> B = ivy.array([[0, 1, 0],
      ...                [1, 1, 0],
      ...                [1, 1, 1]])
      >>> C = ivy.einsum('ij,jk->ik', A, B)
      >>> print(C)
      ivy.array([[ 2,  3,  1],
             [ 4,  6,  2],
             [10, 15,  5]])
  
      >>> A = ivy.arange(10)
      >>> B = ivy.arange(5, 15)
      >>> C = ivy.einsum('i->', A)
      >>> print(C)
      ivy.array(45)
  
      >>> A = ivy.arange(10)
      >>> B = ivy.arange(5, 15)
      >>> C = ivy.einsum('i,i->i', A, B)
      >>> print(C)
      ivy.array([  0,   6,  14,  24,  36,  50,  66,  84, 104, 126])
  
      >>> A = ivy.arange(10)
      >>> B = ivy.arange(5, 15)
      >>> C = ivy.einsum('i,i->', A, B) # or just use 'i,i'
      >>> print(C)
      ivy.array(510)
  
      >>> A = ivy.arange(10)
      >>> B = ivy.arange(5, 15)
      >>> C = ivy.einsum('i,j->ij', A, B)
      >>> print(C)
      ivy.array([[  0,   0,   0,   0,   0,   0,   0,   0,   0,   0],
             [  5,   6,   7,   8,   9,  10,  11,  12,  13,  14],
             [ 10,  12,  14,  16,  18,  20,  22,  24,  26,  28],
             [ 15,  18,  21,  24,  27,  30,  33,  36,  39,  42],
             [ 20,  24,  28,  32,  36,  40,  44,  48,  52,  56],
             [ 25,  30,  35,  40,  45,  50,  55,  60,  65,  70],
             [ 30,  36,  42,  48,  54,  60,  66,  72,  78,  84],
             [ 35,  42,  49,  56,  63,  70,  77,  84,  91,  98],
             [ 40,  48,  56,  64,  72,  80,  88,  96, 104, 112],
             [ 45,  54,  63,  72,  81,  90,  99, 108, 117, 126]])
  
      With a mix of :class:`ivy.Array` and :class:`ivy.Container` inputs:
  
      >>> x = ivy.array([0, 1, 2])
      >>> y = ivy.Container(a=ivy.array([[ 0,  1,  2,  3],
      ...                                [ 4,  5,  6,  7],
      ...                                [ 8,  9, 10, 11]]),
      ...                   b=ivy.array([[ 0,  1,  2],
      ...                                [ 4,  5,  6],
      ...                                [ 8,  9, 10]]))
      >>> z = ivy.einsum('i,ij->i', x, y)
      >>> print(z)
      {
          a: ivy.array([0, 22, 76]),
          b: ivy.array([0, 15, 54])
      }
  
      With :class:`ivy.Container` input:
  
      >>> x = ivy.Container(a=ivy.array([[0, 1, 0],[1, 1, 0],[1, 1, 1]]),
      ...                   b=ivy.array([[0, 1, 2],[4, 5, 6],[8, 9, 10]]))
      >>> y = ivy.einsum('ii', x)
      >>> print(y)
      {
          a: ivy.array(2),
          b: ivy.array(15)
      }
      """
      return current_backend(operands[0]).einsum(
          equation, *operands, out=out
      )
  
file_path: ivy/ivy/functional/ivy/statistical.py
imports: from typing import Union, Optional, Sequence
  import ivy
  from ivy.utils.backend import current_backend
  from ivy.func_wrapper import handle_array_function, to_native_arrays_and_back, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, handle_backend_invalid
  from ivy.utils.exceptions import handle_exceptions
label_desc: Use image node_id 11 for calling a global function with example usage: einsum(equation) and returns: current_backend