2022-05-23 14:51:53 +08:00
|
|
|
|
mindspore.nn.Threshold
|
|
|
|
|
|
=============================
|
|
|
|
|
|
|
2022-05-26 15:35:12 +08:00
|
|
|
|
.. py:class:: mindspore.nn.Threshold(threshold, value)
|
2022-05-23 14:51:53 +08:00
|
|
|
|
|
|
|
|
|
|
Threshold激活函数,按元素计算输出。
|
|
|
|
|
|
|
|
|
|
|
|
Threshold定义为:
|
|
|
|
|
|
|
|
|
|
|
|
.. math::
|
|
|
|
|
|
y =
|
|
|
|
|
|
\begin{cases}
|
|
|
|
|
|
x, &\text{ if } x > \text{threshold} \\
|
|
|
|
|
|
\text{value}, &\text{ otherwise }
|
|
|
|
|
|
\end{cases}
|
|
|
|
|
|
|
2022-07-25 16:47:23 +08:00
|
|
|
|
参数:
|
|
|
|
|
|
- **threshold** (`Union[int, float]`) - 阈值。
|
|
|
|
|
|
- **value** (`Union[int, float]`) - 输入Tensor中element小于阈值时的填充值。
|
2022-05-23 14:51:53 +08:00
|
|
|
|
|
2022-07-25 16:47:23 +08:00
|
|
|
|
输入:
|
|
|
|
|
|
- **input_x** (Tensor) - 输入Tensor,数据类型为float16或float32。
|
2022-05-23 14:51:53 +08:00
|
|
|
|
|
2022-07-25 16:47:23 +08:00
|
|
|
|
输出:
|
|
|
|
|
|
Tensor,数据类型和shape与 `input_x` 的相同。
|
2022-05-23 14:51:53 +08:00
|
|
|
|
|
2022-07-25 16:47:23 +08:00
|
|
|
|
异常:
|
|
|
|
|
|
- **TypeError** - `threshold` 不是浮点数或整数。
|
|
|
|
|
|
- **TypeError** - `value` 不是浮点数或整数。
|