docstr: ivy.Array 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 array 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.`` .
  out
      optional output array, for writing the result to. It must have a shape that
      the inputs broadcast to.
  
  Returns
  -------
  ret
      an array 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
  --------
  >>> x = ivy.array([[1., 2.], [3., 4.]])
  >>> y = x.trace()
  >>> print(y)
  ivy.array(5.)
  
  >>> x = ivy.array([[1., 2., 4.], [6., 5., 3.]])
  >>> y = ivy.Array.trace(x)
  >>> print(y)
  ivy.array(6.)
docstr_tok: ["ivy.Array","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","array","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.","``",".","out","optional","output","array",",","for","writing","the","result","to",".","It","must","have","a","shape","that","the","inputs","broadcast","to",".","Returns","--","--","--","-","ret","an","array","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","--","--","--","--",">",">",">","x","=","ivy.array","(","[","[","1.",",","2",".","]",",","[","3.",",","4",".","]","]",")",">",">",">","y","=","x.trace","(",")",">",">",">","print","(","y",")","ivy.array","(","5",".",")",">",">",">","x","=","ivy.array","(","[","[","1.",",","2.",",","4",".","]",",","[","6.",",","5.",",","3",".","]","]",")",">",">",">","y","=","ivy.Array.trace","(","x",")",">",">",">","print","(","y",")","ivy.array","(","6",".",")"]
code: def trace(
      self: ivy.Array,
      /,
      *,
      offset: int = 0,
      axis1: int = 0,
      axis2: int = 1,
      out: Optional[ivy.Array] = None,
  ) -> ivy.Array:
      """ivy.Array 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 array 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.`` .
      out
          optional output array, for writing the result to. It must have a shape that
          the inputs broadcast to.
  
      Returns
      -------
      ret
          an array 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
      --------
      >>> x = ivy.array([[1., 2.], [3., 4.]])
      >>> y = x.trace()
      >>> print(y)
      ivy.array(5.)
  
      >>> x = ivy.array([[1., 2., 4.], [6., 5., 3.]])
      >>> y = ivy.Array.trace(x)
      >>> print(y)
      ivy.array(6.)
      """
      return ivy.trace(
          self._data, offset=offset, axis1=axis1, axis2=axis2, out=out
      )
  
imports: import abc
  from typing import Union, Optional, Literal, Tuple, List, Sequence
  import ivy
label_desc: Use image node_id 25 for calling the _ArrayWithLinearAlgebra obj's underlying member method code with example usage: obj.trace() and returns: ivy