mindspore.ops.SquareSumAll
- class mindspore.ops.SquareSumAll[源代码]
计算输入Tensor的平方和。
说明
SquareSumAll只支持float16和float32类型的输入值。
- 输入:
x (Tensor) - SquareSumAll的输入,其数据类型为数值型,shape:
,其中 表示任意数量的附加维度。y (Tensor) - 数据类型和shape与 x 相同。
- 输出:
output_x (Tensor) - 数据类型与 x 相同。
output_y (Tensor) - 数据类型与 x 相同。
- 异常:
TypeError - 如果 x 或 y 不是Tensor。
ValueError - 如果 x 与 y 的shape不一致。
- 支持平台:
Ascend
GPU
CPU
样例:
>>> import numpy as np >>> import mindspore >>> from mindspore import ops >>> from mindspore import Tensor >>> x = Tensor(np.array([0, 0, 2, 0]), mindspore.float32) >>> y = Tensor(np.array([0, 0, 2, 4]), mindspore.float32) >>> square_sum_all = ops.SquareSumAll() >>> output = square_sum_all(x, y) >>> print(output) (Tensor(shape=[], dtype=Float32, value= 4), Tensor(shape=[], dtype=Float32, value= 20))