code: def logpdf(x, a, b, loc=0, scale=1):
      x, a, b, loc, scale = promote_args_inexact(
          "truncnorm.logpdf", x, a, b, loc, scale
      )
      val = lax.sub(norm.logpdf(x, loc, scale), _log_gauss_mass(a, b))
  
      x_scaled = lax.div(lax.sub(x, loc), scale)
      val = jnp.where((x_scaled < a) | (x_scaled > b), -jnp.inf, val)
      val = jnp.where(a >= b, jnp.nan, val)
      return val
  
file_path: jax/jax/_src/scipy/stats/truncnorm.py
imports: import scipy.stats
  from jax import lax
  import jax.numpy
  from jax._src.numpy.util import _wraps, promote_args_inexact
  from jax._src.scipy.stats import norm
  from jax._src.scipy.special import logsumexp, log_ndtr, ndtr
label_desc: Use image node_id 3 for calling a global function with example usage: logpdf(x, a, b, loc, scale) and returns: val