parent
18c20f5766
commit
4ecab1eeea
@ -64,8 +64,12 @@ VPUScalesOption::value_type VPUScalesOption::parse(const std::string& value) {
|
|||||||
for (const auto& vpuScale : parsedStrings) {
|
for (const auto& vpuScale : parsedStrings) {
|
||||||
const auto delimeterPos = vpuScale.find(':');
|
const auto delimeterPos = vpuScale.find(':');
|
||||||
VPU_THROW_UNLESS(delimeterPos != std::string::npos, "Unable to parse string \"{}\"", vpuScale);
|
VPU_THROW_UNLESS(delimeterPos != std::string::npos, "Unable to parse string \"{}\"", vpuScale);
|
||||||
|
try {
|
||||||
vpuScaleMap.insert({std::string(vpuScale.substr(0, delimeterPos)),
|
vpuScaleMap.insert({std::string(vpuScale.substr(0, delimeterPos)),
|
||||||
std::stof(vpuScale.substr(delimeterPos + 1))});
|
std::stof(vpuScale.substr(delimeterPos + 1))});
|
||||||
|
} catch (...) {
|
||||||
|
VPU_THROW_EXCEPTION << "Cannot convert string to float. Wrong input";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -2,12 +2,14 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "graph_transformer_tests.hpp"
|
|
||||||
#include <vpu/stages/mx_stage.hpp>
|
|
||||||
#include <vpu/middleend/hw/utility.hpp>
|
#include <vpu/middleend/hw/utility.hpp>
|
||||||
#include "ngraph_functions/subgraph_builders.hpp"
|
#include <vpu/stages/mx_stage.hpp>
|
||||||
#include "vpu/private_plugin_config.hpp"
|
|
||||||
#include "common_test_utils/common_utils.hpp"
|
#include "common_test_utils/common_utils.hpp"
|
||||||
|
#include "graph_transformer_tests.hpp"
|
||||||
|
#include "ngraph_functions/subgraph_builders.hpp"
|
||||||
|
#include "vpu/configuration/options/vpu_scales_option.hpp"
|
||||||
|
#include "vpu/private_plugin_config.hpp"
|
||||||
|
|
||||||
#if defined(__GNUC__) && (__GNUC__ <= 4) && (__GNUC_MINOR__ < 9) && !defined(__clang__) && !defined(IE_GCC_4_8)
|
#if defined(__GNUC__) && (__GNUC__ <= 4) && (__GNUC_MINOR__ < 9) && !defined(__clang__) && !defined(IE_GCC_4_8)
|
||||||
#define IE_GCC_4_8
|
#define IE_GCC_4_8
|
||||||
@ -16,9 +18,7 @@
|
|||||||
using namespace vpu;
|
using namespace vpu;
|
||||||
IE_SUPPRESS_DEPRECATED_START
|
IE_SUPPRESS_DEPRECATED_START
|
||||||
namespace LayerTestsDefinitions {
|
namespace LayerTestsDefinitions {
|
||||||
typedef std::tuple<
|
typedef std::tuple<std::string> VpuScaleParams;
|
||||||
std::string
|
|
||||||
> VpuScaleParams;
|
|
||||||
|
|
||||||
class VpuScaleTest : public testing::WithParamInterface<VpuScaleParams>,
|
class VpuScaleTest : public testing::WithParamInterface<VpuScaleParams>,
|
||||||
public GraphTransformerTest {
|
public GraphTransformerTest {
|
||||||
@ -27,12 +27,9 @@ protected:
|
|||||||
void Compile() {
|
void Compile() {
|
||||||
m_pipeline.run(m_testModel);
|
m_pipeline.run(m_testModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
|
||||||
std::string configValue = {};
|
|
||||||
Model m_testModel;
|
Model m_testModel;
|
||||||
|
|
||||||
private:
|
|
||||||
void InitModel() {
|
void InitModel() {
|
||||||
int kernelx = 16;
|
int kernelx = 16;
|
||||||
int kernely = 1;
|
int kernely = 1;
|
||||||
@ -118,20 +115,21 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
void VpuScaleTest::SetUp() {
|
void VpuScaleTest::SetUp() {
|
||||||
ASSERT_NO_FATAL_FAILURE(GraphTransformerTest::SetUp());
|
|
||||||
config.set(InferenceEngine::MYRIAD_SCALES_PATTERN, configValue);
|
|
||||||
ASSERT_NO_FATAL_FAILURE(InitCompileEnv());
|
|
||||||
ASSERT_NO_FATAL_FAILURE(InitPipeline());
|
|
||||||
ASSERT_NO_FATAL_FAILURE(InitModel());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(VpuScaleTest, IsScaleWorkCorrectly) {
|
TEST_F(VpuScaleTest, IsScaleWorkCorrectly) {
|
||||||
#ifdef IE_GCC_4_8
|
#ifdef IE_GCC_4_8
|
||||||
GTEST_SKIP();
|
GTEST_SKIP();
|
||||||
#endif
|
#endif
|
||||||
configValue = "conv1:0.2; conv2:1.4";
|
std::string configValue = "conv1:0.2; conv2:1.4";
|
||||||
SetUp();
|
|
||||||
|
ASSERT_NO_FATAL_FAILURE(GraphTransformerTest::SetUp());
|
||||||
|
config.set(InferenceEngine::MYRIAD_SCALES_PATTERN, configValue);
|
||||||
|
ASSERT_NO_FATAL_FAILURE(InitCompileEnv());
|
||||||
|
ASSERT_NO_FATAL_FAILURE(InitPipeline());
|
||||||
|
ASSERT_NO_FATAL_FAILURE(InitModel());
|
||||||
ASSERT_NO_THROW(Compile());
|
ASSERT_NO_THROW(Compile());
|
||||||
|
|
||||||
for (const auto& stage : m_testModel->getStages()) {
|
for (const auto& stage : m_testModel->getStages()) {
|
||||||
auto scale = stage->attrs().getOrDefault<float>("scaleFactor");
|
auto scale = stage->attrs().getOrDefault<float>("scaleFactor");
|
||||||
if (stage->name() == "conv1") {
|
if (stage->name() == "conv1") {
|
||||||
@ -148,9 +146,15 @@ TEST_F(VpuScaleTest, IsRegexInScaleWorksCorrectly) {
|
|||||||
#ifdef IE_GCC_4_8
|
#ifdef IE_GCC_4_8
|
||||||
GTEST_SKIP();
|
GTEST_SKIP();
|
||||||
#endif
|
#endif
|
||||||
configValue = "conv1:0.2";
|
std::string configValue = "conv1:0.2";
|
||||||
SetUp();
|
ASSERT_NO_FATAL_FAILURE(GraphTransformerTest::SetUp());
|
||||||
|
config.set(InferenceEngine::MYRIAD_SCALES_PATTERN, configValue);
|
||||||
|
|
||||||
|
ASSERT_NO_FATAL_FAILURE(InitCompileEnv());
|
||||||
|
ASSERT_NO_FATAL_FAILURE(InitPipeline());
|
||||||
|
ASSERT_NO_FATAL_FAILURE(InitModel());
|
||||||
ASSERT_NO_THROW(Compile());
|
ASSERT_NO_THROW(Compile());
|
||||||
|
|
||||||
for (const auto& stage : m_testModel->getStages()) {
|
for (const auto& stage : m_testModel->getStages()) {
|
||||||
auto scale = stage->attrs().getOrDefault<float>("scaleFactor");
|
auto scale = stage->attrs().getOrDefault<float>("scaleFactor");
|
||||||
if (stage->name() == "conv1") {
|
if (stage->name() == "conv1") {
|
||||||
|
Loading…
Reference in New Issue
Block a user