mindspore.ops.Sqrt
- class mindspore.ops.Sqrt[source]
Returns square root of a tensor element-wise.
Note
When there are some negative number, it will return a Tensor whose specific position is nan.
\[out_{i} = \sqrt{x_{i}}\]- Inputs:
x (Tensor) - The input tensor with a dtype of Number, its rank must be in [0, 7] inclusive.
- Outputs:
Tensor, has the same shape and data type as the x.
- Raises
TypeError – If x is not a Tensor.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> x = Tensor(np.array([1.0, 4.0, 9.0]), mindspore.float32) >>> sqrt = ops.Sqrt() >>> output = sqrt(x) >>> print(output) [1. 2. 3.]