2022-04-16 17:16:29 +08:00
|
|
|
|
mindspore.ops.neg
|
|
|
|
|
|
===================
|
|
|
|
|
|
|
|
|
|
|
|
.. py:function:: mindspore.ops.neg(x)
|
|
|
|
|
|
|
|
|
|
|
|
计算输入x的相反数并返回。
|
|
|
|
|
|
|
|
|
|
|
|
.. math::
|
|
|
|
|
|
out_{i} = - x_{i}
|
|
|
|
|
|
|
2022-07-25 17:18:38 +08:00
|
|
|
|
参数:
|
2022-12-09 11:45:51 +08:00
|
|
|
|
- **x** (Tensor) - Neg的输入Tensor,其秩应在[0, 7]范围内,数据类型为数值型。
|
2022-04-16 17:16:29 +08:00
|
|
|
|
|
2022-07-25 17:18:38 +08:00
|
|
|
|
返回:
|
2022-12-09 11:45:51 +08:00
|
|
|
|
Tensor,shape和数据类型与输入相同。
|
2022-04-16 17:16:29 +08:00
|
|
|
|
|
2022-07-25 17:18:38 +08:00
|
|
|
|
异常:
|
2022-12-09 11:45:51 +08:00
|
|
|
|
- **TypeError** - `x` 不是Tensor。
|