code: def hard_tanh(x, name="htanh"):
      """Hard tanh activation function.
  
      Which is a ramp function with low bound of -1 and upper bound of 1, shortcut is `htanh`.
  
      Parameters
      ----------
      x : Tensor
          input.
      name : str
          The function name (optional).
  
      Returns
      -------
      Tensor
          A ``Tensor`` in the same type as ``x``.
  
      """
      # with tf.variable_scope("hard_tanh"):
      return tf.clip_by_value(x, -1, 1, name=name)
  
file_path: TensorLayer/tensorlayer/activation.py
imports: import tensorflow
  from tensorlayer.decorators import deprecated
label_desc: Use image node_id 7 for calling a global function with example usage: hard_tanh(x, name) and returns: tf