code: def hardtanh(
      x: Tensor,
      /,
      *,
      max_val: float = 1.0,
      min_val: float = -1.0,
      out: Optional[Tensor] = None,
  ) -> Tensor:
      ret = tf.where(
          tf.math.greater(x, max_val),
          max_val,
          tf.where(tf.math.less(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)
  
file_path: ivy/ivy/functional/backends/tensorflow/experimental/activations.py
imports: from typing import Optional, Union, Literal
  import tensorflow
  from tensorflow.python.types.core import Tensor
  import ivy
  from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes
  from .None import backend_version
label_desc: Use image node_id 8 for calling a global function with example usage: hardtanh() and returns: ivy, ivy