code: def cholesky(
      x: np.ndarray,
      /,
      *,
      upper: bool = False,
      out: Optional[np.ndarray] = None,
  ) -> np.ndarray:
      if not upper:
          ret = np.linalg.cholesky(x)
      else:
          axes = list(range(len(x.shape) - 2)) + [
              len(x.shape) - 1,
              len(x.shape) - 2,
          ]
          ret = np.transpose(
              np.linalg.cholesky(np.transpose(x, axes=axes)), axes=axes
          )
      return ret
  
imports: from collections import namedtuple
  from typing import Union, Optional, Tuple, Literal, List, NamedTuple, Sequence
  import numpy
  import ivy
  from ivy import inf
  from ivy.func_wrapper import with_unsupported_dtypes
  from ivy.functional.backends.numpy.helpers import _scalar_output_to_0d_array
  from .None import backend_version
label_desc: Use image node_id 1 for calling a global function with example usage: cholesky() and returns: ret