docstr: ivy.Container instance method variant of ivy.diagonal. This method
  simply wraps the function, and so the docstring for ivy.diagonal also
  applies to this method with minimal changes.
  
  Parameters
  ----------
  self
      input Container with leave arrays having shape
       ``(..., M, N)`` and whose innermost two dimensions form
      ``MxN`` matrices.
  offset
      offset specifying the off-diagonal relative to the main diagonal.
      - ``offset = 0``: the main diagonal.
      - ``offset > 0``: off-diagonal above the main diagonal.
      - ``offset < 0``: off-diagonal below the main diagonal.
      Default: `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 first axis (-2).
  axis2
      axis to be used as the second axis of the 2-D sub-arrays from which the
      diagonals should be taken. Defaults to second axis (-1).
  out
      optional output array, for writing the result to. It must
      have a shape that the inputs broadcast to.
  
  Returns
  -------
  ret
      A container with the diagonals. More details can be found in
      the docstring for ivy.diagonal.
  
  Examples
  --------
  With :class:`ivy.Container` inputs:
  
  >>> x = ivy.Container(a=ivy.array([[1., 2.], [3., 4.]]),
  ...                   b=ivy.array([[5., 6.], [7., 8.]]))
  >>> d = x.diagonal()
  >>> print(d)
  {
      a:ivy.array([1., 4.]),
      b:ivy.array([5., 8.])
  }
  
  >>> a = ivy.array([[0, 1, 2],
  ...                [3, 4, 5],
  ...                [6, 7, 8]])
  >>> b = ivy.array([[-1., -2., -3.],
  ...                 [-3., 4., 5.],
  ...                 [5., 6., 7.]]),
  >>> x = ivy.Container(a=a, b=b)
  >>> d = x.diagonal(offset=-1)
  >>> print(d)
  {
      a: ivy.array([3, 7]),
      b: ivy.array([[-3., 6.]])
  }
code: def diagonal(
      self: ivy.Container,
      /,
      *,
      offset: Union[int, ivy.Container] = 0,
      axis1: Union[int, ivy.Container] = -2,
      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.diagonal. This method
      simply wraps the function, and so the docstring for ivy.diagonal also
      applies to this method with minimal changes.
  
      Parameters
      ----------
      self
          input Container with leave arrays having shape
           ``(..., M, N)`` and whose innermost two dimensions form
          ``MxN`` matrices.
      offset
          offset specifying the off-diagonal relative to the main diagonal.
          - ``offset = 0``: the main diagonal.
          - ``offset > 0``: off-diagonal above the main diagonal.
          - ``offset < 0``: off-diagonal below the main diagonal.
          Default: `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 first axis (-2).
      axis2
          axis to be used as the second axis of the 2-D sub-arrays from which the
          diagonals should be taken. Defaults to second axis (-1).
      out
          optional output array, for writing the result to. It must
          have a shape that the inputs broadcast to.
  
      Returns
      -------
      ret
          A container with the diagonals. More details can be found in
          the docstring for ivy.diagonal.
  
      Examples
      --------
      With :class:`ivy.Container` inputs:
  
      >>> x = ivy.Container(a=ivy.array([[1., 2.], [3., 4.]]),
      ...                   b=ivy.array([[5., 6.], [7., 8.]]))
      >>> d = x.diagonal()
      >>> print(d)
      {
          a:ivy.array([1., 4.]),
          b:ivy.array([5., 8.])
      }
  
      >>> a = ivy.array([[0, 1, 2],
      ...                [3, 4, 5],
      ...                [6, 7, 8]])
      >>> b = ivy.array([[-1., -2., -3.],
      ...                 [-3., 4., 5.],
      ...                 [5., 6., 7.]]),
      >>> x = ivy.Container(a=a, b=b)
      >>> d = x.diagonal(offset=-1)
      >>> print(d)
      {
          a: ivy.array([3, 7]),
          b: ivy.array([[-3., 6.]])
      }
      """
      return self._static_diagonal(
          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 10 for calling the _ContainerWithLinearAlgebra obj's underlying member method code with example usage: obj.diagonal() and returns: self