Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GNA] Fixed import of model with several inputs #7277

Merged
merged 28 commits into from
Sep 2, 2021
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
30ef71a
Rebase master
mryzhov May 12, 2021
2c3d69e
Merge branch 'master' of https://github.com/openvinotoolkit/openvino
mryzhov Jun 10, 2021
766171e
Merge branch 'master' of https://github.com/openvinotoolkit/openvino
mryzhov Jun 11, 2021
544afa0
Merge branch 'master' of https://github.com/openvinotoolkit/openvino
mryzhov Jun 15, 2021
d381a2e
[gna] Fixed export/import precision
mryzhov Jun 21, 2021
c11de99
Merge branch 'master' of https://github.com/openvinotoolkit/openvino
mryzhov Jun 21, 2021
6b5d513
Revert "[gna] Fixed export/import precision"
mryzhov Jun 23, 2021
390ef35
Merge branch 'master' of https://github.com/openvinotoolkit/openvino
mryzhov Jun 23, 2021
a6d0264
Rebase master
mryzhov May 12, 2021
2b26035
[gna] Fixed export/import precision
mryzhov Jun 21, 2021
7906a79
Revert "[gna] Fixed export/import precision"
mryzhov Jun 23, 2021
945eb8b
Merge branch 'master' of https://github.com/mryzhov/openvino
mryzhov Jul 5, 2021
1522b73
Merge branch 'master' of https://github.com/openvinotoolkit/openvino
mryzhov Jul 5, 2021
4f8797d
Merge branch 'master' of https://github.com/openvinotoolkit/openvino
mryzhov Jul 22, 2021
1127b93
Merge branch 'master' of https://github.com/openvinotoolkit/openvino
mryzhov Jul 27, 2021
7275d84
Merge branch 'master' of https://github.com/openvinotoolkit/openvino
mryzhov Aug 2, 2021
acd2907
Merge branch 'master' of https://github.com/openvinotoolkit/openvino
mryzhov Aug 3, 2021
8012652
Merge branch 'master' of https://github.com/openvinotoolkit/openvino
mryzhov Aug 10, 2021
3dbaa92
Merge branch 'openvinotoolkit:master' into master
mryzhov Aug 12, 2021
a75195f
Merge branch 'master' of https://github.com/openvinotoolkit/openvino
mryzhov Aug 17, 2021
093a25c
Merge branch 'master' of https://github.com/openvinotoolkit/openvino
mryzhov Aug 18, 2021
2e14759
Merge branch 'master' of https://github.com/openvinotoolkit/openvino
mryzhov Aug 22, 2021
305e8d0
Merge branch 'master' of https://github.com/openvinotoolkit/openvino
mryzhov Aug 28, 2021
5439e90
[GNA] Fixed import of model with several intputs
mryzhov Aug 28, 2021
0cf5eed
Merge branch 'openvinotoolkit:master' into scale_factor_fix
mryzhov Aug 30, 2021
9083fb2
Fixed copyright year
mryzhov Aug 30, 2021
33ff602
Merge branch 'openvinotoolkit:master' into scale_factor_fix
mryzhov Aug 31, 2021
3e3fde6
Merge branch 'openvinotoolkit:master' into scale_factor_fix
mryzhov Aug 31, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion inference-engine/src/gna_plugin/gna_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1619,7 +1619,7 @@ InferenceEngine::IExecutableNetworkInternal::Ptr GNAPlugin::ImportNetwork(std::i
// If scale factors are defined in configuration we still need to use them instead of imported values,
// for example to change the scale factors for the old models.
if (!config.inputScaleFactors.empty()) {
IE_ASSERT(config.inputScaleFactors.size() == inputsDesc->inputScaleFactors.size());
IE_ASSERT(config.inputScaleFactors.size() <= inputsDesc->inputScaleFactors.size());
for (size_t i = 0; i < config.inputScaleFactors.size(); ++i) {
if (config.inputScaleFactors[i] != GNAPluginNS::kScaleFactorDefault) {
gnalog() << "[Import Network] Using input scale factor defined in configuration for input " << i << std::endl;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
// Copyright (C) 2018-2021 Intel Corporation
mryzhov marked this conversation as resolved.
Show resolved Hide resolved
// 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