From daebf973e0f82f67ef9e25b948b12aa03ea4010c Mon Sep 17 00:00:00 2001 From: jdanieck Date: Fri, 14 May 2021 18:17:33 +0200 Subject: [PATCH 01/12] Add initial version of u1 type support. --- .../ngraph/runtime/reference/convert.hpp | 53 ++++++++++++++++++ ngraph/core/src/op/convert.cpp | 32 ++++++++--- ngraph/test/backend/convert.in.cpp | 56 ++++++++++++++----- 3 files changed, 119 insertions(+), 22 deletions(-) diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp b/ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp index 8591f88c79457c..1084110f37704c 100644 --- a/ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp +++ b/ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp @@ -6,6 +6,7 @@ #include +#include "ngraph/type/element_type.hpp" #include "ngraph/type/float16.hpp" namespace ngraph @@ -14,6 +15,58 @@ namespace ngraph { namespace reference { + namespace detail + { + inline void set_bit(uint8_t* buf, size_t idx) + { + const int byte_idx = idx / 8; + const int bit_idx = 7 - (idx % 8); + buf[byte_idx] |= (1 << bit_idx); + } + + inline uint8_t get_bit(const uint8_t* buf, size_t idx) + { + const int byte_idx = idx / 8; + const int bit_idx = 7 - (idx % 8); + return buf[byte_idx] & (1 << bit_idx); + } + } // namespace detail + + template + void convert(const TI* arg, + TO* out, + size_t count, + element::Type_t src_type, + element::Type_t dst_type) + { + std::memset(out, 0, count * sizeof(TO)); + + if (dst_type == element::u1) + { + for (size_t i = 0; i < count; ++i) + { + if (arg[i]) + { + detail::set_bit(reinterpret_cast(out), i); + } + } + } + else if (src_type == element::u1) + { + for (size_t i = 0; i < count; ++i) + { + if (detail::get_bit(reinterpret_cast(arg), i)) + { + out[i] = static_cast(1); + } + } + } + else + { + NGRAPH_CHECK(false, "Unimplemented"); + } + } + template typename std::enable_if::value>::type convert(const TI* arg, TO* out, size_t count) diff --git a/ngraph/core/src/op/convert.cpp b/ngraph/core/src/op/convert.cpp index 8999113ba08133..b835833b720510 100644 --- a/ngraph/core/src/op/convert.cpp +++ b/ngraph/core/src/op/convert.cpp @@ -30,15 +30,13 @@ void op::Convert::validate_and_infer_types() const element::Type destination_et = m_destination_type; NODE_VALIDATION_CHECK(this, - data_et != element::u1 && data_et != element::u4 && - data_et != element::i4, + data_et != element::u4 && data_et != element::i4, "Input element type '", data_et, "' is not supported."); NODE_VALIDATION_CHECK(this, - destination_et != element::u1 && destination_et != element::u4 && - destination_et != element::i4, + destination_et != element::u4 && destination_et != element::i4, "Destination element type '", destination_et, "' is not supported."); @@ -68,10 +66,26 @@ namespace convert { out->set_shape(arg->get_shape()); size_t element_count = shape_size(out->get_shape()); - return (INPUT_ET == arg->get_element_type()) && OUTPUT_ET == out->get_element_type() && - (runtime::reference::convert( - arg->get_data_ptr(), out->get_data_ptr(), element_count), - true); + + if ((INPUT_ET != arg->get_element_type()) || OUTPUT_ET != out->get_element_type()) + { + return false; + } + const std::unordered_set lp_types{element::u1}; + if ((lp_types.count(INPUT_ET) || (lp_types.count(OUTPUT_ET)))) + { + runtime::reference::convert(arg->get_data_ptr(), + out->get_data_ptr(), + element_count, + INPUT_ET, + OUTPUT_ET); + } + else + { + runtime::reference::convert( + arg->get_data_ptr(), out->get_data_ptr(), element_count); + } + return true; } #define TYPE_OUT_CASE(a, ...) \ @@ -93,6 +107,7 @@ namespace convert TYPE_OUT_CASE(i16, arg, out); TYPE_OUT_CASE(i32, arg, out); TYPE_OUT_CASE(i64, arg, out); + TYPE_OUT_CASE(u1, arg, out); TYPE_OUT_CASE(u8, arg, out); TYPE_OUT_CASE(u16, arg, out); TYPE_OUT_CASE(u32, arg, out); @@ -112,6 +127,7 @@ namespace convert bool rc = true; switch (arg->get_element_type()) { + NGRAPH_TYPE_CASE(evaluate_convert, u1, arg, out); NGRAPH_TYPE_CASE(evaluate_convert, u8, arg, out); NGRAPH_TYPE_CASE(evaluate_convert, i8, arg, out); NGRAPH_TYPE_CASE(evaluate_convert, i32, arg, out); diff --git a/ngraph/test/backend/convert.in.cpp b/ngraph/test/backend/convert.in.cpp index 46159d0cbc2e40..4656644416a06d 100644 --- a/ngraph/test/backend/convert.in.cpp +++ b/ngraph/test/backend/convert.in.cpp @@ -23,6 +23,15 @@ static string s_manifest = "${MANIFEST}"; using TestEngine = test::ENGINE_CLASS_NAME(${BACKEND_NAME}); namespace { + std::shared_ptr CreateFunction(const Shape& input_shape, + const element::Type& input_type, + const element::Type& expected_output_type) + { + const auto in = make_shared(input_type, input_shape); + const auto convert = make_shared(in, expected_output_type); + return make_shared(NodeVector{convert}, ParameterVector{in}); + } + template void ConvertTest(const std::vector& input, const Shape& input_shape, @@ -30,10 +39,7 @@ namespace const std::vector& expected_output, const ngraph::element::Type& expected_output_type) { - const auto in = make_shared(input_type, input_shape); - const auto convert = make_shared(in, expected_output_type); - const auto f = make_shared(NodeVector{convert}, ParameterVector{in}); - + const auto f = CreateFunction(input_shape, input_type, expected_output_type); auto test_case = test::TestCase(f); test_case.add_input(input); test_case.add_expected_output(expected_output); @@ -180,17 +186,28 @@ NGRAPH_TEST(${BACKEND_NAME}, convert_i64_to_f32) ConvertTest(input, input_shape, input_type, expected_output, expected_output_type); } -NGRAPH_TEST(${BACKEND_NAME}, convert_u1_to_f32_is_not_supported_yet) +NGRAPH_TEST(${BACKEND_NAME}, convert_u1_to_f32) { - const std::vector input{0x00}; + const std::vector input{0xA0}; const Shape input_shape{2, 2}; const element::Type input_type = ngraph::element::u1; - const std::vector expected_output{0.0f, 0.0f, 0.0f, 0.0f}; + const std::vector expected_output{1.0f, 0.0f, 1.0f, 0.0f}; const element::Type expected_output_type = ngraph::element::f32; - ASSERT_THROW(ConvertTest(input, input_shape, input_type, expected_output, expected_output_type), - ngraph::NodeValidationFailure); + { + const auto f = CreateFunction(input_shape, input_type, expected_output_type); + auto backend = runtime::Backend::create("${BACKEND_NAME}"); + auto input_tesnor = backend->create_tensor(input_type, input_shape); + copy_data(input_tesnor, input); + auto output = backend->create_tensor(expected_output_type, input_shape); + auto handle = backend->compile(f); + handle->call_with_validate({output}, {input_tesnor}); + + std::vector result(expected_output.size()); + output->read(result.data(), result.size() * sizeof(float)); + EXPECT_TRUE(test::all_close_f(expected_output, result)); + } } NGRAPH_TEST(${BACKEND_NAME}, convert_u4_to_f32_is_not_supported_yet) @@ -361,17 +378,28 @@ NGRAPH_TEST(${BACKEND_NAME}, convert_u8_to_i64) } // destination: u1 -NGRAPH_TEST(${BACKEND_NAME}, convert_u8_to_u1_is_not_supported_yet) +NGRAPH_TEST(${BACKEND_NAME}, convert_u8_to_u1) { - const std::vector input{0, 0, 0, 0}; + const std::vector input{1, 0, 1, 0}; const Shape input_shape{4}; const element::Type input_type = ngraph::element::u8; - const std::vector expected_output{0x00}; + const std::vector expected_output{0xA0}; const element::Type expected_output_type = ngraph::element::u1; - ASSERT_THROW(ConvertTest(input, input_shape, input_type, expected_output, expected_output_type), - ngraph::NodeValidationFailure); + { + const auto f = CreateFunction(input_shape, input_type, expected_output_type); + auto backend = runtime::Backend::create("${BACKEND_NAME}"); + auto input_tesnor = backend->create_tensor(input_type, input_shape); + copy_data(input_tesnor, input); + auto output = backend->create_tensor(expected_output_type, input_shape); + auto handle = backend->compile(f); + handle->call_with_validate({output}, {input_tesnor}); + + std::vector result(expected_output.size()); + output->read(result.data(), result.size() * sizeof(uint8_t)); + EXPECT_TRUE(test::all_close(expected_output, result)); + } } // destination: u4 From b85d80d625508617c11eae22af43888e91eb6d35 Mon Sep 17 00:00:00 2001 From: jdanieck Date: Mon, 17 May 2021 09:40:21 +0200 Subject: [PATCH 02/12] Turn off u8_to_u1 test in IE.CPU. --- ngraph/test/runtime/ie/unit_test.manifest | 1 + 1 file changed, 1 insertion(+) diff --git a/ngraph/test/runtime/ie/unit_test.manifest b/ngraph/test/runtime/ie/unit_test.manifest index 9e8bb87ca58ac2..403abb2d5ce84e 100644 --- a/ngraph/test/runtime/ie/unit_test.manifest +++ b/ngraph/test/runtime/ie/unit_test.manifest @@ -1056,6 +1056,7 @@ IE_CPU.convert_f16_to_f32 IE_CPU.convert_u8_to_f16 IE_CPU.convert_u8_to_i16 IE_CPU.convert_u8_to_i64 +IE_CPU.convert_u8_to_u1 IE_CPU.convert_u8_to_u16 IE_CPU.convert_u8_to_u32 IE_CPU.convert_u8_to_u64 From 016d3c2df168c5fe454f79b14a09070c4380f25a Mon Sep 17 00:00:00 2001 From: jdanieck Date: Mon, 17 May 2021 10:37:07 +0200 Subject: [PATCH 03/12] Fix compilation issue. --- ngraph/core/src/op/convert.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ngraph/core/src/op/convert.cpp b/ngraph/core/src/op/convert.cpp index b835833b720510..dcd2f7f4d018bc 100644 --- a/ngraph/core/src/op/convert.cpp +++ b/ngraph/core/src/op/convert.cpp @@ -71,8 +71,7 @@ namespace convert { return false; } - const std::unordered_set lp_types{element::u1}; - if ((lp_types.count(INPUT_ET) || (lp_types.count(OUTPUT_ET)))) + if ((INPUT_ET == element::u1) || (OUTPUT_ET == element::u1)) { runtime::reference::convert(arg->get_data_ptr(), out->get_data_ptr(), From cfa513e04d5fcc66dcd9abf83fe0177ec4fdd6d9 Mon Sep 17 00:00:00 2001 From: jdanieck Date: Mon, 17 May 2021 11:51:32 +0200 Subject: [PATCH 04/12] Replace std::memset with std::fill. --- .../reference/include/ngraph/runtime/reference/convert.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp b/ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp index ce771693e680ca..5d1b3d2e0ec3cc 100644 --- a/ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp +++ b/ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp @@ -39,8 +39,7 @@ namespace ngraph element::Type_t src_type, element::Type_t dst_type) { - std::memset(out, 0, count * sizeof(TO)); - + std::fill(out, out + count, 0); if (dst_type == element::u1) { for (size_t i = 0; i < count; ++i) From 8204c1f54bdb83e1e939ef751e5af2bbd0d9920f Mon Sep 17 00:00:00 2001 From: jdanieck Date: Mon, 17 May 2021 15:43:29 +0200 Subject: [PATCH 05/12] Add u4 type support. --- .../ngraph/runtime/reference/convert.hpp | 41 +++++++++++++++--- ngraph/core/src/op/convert.cpp | 14 +++---- ngraph/test/backend/convert.in.cpp | 42 ++++++++++++++----- ngraph/test/runtime/ie/unit_test.manifest | 1 + 4 files changed, 75 insertions(+), 23 deletions(-) diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp b/ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp index 5d1b3d2e0ec3cc..077d1f46f9cf06 100644 --- a/ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp +++ b/ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp @@ -17,19 +17,34 @@ namespace ngraph { namespace detail { - inline void set_bit(uint8_t* buf, size_t idx) + inline void set_u1(uint8_t* buf, size_t idx) { const int byte_idx = idx / 8; const int bit_idx = 7 - (idx % 8); buf[byte_idx] |= (1 << bit_idx); } - inline uint8_t get_bit(const uint8_t* buf, size_t idx) + inline uint8_t get_u1(const uint8_t* buf, size_t idx) { const int byte_idx = idx / 8; const int bit_idx = 7 - (idx % 8); return buf[byte_idx] & (1 << bit_idx); } + + inline void set_u4(uint8_t* buf, size_t idx, uint8_t val) + { + const int byte_idx = idx / 2; + const int bit_shift = 4 * (++idx % 2); + buf[byte_idx] &= ~(0xF << bit_shift); // half byte zeroed + buf[byte_idx] |= (val << bit_shift); // set 1's + } + + inline uint8_t get_u4(const uint8_t* buf, size_t idx) + { + const int byte_idx = idx / 2; + const int bit_shift = 4 * (++idx % 2); + return (buf[byte_idx] >> bit_shift) & 0xF; + } } // namespace detail template @@ -40,26 +55,40 @@ namespace ngraph element::Type_t dst_type) { std::fill(out, out + count, 0); - if (dst_type == element::u1) + if (dst_type == element::u1) // TODO: fix for LP source types { for (size_t i = 0; i < count; ++i) { if (arg[i]) { - detail::set_bit(reinterpret_cast(out), i); + detail::set_u1(reinterpret_cast(out), i); } } } - else if (src_type == element::u1) + else if (src_type == element::u1) // TODO: fix for LP dst types { for (size_t i = 0; i < count; ++i) { - if (detail::get_bit(reinterpret_cast(arg), i)) + if (detail::get_u1(reinterpret_cast(arg), i)) { out[i] = static_cast(1); } } } + else if (dst_type == element::u4) // TODO: fix for LP source types + { + for (size_t i = 0; i < count; ++i) + { + detail::set_u4(reinterpret_cast(out), i, arg[i]); + } + } + else if (src_type == element::u4) // TODO: fix for LP dst types + { + for (size_t i = 0; i < count; ++i) + { + out[i] = detail::get_u4(reinterpret_cast(arg), i); + } + } else { NGRAPH_CHECK(false, "Unimplemented"); diff --git a/ngraph/core/src/op/convert.cpp b/ngraph/core/src/op/convert.cpp index dcd2f7f4d018bc..ff3c9b3472b99b 100644 --- a/ngraph/core/src/op/convert.cpp +++ b/ngraph/core/src/op/convert.cpp @@ -29,14 +29,11 @@ void op::Convert::validate_and_infer_types() const element::Type data_et = get_input_element_type(0); const element::Type destination_et = m_destination_type; - NODE_VALIDATION_CHECK(this, - data_et != element::u4 && data_et != element::i4, - "Input element type '", - data_et, - "' is not supported."); + NODE_VALIDATION_CHECK( + this, data_et != element::i4, "Input element type '", data_et, "' is not supported."); NODE_VALIDATION_CHECK(this, - destination_et != element::u4 && destination_et != element::i4, + destination_et != element::i4, "Destination element type '", destination_et, "' is not supported."); @@ -71,7 +68,8 @@ namespace convert { return false; } - if ((INPUT_ET == element::u1) || (OUTPUT_ET == element::u1)) + if (((INPUT_ET == element::u1) || (OUTPUT_ET == element::u1)) || + ((INPUT_ET == element::u4) || (OUTPUT_ET == element::u4))) { runtime::reference::convert(arg->get_data_ptr(), out->get_data_ptr(), @@ -107,6 +105,7 @@ namespace convert TYPE_OUT_CASE(i32, arg, out); TYPE_OUT_CASE(i64, arg, out); TYPE_OUT_CASE(u1, arg, out); + TYPE_OUT_CASE(u4, arg, out); TYPE_OUT_CASE(u8, arg, out); TYPE_OUT_CASE(u16, arg, out); TYPE_OUT_CASE(u32, arg, out); @@ -127,6 +126,7 @@ namespace convert switch (arg->get_element_type()) { NGRAPH_TYPE_CASE(evaluate_convert, u1, arg, out); + NGRAPH_TYPE_CASE(evaluate_convert, u4, arg, out); NGRAPH_TYPE_CASE(evaluate_convert, u8, arg, out); NGRAPH_TYPE_CASE(evaluate_convert, i8, arg, out); NGRAPH_TYPE_CASE(evaluate_convert, i32, arg, out); diff --git a/ngraph/test/backend/convert.in.cpp b/ngraph/test/backend/convert.in.cpp index f07b278d9b310c..740fdb699f34b5 100644 --- a/ngraph/test/backend/convert.in.cpp +++ b/ngraph/test/backend/convert.in.cpp @@ -210,17 +210,28 @@ NGRAPH_TEST(${BACKEND_NAME}, convert_u1_to_f32) } } -NGRAPH_TEST(${BACKEND_NAME}, convert_u4_to_f32_is_not_supported_yet) +NGRAPH_TEST(${BACKEND_NAME}, convert_u4_to_f32) { - const std::vector input{0x00, 0x00}; + const std::vector input{0xFB, 0x0A}; const Shape input_shape{2, 2}; const element::Type input_type = ngraph::element::u4; - const std::vector expected_output{0.0f, 0.0f, 0.0f, 0.0f}; + const std::vector expected_output{15.0f, 11.0f, 0.0f, 10.0f}; const element::Type expected_output_type = ngraph::element::f32; - ASSERT_THROW(ConvertTest(input, input_shape, input_type, expected_output, expected_output_type), - ngraph::NodeValidationFailure); + { + const auto f = CreateFunction(input_shape, input_type, expected_output_type); + auto backend = runtime::Backend::create("${BACKEND_NAME}"); + auto input_tesnor = backend->create_tensor(input_type, input_shape); + copy_data(input_tesnor, input); + auto output = backend->create_tensor(expected_output_type, input_shape); + auto handle = backend->compile(f); + handle->call_with_validate({output}, {input_tesnor}); + + std::vector result(expected_output.size()); + output->read(result.data(), result.size() * sizeof(float)); + EXPECT_TRUE(test::all_close_f(expected_output, result)); + } } NGRAPH_TEST(${BACKEND_NAME}, convert_u8_to_f32) @@ -403,17 +414,28 @@ NGRAPH_TEST(${BACKEND_NAME}, convert_u8_to_u1) } // destination: u4 -NGRAPH_TEST(${BACKEND_NAME}, convert_u8_to_u4_is_not_supported_yet) +NGRAPH_TEST(${BACKEND_NAME}, convert_u8_to_u4) { - const std::vector input{0, 0, 0, 0}; + const std::vector input{7, 0, 1, 15}; const Shape input_shape{4}; const element::Type input_type = ngraph::element::u8; - const std::vector expected_output{0x00, 0x00}; + const std::vector expected_output{0x70, 0x1F}; const element::Type expected_output_type = ngraph::element::u4; - ASSERT_THROW(ConvertTest(input, input_shape, input_type, expected_output, expected_output_type), - ngraph::NodeValidationFailure); + { + const auto f = CreateFunction(input_shape, input_type, expected_output_type); + auto backend = runtime::Backend::create("${BACKEND_NAME}"); + auto input_tesnor = backend->create_tensor(input_type, input_shape); + copy_data(input_tesnor, input); + auto output = backend->create_tensor(expected_output_type, input_shape); + auto handle = backend->compile(f); + handle->call_with_validate({output}, {input_tesnor}); + + std::vector result(expected_output.size()); + output->read(result.data(), result.size() * sizeof(uint8_t)); + EXPECT_TRUE(test::all_close(expected_output, result)); + } } // destination: u8 diff --git a/ngraph/test/runtime/ie/unit_test.manifest b/ngraph/test/runtime/ie/unit_test.manifest index 4f6f73c635bff3..4e57214a514b1f 100644 --- a/ngraph/test/runtime/ie/unit_test.manifest +++ b/ngraph/test/runtime/ie/unit_test.manifest @@ -1053,6 +1053,7 @@ IE_CPU.convert_u8_to_f16 IE_CPU.convert_u8_to_i16 IE_CPU.convert_u8_to_i64 IE_CPU.convert_u8_to_u1 +IE_CPU.convert_u8_to_u4 IE_CPU.convert_u8_to_u16 IE_CPU.convert_u8_to_u32 IE_CPU.convert_u8_to_u64 From 548ca78bc7bb43a98c54a2772508ef107d821a12 Mon Sep 17 00:00:00 2001 From: jdanieck Date: Mon, 17 May 2021 16:49:05 +0200 Subject: [PATCH 06/12] Add i4 support. --- .../ngraph/runtime/reference/convert.hpp | 34 +++++++++++++++ ngraph/core/src/op/convert.cpp | 16 ++----- ngraph/test/backend/convert.in.cpp | 42 ++++++++++++++----- ngraph/test/runtime/ie/unit_test.manifest | 1 + 4 files changed, 71 insertions(+), 22 deletions(-) diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp b/ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp index 077d1f46f9cf06..f707234ce007b3 100644 --- a/ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp +++ b/ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp @@ -45,6 +45,26 @@ namespace ngraph const int bit_shift = 4 * (++idx % 2); return (buf[byte_idx] >> bit_shift) & 0xF; } + + inline void set_i4(uint8_t* buf, size_t idx, int8_t val) + { + const int byte_idx = idx / 2; + const int bit_shift = 4 * (++idx % 2); + buf[byte_idx] &= ~(0xF << bit_shift); // half byte zeroed + buf[byte_idx] |= (val << bit_shift); // set 1's + } + + inline int8_t get_i4(const uint8_t* buf, size_t idx) + { + const int byte_idx = idx / 2; + const int bit_shift = 4 * (++idx % 2); + uint8_t val = (buf[byte_idx] >> bit_shift) & 0xF; + if (val & 0x08) + { // negative number + val |= 0xF0; + } + return val; + } } // namespace detail template @@ -89,6 +109,20 @@ namespace ngraph out[i] = detail::get_u4(reinterpret_cast(arg), i); } } + else if (dst_type == element::i4) // TODO: fix for LP source types + { + for (size_t i = 0; i < count; ++i) + { + detail::set_i4(reinterpret_cast(out), i, arg[i]); + } + } + else if (src_type == element::i4) // TODO: fix for LP dst types + { + for (size_t i = 0; i < count; ++i) + { + out[i] = detail::get_i4(reinterpret_cast(arg), i); + } + } else { NGRAPH_CHECK(false, "Unimplemented"); diff --git a/ngraph/core/src/op/convert.cpp b/ngraph/core/src/op/convert.cpp index ff3c9b3472b99b..35321cd95da312 100644 --- a/ngraph/core/src/op/convert.cpp +++ b/ngraph/core/src/op/convert.cpp @@ -26,17 +26,6 @@ op::Convert::Convert(const Output& arg, const element::Type& destination_t void op::Convert::validate_and_infer_types() { NGRAPH_OP_SCOPE(v0_Convert_validate_and_infer_types); - const element::Type data_et = get_input_element_type(0); - const element::Type destination_et = m_destination_type; - - NODE_VALIDATION_CHECK( - this, data_et != element::i4, "Input element type '", data_et, "' is not supported."); - - NODE_VALIDATION_CHECK(this, - destination_et != element::i4, - "Destination element type '", - destination_et, - "' is not supported."); set_output_type(0, m_destination_type, get_input_partial_shape(0)); } @@ -69,7 +58,8 @@ namespace convert return false; } if (((INPUT_ET == element::u1) || (OUTPUT_ET == element::u1)) || - ((INPUT_ET == element::u4) || (OUTPUT_ET == element::u4))) + ((INPUT_ET == element::u4) || (OUTPUT_ET == element::u4)) || + ((INPUT_ET == element::i4) || (OUTPUT_ET == element::i4))) { runtime::reference::convert(arg->get_data_ptr(), out->get_data_ptr(), @@ -100,6 +90,7 @@ namespace convert switch (out->get_element_type()) { + TYPE_OUT_CASE(i4, arg, out); TYPE_OUT_CASE(i8, arg, out); TYPE_OUT_CASE(i16, arg, out); TYPE_OUT_CASE(i32, arg, out); @@ -128,6 +119,7 @@ namespace convert NGRAPH_TYPE_CASE(evaluate_convert, u1, arg, out); NGRAPH_TYPE_CASE(evaluate_convert, u4, arg, out); NGRAPH_TYPE_CASE(evaluate_convert, u8, arg, out); + NGRAPH_TYPE_CASE(evaluate_convert, i4, arg, out); NGRAPH_TYPE_CASE(evaluate_convert, i8, arg, out); NGRAPH_TYPE_CASE(evaluate_convert, i32, arg, out); NGRAPH_TYPE_CASE(evaluate_convert, i16, arg, out); diff --git a/ngraph/test/backend/convert.in.cpp b/ngraph/test/backend/convert.in.cpp index 740fdb699f34b5..bf0f169304bd63 100644 --- a/ngraph/test/backend/convert.in.cpp +++ b/ngraph/test/backend/convert.in.cpp @@ -125,17 +125,28 @@ NGRAPH_TEST(${BACKEND_NAME}, convert_u8_to_f16) } // destination: f32 -NGRAPH_TEST(${BACKEND_NAME}, convert_i4_to_f32_is_not_supported_yet) +NGRAPH_TEST(${BACKEND_NAME}, convert_i4_to_f32) { - const std::vector input{0x00, 0x00}; + const std::vector input{0xFE, 0xF2}; const Shape input_shape{2, 2}; const element::Type input_type = ngraph::element::i4; - const std::vector expected_output{0.0f, 0.0f, 0.0f, 0.0f}; + const std::vector expected_output{-1.0f, -2.0f, -1.0f, 2.0f}; const element::Type expected_output_type = ngraph::element::f32; - ASSERT_THROW(ConvertTest(input, input_shape, input_type, expected_output, expected_output_type), - ngraph::NodeValidationFailure); + { + const auto f = CreateFunction(input_shape, input_type, expected_output_type); + auto backend = runtime::Backend::create("${BACKEND_NAME}"); + auto input_tesnor = backend->create_tensor(input_type, input_shape); + copy_data(input_tesnor, input); + auto output = backend->create_tensor(expected_output_type, input_shape); + auto handle = backend->compile(f); + handle->call_with_validate({output}, {input_tesnor}); + + std::vector result(expected_output.size()); + output->read(result.data(), result.size() * sizeof(float)); + EXPECT_TRUE(test::all_close_f(expected_output, result)); + } } NGRAPH_TEST(${BACKEND_NAME}, convert_i8_to_f32) @@ -323,17 +334,28 @@ NGRAPH_TEST(${BACKEND_NAME}, convert_f32_to_f32) // not supported by IE, hence no tests // destination: i4 -NGRAPH_TEST(${BACKEND_NAME}, convert_u8_to_i4_is_not_supported_yet) +NGRAPH_TEST(${BACKEND_NAME}, convert_u8_to_i4) { - const std::vector input{0, 0, 0, 0}; + const std::vector input{1, 2, 0, 3}; const Shape input_shape{4}; const element::Type input_type = ngraph::element::u8; - const std::vector expected_output{0x00, 0x00}; + const std::vector expected_output{0x12, 0x03}; const element::Type expected_output_type = ngraph::element::i4; - ASSERT_THROW(ConvertTest(input, input_shape, input_type, expected_output, expected_output_type), - ngraph::NodeValidationFailure); + { + const auto f = CreateFunction(input_shape, input_type, expected_output_type); + auto backend = runtime::Backend::create("${BACKEND_NAME}"); + auto input_tesnor = backend->create_tensor(input_type, input_shape); + copy_data(input_tesnor, input); + auto output = backend->create_tensor(expected_output_type, input_shape); + auto handle = backend->compile(f); + handle->call_with_validate({output}, {input_tesnor}); + + std::vector result(expected_output.size()); + output->read(result.data(), result.size() * sizeof(uint8_t)); + EXPECT_TRUE(test::all_close(expected_output, result)); + } } // destination: i8 diff --git a/ngraph/test/runtime/ie/unit_test.manifest b/ngraph/test/runtime/ie/unit_test.manifest index 4e57214a514b1f..aeac55148e40d4 100644 --- a/ngraph/test/runtime/ie/unit_test.manifest +++ b/ngraph/test/runtime/ie/unit_test.manifest @@ -1050,6 +1050,7 @@ roll_negative_axes # convert operation IE_CPU.convert_f16_to_f32 IE_CPU.convert_u8_to_f16 +IE_CPU.convert_u8_to_i4 IE_CPU.convert_u8_to_i16 IE_CPU.convert_u8_to_i64 IE_CPU.convert_u8_to_u1 From d1f1d4a41aab67fb08e74235a696a994e59d90c1 Mon Sep 17 00:00:00 2001 From: jdanieck Date: Tue, 18 May 2021 10:52:07 +0200 Subject: [PATCH 07/12] LP types support generalized. --- .../ngraph/runtime/reference/convert.hpp | 89 ++++++------- ngraph/test/backend/convert.in.cpp | 118 ++++++++++++++---- ngraph/test/runtime/ie/unit_test.manifest | 6 + 3 files changed, 145 insertions(+), 68 deletions(-) diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp b/ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp index f707234ce007b3..93d692b542579c 100644 --- a/ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp +++ b/ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp @@ -17,18 +17,25 @@ namespace ngraph { namespace detail { - inline void set_u1(uint8_t* buf, size_t idx) + inline void set_u1(uint8_t* buf, size_t idx, uint8_t val) { const int byte_idx = idx / 8; const int bit_idx = 7 - (idx % 8); - buf[byte_idx] |= (1 << bit_idx); + if (val) + { + buf[byte_idx] |= (1 << bit_idx); + } + else + { + buf[byte_idx] &= ~(1 << bit_idx); + } } inline uint8_t get_u1(const uint8_t* buf, size_t idx) { const int byte_idx = idx / 8; const int bit_idx = 7 - (idx % 8); - return buf[byte_idx] & (1 << bit_idx); + return (buf[byte_idx] & (1 << bit_idx)) ? 1 : 0; } inline void set_u4(uint8_t* buf, size_t idx, uint8_t val) @@ -65,6 +72,26 @@ namespace ngraph } return val; } + template + T get_value(const uint8_t* buf, size_t idx, element::Type type) + { + if (type == element::u1) + { + return detail::get_u1(buf, idx); + } + + if (type == element::u4) + { + return detail::get_u4(buf, idx); + } + + if (type == element::i4) + { + return detail::get_i4(buf, idx); + } + + return static_cast(buf[idx]); + } } // namespace detail template @@ -74,59 +101,33 @@ namespace ngraph element::Type_t src_type, element::Type_t dst_type) { - std::fill(out, out + count, 0); - if (dst_type == element::u1) // TODO: fix for LP source types + if (src_type == dst_type) { - for (size_t i = 0; i < count; ++i) - { - if (arg[i]) - { - detail::set_u1(reinterpret_cast(out), i); - } - } + std::memcpy(out, arg, count * sizeof(TO)); + return; } - else if (src_type == element::u1) // TODO: fix for LP dst types + + const uint8_t* input = reinterpret_cast(arg); + uint8_t* output = reinterpret_cast(out); + for (size_t i = 0; i < count; ++i) { - for (size_t i = 0; i < count; ++i) + if (dst_type == element::u1) { - if (detail::get_u1(reinterpret_cast(arg), i)) - { - out[i] = static_cast(1); - } + detail::set_u1(output, i, detail::get_value(input, i, src_type)); } - } - else if (dst_type == element::u4) // TODO: fix for LP source types - { - for (size_t i = 0; i < count; ++i) + else if (dst_type == element::u4) { - detail::set_u4(reinterpret_cast(out), i, arg[i]); + detail::set_u4(output, i, detail::get_value(input, i, src_type)); } - } - else if (src_type == element::u4) // TODO: fix for LP dst types - { - for (size_t i = 0; i < count; ++i) + else if (dst_type == element::i4) { - out[i] = detail::get_u4(reinterpret_cast(arg), i); + detail::set_i4(output, i, detail::get_value(input, i, src_type)); } - } - else if (dst_type == element::i4) // TODO: fix for LP source types - { - for (size_t i = 0; i < count; ++i) + else { - detail::set_i4(reinterpret_cast(out), i, arg[i]); + out[i] = detail::get_value(input, i, src_type); } } - else if (src_type == element::i4) // TODO: fix for LP dst types - { - for (size_t i = 0; i < count; ++i) - { - out[i] = detail::get_i4(reinterpret_cast(arg), i); - } - } - else - { - NGRAPH_CHECK(false, "Unimplemented"); - } } template diff --git a/ngraph/test/backend/convert.in.cpp b/ngraph/test/backend/convert.in.cpp index bf0f169304bd63..3ce041528cb984 100644 --- a/ngraph/test/backend/convert.in.cpp +++ b/ngraph/test/backend/convert.in.cpp @@ -46,6 +46,27 @@ namespace test_case.run(); } + + // TestCase doesn't support LP types + template + void LPConvertTest(const std::vector& input, + const Shape& input_shape, + const ngraph::element::Type& input_type, + const std::vector& expected_output, + const ngraph::element::Type& expected_output_type) + { + const auto f = CreateFunction(input_shape, input_type, expected_output_type); + auto backend = runtime::Backend::create("${BACKEND_NAME}"); + auto input_tesnor = backend->create_tensor(input_type, input_shape); + copy_data(input_tesnor, input); + auto output = backend->create_tensor(expected_output_type, input_shape); + auto handle = backend->compile(f); + handle->call_with_validate({output}, {input_tesnor}); + + std::vector result(expected_output.size()); + output->read(result.data(), result.size() * sizeof(uint8_t)); + EXPECT_TRUE(test::all_close(expected_output, result)); + } } // namespace // destination: boolean @@ -411,6 +432,30 @@ NGRAPH_TEST(${BACKEND_NAME}, convert_u8_to_i64) } // destination: u1 +NGRAPH_TEST(${BACKEND_NAME}, convert_u1_to_u1) +{ + const std::vector input{0xF0}; + const Shape input_shape{4}; + const element::Type input_type = ngraph::element::u1; + + const std::vector expected_output{0xF0}; + const element::Type expected_output_type = ngraph::element::u1; + + LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); +} + +NGRAPH_TEST(${BACKEND_NAME}, convert_u4_to_u1) +{ + const std::vector input{0x10, 0x01}; + const Shape input_shape{4}; + const element::Type input_type = ngraph::element::u4; + + const std::vector expected_output{0x90}; + const element::Type expected_output_type = ngraph::element::u1; + + LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); +} + NGRAPH_TEST(${BACKEND_NAME}, convert_u8_to_u1) { const std::vector input{1, 0, 1, 0}; @@ -420,22 +465,47 @@ NGRAPH_TEST(${BACKEND_NAME}, convert_u8_to_u1) const std::vector expected_output{0xA0}; const element::Type expected_output_type = ngraph::element::u1; - { - const auto f = CreateFunction(input_shape, input_type, expected_output_type); - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - auto input_tesnor = backend->create_tensor(input_type, input_shape); - copy_data(input_tesnor, input); - auto output = backend->create_tensor(expected_output_type, input_shape); - auto handle = backend->compile(f); - handle->call_with_validate({output}, {input_tesnor}); + LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); +} - std::vector result(expected_output.size()); - output->read(result.data(), result.size() * sizeof(uint8_t)); - EXPECT_TRUE(test::all_close(expected_output, result)); - } +NGRAPH_TEST(${BACKEND_NAME}, convert_i4_to_u1) +{ + const std::vector input{0x10, 0x01}; + const Shape input_shape{4}; + const element::Type input_type = ngraph::element::u4; + + const std::vector expected_output{0x90}; + const element::Type expected_output_type = ngraph::element::u1; + + LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); } // destination: u4 +NGRAPH_TEST(${BACKEND_NAME}, convert_u1_to_u4) +{ + const std::vector input{0xF0}; + const Shape input_shape{4}; + const element::Type input_type = ngraph::element::u1; + + const std::vector expected_output{0x11, 0x11}; + const element::Type expected_output_type = ngraph::element::u4; + + LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); +} + +NGRAPH_TEST(${BACKEND_NAME}, convert_u4_to_u4) +{ + const std::vector input{0x22, 0x33}; + const Shape input_shape{4}; + const element::Type input_type = ngraph::element::u4; + + const std::vector expected_output{0x22, 0x33}; + const element::Type expected_output_type = ngraph::element::u4; + + LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); +} + + NGRAPH_TEST(${BACKEND_NAME}, convert_u8_to_u4) { const std::vector input{7, 0, 1, 15}; @@ -445,19 +515,19 @@ NGRAPH_TEST(${BACKEND_NAME}, convert_u8_to_u4) const std::vector expected_output{0x70, 0x1F}; const element::Type expected_output_type = ngraph::element::u4; - { - const auto f = CreateFunction(input_shape, input_type, expected_output_type); - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - auto input_tesnor = backend->create_tensor(input_type, input_shape); - copy_data(input_tesnor, input); - auto output = backend->create_tensor(expected_output_type, input_shape); - auto handle = backend->compile(f); - handle->call_with_validate({output}, {input_tesnor}); + LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); +} - std::vector result(expected_output.size()); - output->read(result.data(), result.size() * sizeof(uint8_t)); - EXPECT_TRUE(test::all_close(expected_output, result)); - } +NGRAPH_TEST(${BACKEND_NAME}, convert_i4_to_u4) +{ + const std::vector input{0x22, 0x33}; + const Shape input_shape{4}; + const element::Type input_type = ngraph::element::i4; + + const std::vector expected_output{0x22, 0x33}; + const element::Type expected_output_type = ngraph::element::u4; + + LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); } // destination: u8 diff --git a/ngraph/test/runtime/ie/unit_test.manifest b/ngraph/test/runtime/ie/unit_test.manifest index aeac55148e40d4..2c1a0970abc853 100644 --- a/ngraph/test/runtime/ie/unit_test.manifest +++ b/ngraph/test/runtime/ie/unit_test.manifest @@ -1065,6 +1065,12 @@ IE_CPU.convert_u32_to_f32 # NOT_IMPLEMENTED IE_CPU.convert_i4_to_f32 # NOT_IMPLEMENTED IE_CPU.convert_u1_to_f32 # NOT_IMPLEMENTED IE_CPU.convert_u4_to_f32 # NOT_IMPLEMENTED +IE_CPU.convert_u1_to_u1 +IE_CPU.convert_u4_to_u1 +IE_CPU.convert_i4_to_u1 +IE_CPU.convert_u1_to_u4 +IE_CPU.convert_u4_to_u4 +IE_CPU.convert_i4_to_u4 #------------------------------------------------------------------------------- # From bba7a6949304abcd469cb609d27655965beb92ce Mon Sep 17 00:00:00 2001 From: jdanieck Date: Tue, 18 May 2021 12:27:51 +0200 Subject: [PATCH 08/12] Remove std::copy optimization. --- .../reference/include/ngraph/runtime/reference/convert.hpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp b/ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp index 93d692b542579c..f7c27a0ca5518f 100644 --- a/ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp +++ b/ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp @@ -101,12 +101,6 @@ namespace ngraph element::Type_t src_type, element::Type_t dst_type) { - if (src_type == dst_type) - { - std::memcpy(out, arg, count * sizeof(TO)); - return; - } - const uint8_t* input = reinterpret_cast(arg); uint8_t* output = reinterpret_cast(out); for (size_t i = 0; i < count; ++i) From 760a0cd204ba5984d2573b6671d7130e53ae0c71 Mon Sep 17 00:00:00 2001 From: jdanieck Date: Wed, 19 May 2021 15:09:22 +0200 Subject: [PATCH 09/12] Fix backend test for LP types. --- ngraph/test/backend/convert.in.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ngraph/test/backend/convert.in.cpp b/ngraph/test/backend/convert.in.cpp index 3ce041528cb984..a3abdd87af311b 100644 --- a/ngraph/test/backend/convert.in.cpp +++ b/ngraph/test/backend/convert.in.cpp @@ -435,7 +435,7 @@ NGRAPH_TEST(${BACKEND_NAME}, convert_u8_to_i64) NGRAPH_TEST(${BACKEND_NAME}, convert_u1_to_u1) { const std::vector input{0xF0}; - const Shape input_shape{4}; + const Shape input_shape{8}; const element::Type input_type = ngraph::element::u1; const std::vector expected_output{0xF0}; @@ -446,8 +446,8 @@ NGRAPH_TEST(${BACKEND_NAME}, convert_u1_to_u1) NGRAPH_TEST(${BACKEND_NAME}, convert_u4_to_u1) { - const std::vector input{0x10, 0x01}; - const Shape input_shape{4}; + const std::vector input{0x10, 0x01, 0x00, 0x00}; + const Shape input_shape{8}; const element::Type input_type = ngraph::element::u4; const std::vector expected_output{0x90}; @@ -458,11 +458,11 @@ NGRAPH_TEST(${BACKEND_NAME}, convert_u4_to_u1) NGRAPH_TEST(${BACKEND_NAME}, convert_u8_to_u1) { - const std::vector input{1, 0, 1, 0}; - const Shape input_shape{4}; + const std::vector input{1, 0, 1, 0, 0, 0, 0, 1}; + const Shape input_shape{8}; const element::Type input_type = ngraph::element::u8; - const std::vector expected_output{0xA0}; + const std::vector expected_output{0xA1}; const element::Type expected_output_type = ngraph::element::u1; LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); @@ -470,8 +470,8 @@ NGRAPH_TEST(${BACKEND_NAME}, convert_u8_to_u1) NGRAPH_TEST(${BACKEND_NAME}, convert_i4_to_u1) { - const std::vector input{0x10, 0x01}; - const Shape input_shape{4}; + const std::vector input{0x10, 0x01, 0x00, 0x00}; + const Shape input_shape{8}; const element::Type input_type = ngraph::element::u4; const std::vector expected_output{0x90}; From f58e41c7f77a784e08d8bfe68997a35cf68499af Mon Sep 17 00:00:00 2001 From: jdanieck Date: Wed, 19 May 2021 17:28:05 +0200 Subject: [PATCH 10/12] Fixed arm plugin compilation. --- .../ngraph/runtime/reference/convert.hpp | 55 ++++++++++--------- ngraph/core/src/op/convert.cpp | 10 ++-- 2 files changed, 34 insertions(+), 31 deletions(-) diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp b/ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp index f7c27a0ca5518f..2fce199f7bbf7d 100644 --- a/ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp +++ b/ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp @@ -92,37 +92,40 @@ namespace ngraph return static_cast(buf[idx]); } - } // namespace detail - template - void convert(const TI* arg, - TO* out, - size_t count, - element::Type_t src_type, - element::Type_t dst_type) - { - const uint8_t* input = reinterpret_cast(arg); - uint8_t* output = reinterpret_cast(out); - for (size_t i = 0; i < count; ++i) + template + void lp_convert(const TI* arg, + TO* out, + size_t count, + element::Type_t src_type, + element::Type_t dst_type) { - if (dst_type == element::u1) + const uint8_t* input = reinterpret_cast(arg); + uint8_t* output = reinterpret_cast(out); + for (size_t i = 0; i < count; ++i) { - detail::set_u1(output, i, detail::get_value(input, i, src_type)); - } - else if (dst_type == element::u4) - { - detail::set_u4(output, i, detail::get_value(input, i, src_type)); - } - else if (dst_type == element::i4) - { - detail::set_i4(output, i, detail::get_value(input, i, src_type)); - } - else - { - out[i] = detail::get_value(input, i, src_type); + if (dst_type == element::u1) + { + detail::set_u1( + output, i, detail::get_value(input, i, src_type)); + } + else if (dst_type == element::u4) + { + detail::set_u4( + output, i, detail::get_value(input, i, src_type)); + } + else if (dst_type == element::i4) + { + detail::set_i4( + output, i, detail::get_value(input, i, src_type)); + } + else + { + out[i] = detail::get_value(input, i, src_type); + } } } - } + } // namespace detail template typename std::enable_if::value>::type diff --git a/ngraph/core/src/op/convert.cpp b/ngraph/core/src/op/convert.cpp index 35321cd95da312..4f585f30572b72 100644 --- a/ngraph/core/src/op/convert.cpp +++ b/ngraph/core/src/op/convert.cpp @@ -61,11 +61,11 @@ namespace convert ((INPUT_ET == element::u4) || (OUTPUT_ET == element::u4)) || ((INPUT_ET == element::i4) || (OUTPUT_ET == element::i4))) { - runtime::reference::convert(arg->get_data_ptr(), - out->get_data_ptr(), - element_count, - INPUT_ET, - OUTPUT_ET); + runtime::reference::detail::lp_convert(arg->get_data_ptr(), + out->get_data_ptr(), + element_count, + INPUT_ET, + OUTPUT_ET); } else { From 19533e996f77fee956a09ea73bb5f8811b28e132 Mon Sep 17 00:00:00 2001 From: jdanieck Date: Thu, 20 May 2021 08:22:58 +0200 Subject: [PATCH 11/12] Add LP types to Serialization SLT. --- .../serialization/single_layer/convert.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/inference-engine/tests/functional/inference_engine/serialization/single_layer/convert.cpp b/inference-engine/tests/functional/inference_engine/serialization/single_layer/convert.cpp index c56d444dcdc94b..e6d6bc19ed7d6d 100644 --- a/inference-engine/tests/functional/inference_engine/serialization/single_layer/convert.cpp +++ b/inference-engine/tests/functional/inference_engine/serialization/single_layer/convert.cpp @@ -12,13 +12,14 @@ namespace { const std::vector> inShape = {{1, 2, 3, 4}}; const std::vector precisions = { - InferenceEngine::Precision::BOOL, InferenceEngine::Precision::U8, - InferenceEngine::Precision::I8, InferenceEngine::Precision::U16, - InferenceEngine::Precision::I16, InferenceEngine::Precision::U32, - InferenceEngine::Precision::I32, InferenceEngine::Precision::U64, - InferenceEngine::Precision::I64, InferenceEngine::Precision::BF16, - InferenceEngine::Precision::FP16, InferenceEngine::Precision::FP32, - InferenceEngine::Precision::FP64}; + InferenceEngine::Precision::BOOL, InferenceEngine::Precision::BIN, + InferenceEngine::Precision::U4, InferenceEngine::Precision::U8, + InferenceEngine::Precision::I4, InferenceEngine::Precision::I8, + InferenceEngine::Precision::U16, InferenceEngine::Precision::I16, + InferenceEngine::Precision::U32, InferenceEngine::Precision::I32, + InferenceEngine::Precision::U64, InferenceEngine::Precision::I64, + InferenceEngine::Precision::BF16, InferenceEngine::Precision::FP16, + InferenceEngine::Precision::FP32, InferenceEngine::Precision::FP64}; TEST_P(ConvertLayerTest, Serialize) { Serialize(); From 283eb1901c14d70e262d77f2b88048a0205fe20c Mon Sep 17 00:00:00 2001 From: jdanieck Date: Thu, 20 May 2021 09:00:54 +0200 Subject: [PATCH 12/12] Add Convert to summarize.py report. --- .../functional_test_utils/layer_tests_summary/utils/constants.py | 1 + 1 file changed, 1 insertion(+) diff --git a/inference-engine/tests/ie_test_utils/functional_test_utils/layer_tests_summary/utils/constants.py b/inference-engine/tests/ie_test_utils/functional_test_utils/layer_tests_summary/utils/constants.py index 20442899b87ce6..cd93bb1961e148 100644 --- a/inference-engine/tests/ie_test_utils/functional_test_utils/layer_tests_summary/utils/constants.py +++ b/inference-engine/tests/ie_test_utils/functional_test_utils/layer_tests_summary/utils/constants.py @@ -16,6 +16,7 @@ 'CTCGreedyDecoder-1', 'CTCGreedyDecoderSeqLen-6', 'Concat-1', + 'Convert-1', 'ConvertLike-1', 'Convolution-1', 'Constant-1',