逐元素计算tensor的平方。
input (Tensor) - 输入tensor。
Tensor。
Ascend GPU CPU
Ascend
GPU
CPU
样例:
>>> import mindspore >>> input = mindspore.tensor([1.0, 2.0, 3.0], mindspore.float32) >>> output = mindspore.ops.square(input) >>> print(output) [1. 4. 9.]