You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

mindspore.ops.Inv.rst 774 B

12345678910111213141516171819202122232425262728293031323334
  1. mindspore.ops.Inv
  2. =================
  3. .. py:class:: mindspore.ops.Inv(*args, **kwargs)
  4. 按元素计算输入Tensor的倒数。
  5. .. math::
  6. out_i = \frac{1}{x_{i} }
  7. **输入:**
  8. **x** (Tensor) - shape为 :math:`(N,*)` 的Tensor,其中 :math:`*` 表示任意的附加维度数。数据类型必须是float16、float32或int32。
  9. **输出:**
  10. Tensor,shape和数据类型与 `x` 相同。
  11. **异常:**
  12. **TypeError** - `x` 的数据类型不是float16、float32或int32。
  13. **支持平台:**
  14. ``Ascend``
  15. **样例:**
  16. >>> inv = ops.Inv()
  17. >>> x = Tensor(np.array([0.25, 0.4, 0.31, 0.52]), mindspore.float32)
  18. >>> output = inv(x)
  19. >>> print(output)
  20. [4. 2.5 3.2258065 1.923077 ]