From f00cdddede22133caaf0bd366bf9b82bfffd9f61 Mon Sep 17 00:00:00 2001 From: Andrew Bakalin Date: Thu, 23 Jul 2020 12:20:08 +0300 Subject: [PATCH] [IE][VPU][GT]: Change begin and end masks serialization for StridedSlice (#1417) * In order to support cases when begin and end size is less than input rank, the serialization was changed. * Add tests * Update firmware --- inference-engine/cmake/vpu_dependencies.cmake | 2 +- .../graph_transformer/src/stages/strided_slice.cpp | 25 ++++++++++++---------- .../single_layer_tests/strided_slice.cpp | 2 ++ 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/inference-engine/cmake/vpu_dependencies.cmake b/inference-engine/cmake/vpu_dependencies.cmake index 36e0c36..1e90abc 100644 --- a/inference-engine/cmake/vpu_dependencies.cmake +++ b/inference-engine/cmake/vpu_dependencies.cmake @@ -19,7 +19,7 @@ set(VPU_SUPPORTED_FIRMWARES usb-ma2450 usb-ma2x8x pcie-ma248x) # Default packages # -set(FIRMWARE_PACKAGE_VERSION 1250) +set(FIRMWARE_PACKAGE_VERSION 1263) set(VPU_CLC_MA2X8X_VERSION "movi-cltools-20.02.0") # diff --git a/inference-engine/src/vpu/graph_transformer/src/stages/strided_slice.cpp b/inference-engine/src/vpu/graph_transformer/src/stages/strided_slice.cpp index 14b6bd9..1d6e971 100644 --- a/inference-engine/src/vpu/graph_transformer/src/stages/strided_slice.cpp +++ b/inference-engine/src/vpu/graph_transformer/src/stages/strided_slice.cpp @@ -11,19 +11,22 @@ namespace vpu { namespace { -int maskStrToInt(std::string mask) { - int idx = 0, result = 0; +std::uint32_t maskStrToInt(std::string mask) { + std::uint32_t result = 0; + int idx = 0; for (const auto& character : mask) { - if (character == ',') continue; - - if (idx++ > 0) { - result <<= 1; - } - if (character == '1') { - result = result | 1; - } else if (character != '0') { - VPU_THROW_FORMAT("Unsupported mask value: only 0 or 1 are supported, but got {} instead", character); + switch (character) { + case ',': + continue; + case '1': + result |= (0x1 << idx++); + break; + case '0': + idx++; + break; + default: + VPU_THROW_FORMAT("Unsupported mask value: only 0 or 1 are supported, but got {} instead", character); } } diff --git a/inference-engine/tests/functional/plugin/myriad/shared_tests_instances/single_layer_tests/strided_slice.cpp b/inference-engine/tests/functional/plugin/myriad/shared_tests_instances/single_layer_tests/strided_slice.cpp index 0d5b663..8edea2d 100644 --- a/inference-engine/tests/functional/plugin/myriad/shared_tests_instances/single_layer_tests/strided_slice.cpp +++ b/inference-engine/tests/functional/plugin/myriad/shared_tests_instances/single_layer_tests/strided_slice.cpp @@ -18,6 +18,8 @@ typedef std::map Config; std::vector testCases = { { { 1, 12, 100 }, { 0, 9, 0 }, { 0, 11, 0 }, { 1, 1, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, + { { 1, 12, 100 }, { 0, 9 }, { 0, 11 }, { 1, 1, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, + { { 1, 12, 100 }, { 0, 9 }, { 0, 11 }, { 1, 1 }, { 1, 0 }, { 1, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }, { { 1, 12, 100 }, { 0, 1, 0 }, { 0, -1, 0 }, { 1, 1, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, { { 1, 12, 100 }, { 0, 8, 0 }, { 0, 9, 0 }, { 1, 1, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, {}, {}, {} }, { { 1, 12, 100 }, { 0, 4, 0 }, { 0, 9, 0 }, { 1, 2, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } }, -- 2.7.4