code: def diagonal(x, /, *, offset=0):
      """
      Returns the specified diagonals of a matrix (or a stack of matrices) x.
      """
      return jax.numpy.linalg.diagonal(x, offset=offset)
  
imports: from functools import partial
  from typing import NamedTuple
  import jax
  from jax.experimental.array_api._data_type_functions import _promote_to_default_dtype
label_desc: Use image node_id 4 for calling a global function with example usage: diagonal() and returns: jax