code: def logpmf(
      k: ArrayLike, n: ArrayLike, p: ArrayLike, loc: ArrayLike = 0
  ) -> Array:
      """JAX implementation of scipy.stats.nbinom.logpmf."""
      k, n, p, loc = promote_args_inexact("nbinom.logpmf", k, n, p, loc)
      one = _lax_const(k, 1)
      y = lax.sub(k, loc)
      comb_term = lax.sub(
          lax.sub(gammaln(lax.add(y, n)), gammaln(n)),
          gammaln(lax.add(y, one)),
      )
      log_linear_term = lax.add(xlogy(n, p), xlogy(y, lax.sub(one, p)))
      log_probs = lax.add(comb_term, log_linear_term)
      return jnp.where(lax.lt(k, loc), -jnp.inf, log_probs)
  
file_path: jax/jax/_src/scipy/stats/nbinom.py
imports: import scipy.stats
  from jax import lax
  import jax.numpy
  from jax._src.lax.lax import _const
  from jax._src.numpy.util import _wraps, promote_args_inexact
  from jax._src.scipy.special import gammaln, xlogy
  from jax._src.typing import Array, ArrayLike
label_desc: Use image node_id 1 for calling a global function with example usage: logpmf(k, n, p, loc) and returns: jnp