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:
x (Tensor) - The first input tensor.
y (Tensor) - The second input tensor.
- Outputs:
Tensor, with the type same as input tensor and size as (1,).
- Raises
TypeError – If x or y is not a Tensor.
ValueError – If shape of x is not equal to shape of y.
- Supported Platforms:
GPU
CPU
Examples
>>> x = Tensor(np.array([1, 2, 3]), mindspore.int32) >>> y = Tensor(np.array([1, 2, 4]), mindspore.int32) >>> equal_count = ops.EqualCount() >>> output = equal_count(x, y) >>> print(output) [2]