forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GNA] Fixed import of model with several inputs (openvinotoolkit#7277)
- Loading branch information
Showing
2 changed files
with
119 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
118 changes: 118 additions & 0 deletions
118
...onal/plugin/gna/shared_tests_instances/import_export_tests/import_export_multi_inputs.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
// Copyright (C) 2021 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#include <vector> | ||
#include <memory> | ||
#include <tuple> | ||
#include <vector> | ||
#include <string> | ||
#include <fstream> | ||
|
||
#include "ngraph_functions/builders.hpp" | ||
#include "base/import_export_base/import_export_base.hpp" | ||
|
||
namespace LayerTestsDefinitions { | ||
|
||
class ImportMultiInput : public FuncTestUtils::ImportNetworkTestBase { | ||
protected: | ||
void SetUp() override { | ||
InferenceEngine::Precision netPrecision; | ||
std::tie(netPrecision, targetDevice, exportConfiguration, importConfiguration, applicationHeader) = this->GetParam(); | ||
|
||
auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision); | ||
auto input = ngraph::builder::makeParams(ngPrc, {{1, 10}, {1, 10}}); | ||
auto mul1 = ngraph::builder::makeEltwise(input[0], input[1], ngraph::helpers::EltwiseTypes::ADD); | ||
auto result = std::make_shared<ngraph::opset7::Result>(mul1); | ||
|
||
function = std::make_shared<ngraph::Function>(ngraph::ResultVector{result}, input, "multiple_input"); | ||
} | ||
}; | ||
|
||
class ImportMultiInputChanged : public ImportMultiInput {}; | ||
class ImportMultiInputUnchanged : public ImportMultiInput {}; | ||
|
||
TEST_P(ImportMultiInputUnchanged, CompareWithRefImpl) { | ||
TestRun(false); | ||
}; | ||
|
||
TEST_P(ImportMultiInputChanged, CompareWithRefImpl) { | ||
TestRun(true); | ||
}; | ||
|
||
const std::vector<InferenceEngine::Precision> netPrecisions = { | ||
InferenceEngine::Precision::FP32 | ||
}; | ||
|
||
const std::vector<std::map<std::string, std::string>> exportConfigs = { | ||
{ | ||
{"GNA_DEVICE_MODE", "GNA_SW_EXACT"}, | ||
{"GNA_SCALE_FACTOR_0", "327.67"}, | ||
{"GNA_SCALE_FACTOR_1", "327.67"} | ||
} | ||
}; | ||
|
||
const std::vector<std::map<std::string, std::string>> importConfigsChanged = { | ||
{ | ||
{"GNA_DEVICE_MODE", "GNA_SW_EXACT"}, | ||
{"GNA_SCALE_FACTOR_0", "32767"} | ||
}, | ||
{ | ||
{"GNA_DEVICE_MODE", "GNA_SW_EXACT"}, | ||
{"GNA_SCALE_FACTOR_1", "32767"} | ||
}, | ||
{ | ||
{"GNA_DEVICE_MODE", "GNA_SW_EXACT"}, | ||
{"GNA_SCALE_FACTOR_0", "32767"}, | ||
{"GNA_SCALE_FACTOR_1", "32767"} | ||
}, | ||
{ | ||
{"GNA_DEVICE_MODE", "GNA_SW_EXACT"}, | ||
{"GNA_SCALE_FACTOR_0", "1"}, | ||
{"GNA_SCALE_FACTOR_1", "32767"} | ||
} | ||
}; | ||
|
||
const std::vector<std::map<std::string, std::string>> importConfigsUnchanged = { | ||
{ | ||
{"GNA_DEVICE_MODE", "GNA_SW_EXACT"}, | ||
{"GNA_SCALE_FACTOR_0", "327.67"} | ||
}, | ||
{ | ||
{"GNA_DEVICE_MODE", "GNA_SW_EXACT"}, | ||
{"GNA_SCALE_FACTOR_0", "1"} | ||
}, | ||
{ | ||
{"GNA_DEVICE_MODE", "GNA_SW_EXACT"} | ||
}, | ||
{ | ||
{"GNA_DEVICE_MODE", "GNA_SW_EXACT"}, | ||
{"GNA_SCALE_FACTOR_0", "327.67"}, | ||
{"GNA_SCALE_FACTOR_1", "327.67"} | ||
}, | ||
{ | ||
{"GNA_DEVICE_MODE", "GNA_SW_EXACT"}, | ||
{"GNA_SCALE_FACTOR_1", "327.67"} | ||
}, | ||
}; | ||
|
||
INSTANTIATE_TEST_CASE_P(smoke_ImportNetworkGNA, ImportMultiInputUnchanged, | ||
::testing::Combine( | ||
::testing::ValuesIn(netPrecisions), | ||
::testing::Values(CommonTestUtils::DEVICE_GNA), | ||
::testing::ValuesIn(exportConfigs), | ||
::testing::ValuesIn(importConfigsUnchanged), | ||
::testing::Values("")), | ||
ImportMultiInputUnchanged::getTestCaseName); | ||
|
||
INSTANTIATE_TEST_CASE_P(smoke_ImportNetworkGNA, ImportMultiInputChanged, | ||
::testing::Combine( | ||
::testing::ValuesIn(netPrecisions), | ||
::testing::Values(CommonTestUtils::DEVICE_GNA), | ||
::testing::ValuesIn(exportConfigs), | ||
::testing::ValuesIn(importConfigsChanged), | ||
::testing::Values("")), | ||
ImportMultiInputChanged::getTestCaseName); | ||
|
||
} // namespace LayerTestsDefinitions | ||
|