mindspore/docs/api/api_python/ops/mindspore.ops.Heaviside.rst

26 lines
945 B
ReStructuredText
Raw Normal View History

2022-11-09 20:49:52 +08:00
mindspore.ops.Heaviside
=======================
.. py:class:: mindspore.ops.Heaviside
计算输入中每个元素的Heaviside步长函数。
.. math::
\text { heaviside }(\text { x, values })=\left\{\begin{array}{ll}
0, & \text { if x }<0 \\
\text { values, } & \text { if x }==0 \\
1, & \text { if x }>0
\end{array}\right.
输入:
- **x** (Tensor) - 输入Tensor实数类型。
- **values** (Tensor) - 在 `x` 中为0的位置应用其值。 `values` 可以同 `x` 进行广播。 `x``values` 的数据类型应该相同。
输出:
Tensor`x``values` 的数据类型相同。
异常:
- **TypeError** - 如果 `x``values` 不是Tensor。
- **TypeError** - 如果 `x``values` 的数据类型不一致。
- **ValueError** - 如果两个输入的shape之间无法进行广播。