mindspore.ops.Sqrt

class mindspore.ops.Sqrt[source]

Returns square root of a tensor element-wise.

\[out_{i} = \sqrt{x_{i}}\]
Inputs:
  • x (Tensor) - The input tensor whose dtype is number. \((N,*)\) where \(*\) means ,any number of additional dimensions, its rank should less than 8.

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.]
infer_value(x)[source]

Infer the value of input for Sqrt.