mindspore.ops.sqrt
- mindspore.ops.sqrt(x)[source]
Returns sqrt of a tensor element-wise.
\[out_{i} = \sqrt{x_{i}}\]- Parameters
x (Tensor) – The input tensor with a dtype of number.Number.
- Returns
Tensor, has the same shape and dtype as the x.
- Raises
TypeError – If x is not a Tensor.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore >>> import numpy as np >>> from mindspore import Tensor, ops >>> x = Tensor(np.array([1.0, 4.0, 9.0]), mindspore.float32) >>> output = ops.sqrt(x) >>> print(output) [1. 2. 3.]