API 相关说明
逐元素取平方。
实际案例
import numpy as np import megengine as mge import megengine.functional as F data = mge.tensor(np.arange(0, 6, dtype=np.float32).reshape(2, 3)) out = F.square(data) print(out.numpy().round(decimals=4))
输出:
[[ 0. 1. 4.] [ 9. 16. 25.]]
Tensor
上一页
megengine.functional.sqrt
下一页
megengine.functional.maximum