megengine.functional.sqrt

sqrt(x)[源代码]

Element-wise sqrt.

实际案例

import numpy as np
from megengine import tensor
import megengine.functional as F

x = tensor(np.arange(0, 6, dtype=np.float32).reshape(2, 3))
out = F.sqrt(x)
print(out.numpy().round(decimals=4))

输出:

[[0.     1.     1.4142]
 [1.7321 2.     2.2361]]
返回类型

Tensor