code: def pinv(
      a: ArrayLike,
      rcond: ArrayLike | None = None,
      hermitian: bool = False,
  ) -> Array:
      # Uses same algorithm as
      # https://github.com/numpy/numpy/blob/v1.17.0/numpy/linalg/linalg.py#L1890-L1979
      check_arraylike("jnp.linalg.pinv", a)
      arr = jnp.asarray(a)
      m, n = arr.shape[-2:]
      if m == 0 or n == 0:
          return jnp.empty(arr.shape[:-2] + (n, m), arr.dtype)
      arr = ufuncs.conj(arr)
      if rcond is None:
          max_rows_cols = max(arr.shape[-2:])
          rcond = (
              10.0 * max_rows_cols * jnp.array(jnp.finfo(arr.dtype).eps)
          )
      rcond = jnp.asarray(rcond)
      u, s, vh = svd(arr, full_matrices=False, hermitian=hermitian)
      # Singular values less than or equal to ``rcond * largest_singular_value``
      # are set to zero.
      rcond = lax.expand_dims(
          rcond[..., jnp.newaxis], range(s.ndim - rcond.ndim - 1)
      )
      cutoff = rcond * s[..., 0:1]
      s = jnp.where(s > cutoff, s, jnp.inf).astype(u.dtype)
      res = jnp.matmul(
          vh.mT,
          ufuncs.divide(u.mT, s[..., jnp.newaxis]),
          precision=lax.Precision.HIGHEST,
      )
      return lax.convert_element_type(res, arr.dtype)
  
imports: from __future__ import annotations
  from collections.abc import Sequence
  from functools import partial
  import numpy
  import textwrap
  import operator
  from typing import Literal, cast, overload
  import jax
  from jax import jit, custom_jvp
  from jax import lax
  from jax._src.lax import lax
  from jax._src.lax import linalg
  from jax._src.numpy import lax_numpy
  from jax._src.numpy import reductions, ufuncs
  from jax._src.numpy.util import _wraps, promote_dtypes_inexact, check_arraylike
  from jax._src.util import canonicalize_axis
  from jax._src.typing import ArrayLike, Array
label_desc: Use image node_id 25 for calling a global function with example usage: pinv(a, rcond, hermitian) and returns: lax, jnp