code: def hardtanh(self, min_value=-1, max_value=1):
      r"""Applies the HardTanh function element-wise
  
      HardTanh is defined as:
  
      .. math::
          \text{HardTanh}(x) = \begin{cases}
              1 & \text{ if } x > 1 \\
              -1 & \text{ if } x < -1 \\
              x & \text{ otherwise } \\
          \end{cases}
  
      The range of the linear region :math:`[-1, 1]` can be adjusted using
      :attr:`min_val` and :attr:`max_val`.
  
      Args:
          min_val: minimum value of the linear region range. Default: -1
          max_val: maximum value of the linear region range. Default: 1
      """
      intermediate = mpc.stack(
          [self - min_value, self - max_value]
      ).relu()
      intermediate = intermediate[0].sub(intermediate[1])
      return intermediate.add_(min_value)
  
file_path: FATE/python/fate/arch/protocol/mpc/functions/logic.py
imports: from fate.arch.protocol import mpc
  from ..common.tensor_types import is_tensor
label_desc: Use image node_id 10 for calling a global function with example usage: hardtanh(min_value, max_value) and returns: intermediate