diff --git a/mindspore/ccsrc/backend/kernel_compiler/gpu/math/broadcast_gpu_kernel.cc b/mindspore/ccsrc/backend/kernel_compiler/gpu/math/broadcast_gpu_kernel.cc index 6109f72e8e6d132f1f26d5efeec0486bcae600ab..850a1c7da43175cc608b89d00826cfbb30d7e2fa 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/gpu/math/broadcast_gpu_kernel.cc +++ b/mindspore/ccsrc/backend/kernel_compiler/gpu/math/broadcast_gpu_kernel.cc @@ -109,6 +109,9 @@ MS_REG_GPU_KERNEL_ONE( BroadcastOpGpuKernel, half) // int32 +MS_REG_GPU_KERNEL_ONE( + Greater, KernelAttr().AddInputAttr(kNumberTypeInt32).AddInputAttr(kNumberTypeInt32).AddOutputAttr(kNumberTypeBool), + BroadcastOpGpuKernel, int) MS_REG_GPU_KERNEL_ONE( Less, KernelAttr().AddInputAttr(kNumberTypeInt32).AddInputAttr(kNumberTypeInt32).AddOutputAttr(kNumberTypeBool), BroadcastOpGpuKernel, int) diff --git a/tests/st/ops/gpu/test_broadcast_op.py b/tests/st/ops/gpu/test_broadcast_op.py index 4681b608b50f0ceb42b478cbf15b4978b09eeda5..6de4c2b1e23c33d68a3033dce2af9da1f33dd2da 100644 --- a/tests/st/ops/gpu/test_broadcast_op.py +++ b/tests/st/ops/gpu/test_broadcast_op.py @@ -43,6 +43,9 @@ def test_nobroadcast(): output_ms = P.Greater()(Tensor(x1_np), Tensor(x2_np)) output_np = x1_np > x2_np assert np.allclose(output_ms.asnumpy(), output_np) + output_ms = P.Greater()(Tensor(x1_np_int32), Tensor(x2_np_int32)) + output_np = x1_np_int32 > x2_np_int32 + assert np.allclose(output_ms.asnumpy(), output_np) output_ms = P.Less()(Tensor(x1_np), Tensor(x2_np)) output_np = x1_np < x2_np @@ -132,6 +135,9 @@ def test_broadcast(): output_ms = P.Greater()(Tensor(x1_np), Tensor(x2_np)) output_np = x1_np > x2_np assert np.allclose(output_ms.asnumpy(), output_np) + output_ms = P.Greater()(Tensor(x1_np_int32), Tensor(x2_np_int32)) + output_np = x1_np_int32 > x2_np_int32 + assert np.allclose(output_ms.asnumpy(), output_np) output_ms = P.Less()(Tensor(x1_np), Tensor(x2_np)) output_np = x1_np < x2_np @@ -175,6 +181,9 @@ def test_broadcast_diff_dims(): output_ms = P.Maximum()(Tensor(x1_np), Tensor(x2_np)) output_np = np.maximum(x1_np, x2_np) assert np.allclose(output_ms.asnumpy(), output_np) + output_ms = P.Greater()(Tensor(x1_np_int32), Tensor(x2_np_int32)) + output_np = x1_np_int32 > x2_np_int32 + assert np.allclose(output_ms.asnumpy(), output_np) output_ms = P.Greater()(Tensor(x1_np), Tensor(x2_np)) output_np = x1_np > x2_np