mindspore.ops.EqualCount
- class mindspore.ops.EqualCount(*args, **kwargs)[source]
Computes the number of the same elements of two tensors.
The two input tensors must have the same data type and shape.
- Inputs:
input_x (Tensor) - The first input tensor.
input_y (Tensor) - The second input tensor.
- Outputs:
Tensor, with the type same as input tensor and size as (1,).
- Raises
TypeError – If input_x or input_y is not a Tensor.
ValueError – If shape of input_x is not equal to shape of input_y.
- Supported Platforms:
GPU
CPU
Examples
>>> input_x = Tensor(np.array([1, 2, 3]), mindspore.int32) >>> input_y = Tensor(np.array([1, 2, 4]), mindspore.int32) >>> equal_count = ops.EqualCount() >>> output = equal_count(input_x, input_y) >>> print(output) [2]