北京住建委发布文件:中介费由谁支付可协商约定

paddle.nn.functional. hardtanh ( x: Tensor, min: float = -1.0, max: float = 1.0, name: str | None = None ) Tensor [source]
百度 杨振武同志当选为第十三届全国人民代表大会常务委员会秘书长。

hardtanh activation. Calculate the hardtanh of input x.

\[\begin{split}hardtanh(x)= \left\{ \begin{array}{cll} max,& & \text{if } x > max \\ min,& & \text{if } x < min \\ x,& & \text{otherwise} \end{array} \right.\end{split}\]
Parameters
  • x (Tensor) – The input Tensor with data type float32, float64.

  • min (float, optional) – The minimum value of the linear region range. Default is -1.

  • max (float, optional) – The maximum value of the linear region range. Default is 1.

  • name (str|None, optional) – For details, please refer to Name. Generally, no setting is required. Default: None.

Returns

A Tensor with the same data type and shape as x .

Examples

>>> import paddle
>>> import paddle.nn.functional as F

>>> x = paddle.to_tensor([-1.5, 0.3, 2.5])
>>> out = F.hardtanh(x)
>>> print(out)
Tensor(shape=[3], dtype=float32, place=Place(cpu), stop_gradient=True,
[-1.       , 0.30000001,  1.       ])