code: def hardtanh(
      x: JaxArray,
      /,
      *,
      max_val: float = 1.0,
      min_val: float = -1.0,
      out: Optional[JaxArray] = None,
  ) -> JaxArray:
      ret = jnp.where(
          x > max_val, max_val, jnp.where(x < min_val, min_val, x)
      )
      if ivy.exists(out):
          return ivy.inplace_update(out, ret).astype(x.dtype)
      return ivy.astype(ret, x.dtype)
  
imports: from typing import Optional, Union, Literal
  import jax
  import jax.numpy
  from ivy.functional.backends.jax import JaxArray
  from jax import lax
  import ivy
  from ivy.func_wrapper import with_unsupported_dtypes
  from .None import backend_version
label_desc: Use image node_id 9 for calling a global function with example usage: hardtanh() and returns: ivy, ivy