[IE][VPU]: Support negative strides for StridedSlice (#4178)

* Remove asserts on negative stride
* Update firmware
* Add test cases
This commit is contained in:
Andrew Bakalin
2021-02-09 11:21:15 +03:00
committed by GitHub
parent 0c39d5b1b6
commit 2d560d465f
3 changed files with 10 additions and 19 deletions

View File

@@ -6,14 +6,14 @@ include_guard(GLOBAL)
set(VPU_SUPPORTED_FIRMWARES usb-ma2x8x pcie-ma2x8x)
set(VPU_SUPPORTED_FIRMWARES_HASH
"c21f14cf8ee215f5fccf6b50de87e413b4c1ed8331f0c8fddb6c4d5746d884d7"
"f2521913ee6a024cf07bc823c4ed88e265b1c369666f027279f51d6a89e9e7de")
"b9e4c2cff51d17f0751219586906be3611c593aca01b43907518df1d762672ea"
"6d89b52d723c1ba2c361575a53eda951392b6ce818733c30b78f16c75caa7892")
#
# Default packages
#
set(FIRMWARE_PACKAGE_VERSION 1606)
set(FIRMWARE_PACKAGE_VERSION 1609)
set(VPU_CLC_MA2X8X_VERSION "movi-cltools-20.09.2")
#

View File

@@ -112,17 +112,6 @@ void FrontEnd::parseStridedSlice(const Model& model, const ie::CNNLayerPtr& laye
DataVector extendedInputs{inputs.begin(), inputs.end()};
if (inputs.size() == 3) {
extendedInputs.push_back(model->addFakeData());
} else {
const auto& strides = inputs[3];
const auto stridesPtr = strides->content()->get<int32_t>();
VPU_THROW_UNLESS(stridesPtr != nullptr,
"Checking {} with type {} failed: pointer for strides is null",
layer->name, layer->type);
for (int i = 0; i < strides->desc().totalDimSize(); i++) {
VPU_THROW_UNLESS(stridesPtr[i] > 0,
"Checking {} with type {} failed: negative stride is not supported",
layer->name, layer->type);
}
}
model->addNewStage<StridedSliceStage>(layer->name, StageType::StridedSlice, layer, extendedInputs, outputs);

View File

@@ -38,6 +38,12 @@ std::vector<StridedSliceSpecificParams> testCases = {
{ { 1, 3, 4, 5, 6 }, { 0, 1, 0, 0, 0 }, { 1, 3, 4, 5, 6 }, { 1, 1, 1, 1, 1 }, {1, 0, 1, 1, 1}, {1, 0, 1, 1, 1}, {}, {}, {} },
{ { 2, 3, 4, 5, 6 }, { 0, 1, 0, 0, 0 }, { 2, 3, 4, 5, 6 }, { 1, 1, 1, 1, 1 }, {1, 0, 1, 1, 1}, {1, 0, 1, 1, 1}, {}, {0, 1, 0, 0, 0}, {} },
{ { 2, 3, 4, 5, 6 }, { 0, 1, 0, 0, 0 }, { 2, 3, 4, 5, 6 }, { 1, 1, 1, 1, 1 }, {1, 0, 1, 1, 1}, {1, 0, 1, 1, 1}, {}, {}, {0, 1, 0, 0, 0} },
{ { 10 }, { -1 }, { -11 }, { -1 }, { 0 }, { 0 }, {}, {}, {} },
{ { 10, 10 }, { -1, 0 }, { -11, 0 }, { -1, 1 }, { 0, 1 }, { 0, 1 }, {}, {}, {} },
{ { 10, 10 }, { -1, -1 }, { -11, -11 }, { -1, -1 }, { 0, 0 }, { 0, 0 }, {}, {}, {} },
{ { 1, 52, 52, 3, 2 }, { 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, -2 }, { 1, 1, 1, 1, -1 }, { 1, 1, 1, 1, 0 }, { 1, 1, 1, 1, 0 }, {}, {}, {} },
{ { 1, 52, 52, 3, 2 }, { 0, 0, 0, 0, -2 }, { 0, 0, 0, 0, -9223372036854775807 }, { 1, 1, 1, 1, -1 }, { 1, 1, 1, 1, 0 }, { 1, 1, 1, 1, 0 }, {}, {}, {} },
{ { 1, 52, 52, 3, 2 }, { 0, 0, 0, 0, -1 }, { 0, 0, 0, 0, -9223372036854775807 }, { 1, 1, 1, 1, -1 }, { 1, 1, 1, 1, 0 }, { 1, 1, 1, 1, 0 }, {}, {}, {} },
};
std::vector<InferenceEngine::Precision> netPrecisions = {
@@ -46,11 +52,7 @@ std::vector<InferenceEngine::Precision> netPrecisions = {
};
Config getConfig() {
Config config;
if (CommonTestUtils::vpu::CheckMyriad2()) {
config[InferenceEngine::MYRIAD_DISABLE_REORDER] = CONFIG_VALUE(YES);
}
return config;
return Config{ { InferenceEngine::MYRIAD_DETECT_NETWORK_BATCH, CONFIG_VALUE(NO) } };
}
INSTANTIATE_TEST_CASE_P(smoke_StridedSlice_tests, StridedSliceLayerTest,