mindspore/docs/api/api_python/ops/mindspore.ops.ApproximateEq...

34 lines
1.3 KiB
ReStructuredText
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.ops.ApproximateEqual
==============================
.. py:class:: mindspore.ops.ApproximateEqual(tolerance=1e-05)
逐元素计算abs(x-y)如果小于tolerance则为True否则为False。
.. math::
out_i = \begin{cases}
& \text{ if } \left | x_{i} - y_{i} \right | < \text{tolerance},\ \ True \\
& \text{ if } \left | x_{i} - y_{i} \right | \ge \text{tolerance},\ \ False
\end{cases}
`tolerance` 为相等的两元素间最大偏差。
输入 `x``y` 会通过隐式数据类型转换使数据类型保持一致。如果数据类型不同,低精度的数据类型会被自动转换到高精度的数据类型。
**参数:**
- **tolerance** (float) - 两元素可被视为相等的最大偏差。 默认值1e-05。
**输入:**
- **x** (Tensor) - 输入Tensor需为以下数据类型float16float32。shape: :math:`(N,*)` ,其中 :math:`*` 表示任何数量的附加维度。其秩应小于8。
- **y** (Tensor) - 输入Tensorshape与数据类型与 `x` 相同。
**输出:**
Tensorshape与 `x` 相同bool类型。
**异常:**
- **TypeError** - `tolerance` 不是float类型。
- **RuntimeError** - `variable``value` 之间的类型转换不被支持。