docstr: ivy.Container instance method variant of ivy.trace. This method
  Returns the sum along the specified diagonals of a matrix (or a stack
  of matrices).
  
  Parameters
  ----------
  self
      input container having shape ``(..., M, N)`` and whose innermost two
      dimensions form ``MxN`` matrices. Should have a floating-point data type.
  offset
      Offset of the diagonal from the main diagonal. Can be both positive and
      negative. Defaults to 0.
  axis1
      axis to be used as the first axis of the 2-D sub-arrays from which the
      diagonals should be taken.
      Defaults to ``0.`` .
  axis2
      axis to be used as the second axis of the 2-D sub-arrays from which the
      diagonals should be taken.
      Defaults to ``1.`` .
  key_chains
      The key-chains to apply or not apply the method to. Default is ``None``.
  to_apply
      If True, the method will be applied to key_chains, otherwise key_chains
      will be skipped. Default is ``True``.
  prune_unapplied
      Whether to prune key_chains for which the function was not applied.
      Default is ``False``.
  map_sequences
      Whether to also map method to sequences (lists, tuples).
      Default is ``False``.
  out
      optional output array, for writing the result to. It must have a shape that
      the inputs broadcast to.
  
  Returns
  -------
  ret
      a container containing the traces and whose shape is determined by removing
      the last two dimensions and storing the traces in the last array dimension.
      For example, if ``x`` has rank ``k`` and shape ``(I, J, K, ..., L, M, N)``,
      then an output array has rank ``k-2`` and shape ``(I, J, K, ..., L)`` where
  
      ::
  
      out[i, j, k, ..., l] = trace(a[i, j, k, ..., l, :, :])
  
      The returned array must have the same data type as ``x``.
  
  Examples
  --------
  With :class:`ivy.Container` input:
  >>> x = ivy.Container(
  ...    a = ivy.array([[7, 1, 2],
  ...                   [1, 3, 5],
  ...                   [0, 7, 4]]),
  ...    b = ivy.array([[4, 3, 2],
  ...                   [1, 9, 5],
  ...                   [7, 0, 6]]))
  >>> y = x.trace()
  >>> print(y)
  {
      a: ivy.array(14),
      b: ivy.array(19)
  }
code: def trace(
      self: ivy.Container,
      /,
      *,
      offset: Union[int, ivy.Container] = 0,
      axis1: Union[int, ivy.Container] = 0,
      axis2: Union[int, ivy.Container] = 1,
      key_chains: Optional[
          Union[List[str], Dict[str, str], ivy.Container]
      ] = None,
      to_apply: Union[bool, ivy.Container] = True,
      prune_unapplied: Union[bool, ivy.Container] = False,
      map_sequences: Union[bool, ivy.Container] = False,
      out: Optional[ivy.Container] = None,
  ) -> ivy.Container:
      """ivy.Container instance method variant of ivy.trace. This method
      Returns the sum along the specified diagonals of a matrix (or a stack
      of matrices).
  
      Parameters
      ----------
      self
          input container having shape ``(..., M, N)`` and whose innermost two
          dimensions form ``MxN`` matrices. Should have a floating-point data type.
      offset
          Offset of the diagonal from the main diagonal. Can be both positive and
          negative. Defaults to 0.
      axis1
          axis to be used as the first axis of the 2-D sub-arrays from which the
          diagonals should be taken.
          Defaults to ``0.`` .
      axis2
          axis to be used as the second axis of the 2-D sub-arrays from which the
          diagonals should be taken.
          Defaults to ``1.`` .
      key_chains
          The key-chains to apply or not apply the method to. Default is ``None``.
      to_apply
          If True, the method will be applied to key_chains, otherwise key_chains
          will be skipped. Default is ``True``.
      prune_unapplied
          Whether to prune key_chains for which the function was not applied.
          Default is ``False``.
      map_sequences
          Whether to also map method to sequences (lists, tuples).
          Default is ``False``.
      out
          optional output array, for writing the result to. It must have a shape that
          the inputs broadcast to.
  
      Returns
      -------
      ret
          a container containing the traces and whose shape is determined by removing
          the last two dimensions and storing the traces in the last array dimension.
          For example, if ``x`` has rank ``k`` and shape ``(I, J, K, ..., L, M, N)``,
          then an output array has rank ``k-2`` and shape ``(I, J, K, ..., L)`` where
  
          ::
  
          out[i, j, k, ..., l] = trace(a[i, j, k, ..., l, :, :])
  
          The returned array must have the same data type as ``x``.
  
      Examples
      --------
      With :class:`ivy.Container` input:
      >>> x = ivy.Container(
      ...    a = ivy.array([[7, 1, 2],
      ...                   [1, 3, 5],
      ...                   [0, 7, 4]]),
      ...    b = ivy.array([[4, 3, 2],
      ...                   [1, 9, 5],
      ...                   [7, 0, 6]]))
      >>> y = x.trace()
      >>> print(y)
      {
          a: ivy.array(14),
          b: ivy.array(19)
      }
      """
      return self._static_trace(
          self,
          offset=offset,
          axis1=axis1,
          axis2=axis2,
          key_chains=key_chains,
          to_apply=to_apply,
          prune_unapplied=prune_unapplied,
          map_sequences=map_sequences,
          out=out,
      )
  
imports: from typing import Union, Optional, Tuple, Literal, List, Dict, Sequence
  from ivy.data_classes.container.base import ContainerBase
  import ivy
label_desc: Use image node_id 48 for calling the _ContainerWithLinearAlgebra obj's underlying member method code with example usage: obj.trace() and returns: self