mindspore.ops.sqrt

View Source On Gitee
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 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.]