Skip to content

Commit

Permalink
[GNA] Support 100 inputs, instead of 10 (openvinotoolkit#741)
Browse files Browse the repository at this point in the history
  • Loading branch information
dorloff authored Jun 4, 2020
1 parent 3183c11 commit 0e60aed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions inference-engine/src/gna_plugin/gna_plugin_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ void Config::UpdateFromMap(const std::map<std::string, std::string>& config) {
key.erase(0, 1);
try {
input_index = std::stoi(key);
if (input_index < 0 | input_index > 9) {
if (input_index < 0 | input_index > 99) {
throw std::out_of_range("");
}
} catch (std::invalid_argument&) {
THROW_GNA_EXCEPTION << "Invalid value of index of input scale factor";
} catch (std::out_of_range&) {
THROW_GNA_EXCEPTION << "Index of input scale factor must be in the range [0..9], " << value << " provided";
THROW_GNA_EXCEPTION << "Index of input scale factor must be in the range [0..99], " << key << " provided";
}
}
auto scale_factor = InferenceEngine::CNNLayer::ie_parse_float(value);
Expand Down
10 changes: 5 additions & 5 deletions inference-engine/tests/unit/gna/gna_plugin_config_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ TEST_F(GNAPluginConfigTest, GnaConfigScaleFactorTest) {
EXPECT_FLOAT_EQ(config.inputScaleFactors[2], 1.0);
EXPECT_FLOAT_EQ(config.inputScaleFactors[3], 15.2);

config.UpdateFromMap({{GNA_CONFIG_KEY(SCALE_FACTOR) + std::string("_9"), std::string("8.43")}});
EXPECT_EQ(config.GetParameter(GNA_CONFIG_KEY(SCALE_FACTOR) + std::string("_9")), std::string("8.430000"));
EXPECT_EQ(config.inputScaleFactors.size(), 10);
EXPECT_FLOAT_EQ(config.inputScaleFactors[9], 8.43);
config.UpdateFromMap({{GNA_CONFIG_KEY(SCALE_FACTOR) + std::string("_99"), std::string("8.43")}});
EXPECT_EQ(config.GetParameter(GNA_CONFIG_KEY(SCALE_FACTOR) + std::string("_99")), std::string("8.430000"));
EXPECT_EQ(config.inputScaleFactors.size(), 100);
EXPECT_FLOAT_EQ(config.inputScaleFactors[99], 8.43);

ExpectThrow(GNA_CONFIG_KEY(SCALE_FACTOR) + std::string("_10"), std::string("8.43"));
ExpectThrow(GNA_CONFIG_KEY(SCALE_FACTOR) + std::string("_100"), std::string("8.43"));
ExpectThrow(GNA_CONFIG_KEY(SCALE_FACTOR) + std::string("&1"), std::string("8.43"));
ExpectThrow(GNA_CONFIG_KEY(SCALE_FACTOR) + std::string("_"), std::string("8.43"));
ExpectThrow(GNA_CONFIG_KEY(SCALE_FACTOR) + std::string("abs"), std::string("8.43"));
Expand Down

0 comments on commit 0e60aed

Please sign in to comment.