mindspore.ops.SquareSumAll

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

Returns the square sum of a tensor element-wise

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

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

Note

SquareSumAll only supports float16 and float32 data type.

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

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

Raises
  • TypeError – If neither input_x1 nor input_x2 is a Tensor.

  • ValueError – If input_x1 and input_x2 are not the same shape.

Supported Platforms:

Ascend GPU

Examples

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