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 742 B

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