diff --git a/onnxruntime/core/providers/cpu/cpu_execution_provider.cc b/onnxruntime/core/providers/cpu/cpu_execution_provider.cc index 6adbf5f00d..8c4e30847c 100644 --- a/onnxruntime/core/providers/cpu/cpu_execution_provider.cc +++ b/onnxruntime/core/providers/cpu/cpu_execution_provider.cc @@ -404,6 +404,7 @@ class ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kOnnxDomain, 11, Sp class ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kOnnxDomain, 11, ScatterND); class ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kOnnxDomain, 11, Gemm); class ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kOnnxDomain, 11, GatherElements); +class ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME(kCpuExecutionProvider, kOnnxDomain, 11, uint8_t, BitShift); class ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME(kCpuExecutionProvider, kOnnxDomain, 11, uint32_t, BitShift); class ONNX_OPERATOR_TYPED_KERNEL_CLASS_NAME(kCpuExecutionProvider, kOnnxDomain, 11, uint64_t, BitShift); class ONNX_OPERATOR_KERNEL_CLASS_NAME(kCpuExecutionProvider, kOnnxDomain, 11, Pad); @@ -828,25 +829,25 @@ Status RegisterOnnxOperatorKernels(KernelRegistry& kernel_registry) { BuildKernelCreateInfo, BuildKernelCreateInfo, BuildKernelCreateInfo, + int64_t_int64_t_int64_t, OneHot)>, BuildKernelCreateInfo, - BuildKernelCreateInfo, + float_int64_t_int64_t, OneHot)>, BuildKernelCreateInfo, + int64_t_string_int64_t, OneHot)>, BuildKernelCreateInfo, + float_string_int64_t, OneHot)>, BuildKernelCreateInfo, + float_float_float, OneHot)>, BuildKernelCreateInfo, + int64_t_int32_t_float, OneHot)>, BuildKernelCreateInfo, + int64_t_float_int64_t, OneHot)>, BuildKernelCreateInfo, + int32_t_float_int32_t, OneHot)>, BuildKernelCreateInfo, + int32_t_float_float, OneHot)>, + BuildKernelCreateInfo, BuildKernelCreateInfo, BuildKernelCreateInfo, @@ -911,11 +912,11 @@ Status RegisterOnnxOperatorKernels(KernelRegistry& kernel_registry) { AveragePool)>, BuildKernelCreateInfo, BuildKernelCreateInfo, + Resize)>, BuildKernelCreateInfo, + Resize)>, BuildKernelCreateInfo, + Resize)>, BuildKernelCreateInfo, BuildKernelCreateInfo, @@ -1055,6 +1056,7 @@ Status RegisterOnnxOperatorKernels(KernelRegistry& kernel_registry) { BuildKernelCreateInfo, BuildKernelCreateInfo, BuildKernelCreateInfo, + BuildKernelCreateInfo, BuildKernelCreateInfo, BuildKernelCreateInfo, BuildKernelCreateInfo, @@ -1080,13 +1082,13 @@ Status RegisterOnnxOperatorKernels(KernelRegistry& kernel_registry) { int32_t_float_int32_t, OneHot)>, BuildKernelCreateInfo, - BuildKernelCreateInfo, - BuildKernelCreateInfo, - BuildKernelCreateInfo, - BuildKernelCreateInfo, }; @@ -1259,7 +1261,7 @@ static Status RegisterCPUKernels(KernelRegistry& kernel_registry) { return Status::OK(); } -struct KernelRegistryAndStatus{ +struct KernelRegistryAndStatus { std::shared_ptr kernel_registry = std::make_shared(); Status st; }; diff --git a/onnxruntime/core/providers/cpu/math/element_wise_ops.cc b/onnxruntime/core/providers/cpu/math/element_wise_ops.cc index 93c37c53ec..e25d39fb52 100644 --- a/onnxruntime/core/providers/cpu/math/element_wise_ops.cc +++ b/onnxruntime/core/providers/cpu/math/element_wise_ops.cc @@ -129,7 +129,7 @@ REG_ELEMENTWISE_LOGICALOP_TYPED_KERNEL(Equal, 11, float, Equal); REG_ELEMENTWISE_VERSIONED_TYPED_KERNEL(Mean, 6, 7, float, Mean_6); REG_ELEMENTWISE_TYPED_KERNEL(Mean, 8, float, Mean_8); -//REG_ELEMENTWISE_TYPED_KERNEL(BitShift, 11, uint8_t, BitShift); +REG_ELEMENTWISE_TYPED_KERNEL(BitShift, 11, uint8_t, BitShift); //REG_ELEMENTWISE_TYPED_KERNEL(BitShift, 11, uint16_t, BitShift); REG_ELEMENTWISE_TYPED_KERNEL(BitShift, 11, uint32_t, BitShift); REG_ELEMENTWISE_TYPED_KERNEL(BitShift, 11, uint64_t, BitShift); diff --git a/onnxruntime/test/onnx/main.cc b/onnxruntime/test/onnx/main.cc index 720ddbb29d..4f5d2c3c93 100644 --- a/onnxruntime/test/onnx/main.cc +++ b/onnxruntime/test/onnx/main.cc @@ -433,9 +433,7 @@ int real_main(int argc, char* argv[], Ort::Env& env) { {"resize_upsample_sizes_nearest_ceil_half_pixel", "Bad onnx test output. Needs test fix."}, {"resize_upsample_sizes_nearest_floor_align_corners", "Bad onnx test output. Needs test fix."}, {"resize_upsample_sizes_nearest_round_prefer_ceil_asymmetric", "Bad onnx test output. Needs test fix."}, - {"bitshift_right_uint8", "BitShift(11) uint8 support not enabled currently"}, {"bitshift_right_uint16", "BitShift(11) uint16 support not enabled currently"}, - {"bitshift_left_uint8", "BitShift(11) uint8 support not enabled currently"}, {"bitshift_left_uint16", "BitShift(11) uint16 support not enabled currently"}, {"reflect_pad", "Pad(11) int32 support not enabled currently"}, {"edge_pad", "Pad(11) int32 support not enabled currently"}, diff --git a/onnxruntime/test/providers/cpu/math/element_wise_ops_test.cc b/onnxruntime/test/providers/cpu/math/element_wise_ops_test.cc index 96b40f80c1..b7bad10ef7 100644 --- a/onnxruntime/test/providers/cpu/math/element_wise_ops_test.cc +++ b/onnxruntime/test/providers/cpu/math/element_wise_ops_test.cc @@ -401,7 +401,7 @@ TEST(MathOpTest, Abs_int8) { std::vector dims{4}; test.AddInput("X", dims, {1, 2, -1, -5}); test.AddOutput("Y", dims, {1, 2, 1, 5}); - test.Run(OpTester::ExpectResult::kExpectSuccess, "", {kTensorrtExecutionProvider}); //TensorRT: INT8, Assertion `regionRanges != nullptr' failed + test.Run(OpTester::ExpectResult::kExpectSuccess, "", {kTensorrtExecutionProvider}); //TensorRT: INT8, Assertion `regionRanges != nullptr' failed } TEST(MathOpTest, Abs_int32) { @@ -429,7 +429,7 @@ TEST(MathOpTest, Neg_int8) { std::vector dims{4}; test.AddInput("X", dims, {1, -2, 0, -10}); test.AddOutput("Y", dims, {-1, 2, 0, 10}); - test.Run(OpTester::ExpectResult::kExpectSuccess, "", {kTensorrtExecutionProvider}); //TensorRT: INT8 is not supported + test.Run(OpTester::ExpectResult::kExpectSuccess, "", {kTensorrtExecutionProvider}); //TensorRT: INT8 is not supported } TEST(MathOpTest, Neg_int32) { @@ -1628,5 +1628,23 @@ TEST(BitShiftOpTest, BroadcastXRight) { test.Run(); } +TEST(BitShiftOpTest, BroadcastYLeft_Uint8) { + OpTester test("BitShift", 11); + test.AddAttribute("direction", "LEFT"); + test.AddInput("X", {3, 2}, {1, 2, 3, 4, 5, 6}); + test.AddInput("Y", {2}, {1, 2}); + test.AddOutput("Z", {3, 2}, {2, 8, 6, 16, 10, 24}); + test.Run(); +} + +TEST(BitShiftOpTest, BroadcastXRight_Uint8) { + OpTester test("BitShift", 11); + test.AddAttribute("direction", "RIGHT"); + test.AddInput("X", {2}, {64, 32}); + test.AddInput("Y", {3, 2}, {1, 2, 3, 4, 5, 6}); + test.AddOutput("Z", {3, 2}, {32, 8, 8, 2, 2, 0}); + test.Run(); +} + } // namespace test } // namespace onnxruntime diff --git a/onnxruntime/test/python/onnx_backend_test_series.py b/onnxruntime/test/python/onnx_backend_test_series.py index 7a4ef79d83..7d9b8219b6 100644 --- a/onnxruntime/test/python/onnx_backend_test_series.py +++ b/onnxruntime/test/python/onnx_backend_test_series.py @@ -93,9 +93,7 @@ def other_tests_failing_permanently_filters(): def test_with_types_disabled_due_to_binary_size_concerns_filters(): filters = ['^test_bitshift_right_uint16_cpu', - '^test_bitshift_right_uint8_cpu', '^test_bitshift_left_uint16_cpu', - '^test_bitshift_left_uint8_cpu', '^test_edge_pad_cpu', '^test_reflect_pad_cpu']