mindspore.ops.SquareSumAll

class mindspore.ops.SquareSumAll(*args, **kwargs)[source]

Returns the square sum of a tensor element-wise

Inputs:
  • x1 (Tensor) - The input tensor. The data type must be float16 or float32.

  • x2 (Tensor) - The input tensor has the same type and shape as the x1.

Note

SquareSumAll only supports float16 and float32 data type.

Outputs:
  • output_y1 (Tensor) - The same type as the x1.

  • output_y2 (Tensor) - The same type as the x1.

Raises
  • TypeError – If neither x1 nor x2 is a Tensor.

  • ValueError – If x1 and x2 are not the same shape.

Supported Platforms:

Ascend GPU

Examples

>>> x1 = Tensor(np.array([0, 0, 2, 0]), mindspore.float32)
>>> x2 = Tensor(np.array([0, 0, 2, 4]), mindspore.float32)
>>> square_sum_all = ops.SquareSumAll()
>>> output = square_sum_all(x1, x2)
>>> print(output)
(Tensor(shape=[], dtype=Float32, value= 4),
 Tensor(shape=[], dtype=Float32, value= 20))