docstr: ivy.Array instance method variant of ivy.diag. This method simply
  wraps the function, and so the docstring for ivy.diag also applies to
  this method with minimal changes.
  
  Examples
  --------
  >>> x = ivy.array([[0, 1, 2],
  >>>                [3, 4, 5],
  >>>                [6, 7, 8]])
  >>> x.diag(k=1)
  ivy.array([1, 5])
docstr_tok: ["ivy.Array","instance","method","variant","of","ivy.diag",".","This","method","simply","wraps","the","function",",","and","so","the","docstring","for","ivy.diag","also","applies","to","this","method","with","minimal","changes",".","Examples","--","--","--","--",">",">",">","x","=","ivy.array","(","[","[","0",",","1",",","2","]",",",">",">",">","[","3",",","4",",","5","]",",",">",">",">","[","6",",","7",",","8","]","]",")",">",">",">","x.diag","(","k=1",")","ivy.array","(","[","1",",","5","]",")"]
code: def diag(
      self: ivy.Array,
      /,
      *,
      k: int = 0,
      out: Optional[ivy.Array] = None,
  ) -> ivy.Array:
      """ivy.Array instance method variant of ivy.diag. This method simply
      wraps the function, and so the docstring for ivy.diag also applies to
      this method with minimal changes.
  
      Examples
      --------
      >>> x = ivy.array([[0, 1, 2],
      >>>                [3, 4, 5],
      >>>                [6, 7, 8]])
      >>> x.diag(k=1)
      ivy.array([1, 5])
      """
      return ivy.diag(self._data, k=k, out=out)
  
imports: import abc
  from typing import Union, Optional, Literal, Tuple, List, Sequence
  import ivy
label_desc: Use image node_id 6 for calling the _ArrayWithLinearAlgebra obj's underlying member method code with example usage: obj.diag() and returns: ivy