[GNA] Support 100 inputs, instead of 10 (#741)
authorDenis Orlov <denis.orlov@intel.com>
Thu, 4 Jun 2020 11:33:09 +0000 (14:33 +0300)
committerGitHub <noreply@github.com>
Thu, 4 Jun 2020 11:33:09 +0000 (14:33 +0300)
inference-engine/src/gna_plugin/gna_plugin_config.cpp
inference-engine/tests/unit/gna/gna_plugin_config_test.cpp

index 8a76135..163b2f1 100644 (file)
@@ -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);
index fb0ac0e..c930b59 100644 (file)
@@ -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"));