Add configure model

This commit is contained in:
Efode, Irina 2021-10-13 20:19:43 +03:00
parent d09dc07a3f
commit 707d549ce8
5 changed files with 45 additions and 42 deletions

View File

@ -34,8 +34,8 @@ const std::vector<size_t> axis2D = {
const auto params2D_static = testing::Combine( const auto params2D_static = testing::Combine(
testing::ValuesIn(netPrecisions), testing::ValuesIn(netPrecisions),
// testing::Values(InferenceEngine::Precision::UNSPECIFIED), testing::Values(ov::element::Type_t::undefined),
// testing::Values(InferenceEngine::Precision::UNSPECIFIED), testing::Values(ov::element::Type_t::undefined),
testing::ValuesIn(inputStaticShape2D), testing::ValuesIn(inputStaticShape2D),
testing::ValuesIn(axis2D), testing::ValuesIn(axis2D),
testing::Values(CommonTestUtils::DEVICE_CPU), testing::Values(CommonTestUtils::DEVICE_CPU),
@ -44,8 +44,8 @@ const auto params2D_static = testing::Combine(
const auto params2D_dynamic = testing::Combine( const auto params2D_dynamic = testing::Combine(
testing::ValuesIn(netPrecisions), testing::ValuesIn(netPrecisions),
// testing::Values(InferenceEngine::Precision::UNSPECIFIED), testing::Values(ov::element::Type_t::undefined),
// testing::Values(InferenceEngine::Precision::UNSPECIFIED), testing::Values(ov::element::Type_t::undefined),
testing::ValuesIn(inputDynamicShape2D), testing::ValuesIn(inputDynamicShape2D),
testing::ValuesIn(axis2D), testing::ValuesIn(axis2D),
testing::Values(CommonTestUtils::DEVICE_CPU), testing::Values(CommonTestUtils::DEVICE_CPU),
@ -82,8 +82,8 @@ const std::vector<size_t> axis4D = {0, 1, 2, 3};
const auto params4Dstatic = testing::Combine( const auto params4Dstatic = testing::Combine(
testing::ValuesIn(netPrecisions), testing::ValuesIn(netPrecisions),
// testing::Values(InferenceEngine::Precision::UNSPECIFIED), testing::Values(ov::element::Type_t::undefined),
// testing::Values(InferenceEngine::Precision::UNSPECIFIED), testing::Values(ov::element::Type_t::undefined),
testing::ValuesIn(inputStaticShape4D), testing::ValuesIn(inputStaticShape4D),
testing::ValuesIn(axis4D), testing::ValuesIn(axis4D),
testing::Values(CommonTestUtils::DEVICE_CPU), testing::Values(CommonTestUtils::DEVICE_CPU),
@ -92,8 +92,8 @@ const auto params4Dstatic = testing::Combine(
const auto params4Ddynamic = testing::Combine( const auto params4Ddynamic = testing::Combine(
testing::ValuesIn(netPrecisions), testing::ValuesIn(netPrecisions),
// testing::Values(InferenceEngine::Precision::UNSPECIFIED), testing::Values(ov::element::Type_t::undefined),
// testing::Values(InferenceEngine::Precision::UNSPECIFIED), testing::Values(ov::element::Type_t::undefined),
testing::ValuesIn(inputDynamicShape4D), testing::ValuesIn(inputDynamicShape4D),
testing::ValuesIn(axis4D), testing::ValuesIn(axis4D),
testing::Values(CommonTestUtils::DEVICE_CPU), testing::Values(CommonTestUtils::DEVICE_CPU),

View File

@ -68,7 +68,7 @@ protected:
// //
//#endif //#endif
// virtual void configure_model(); virtual void configure_model();
virtual void compile_model(); virtual void compile_model();
virtual void generate_inputs(const std::vector<ngraph::Shape>& targetInputStaticShapes); virtual void generate_inputs(const std::vector<ngraph::Shape>& targetInputStaticShapes);
@ -86,8 +86,8 @@ protected:
std::shared_ptr<ngraph::Function> function; std::shared_ptr<ngraph::Function> function;
std::shared_ptr<ngraph::Function> functionRefs; std::shared_ptr<ngraph::Function> functionRefs;
ov::element::Type inPrc; ov::element::Type_t inType;
ov::element::Type outPrc; ov::element::Type_t outType;
std::map<std::string, ov::runtime::Tensor> inputs; std::map<std::string, ov::runtime::Tensor> inputs;
std::vector<ngraph::PartialShape> inputDynamicShapes; std::vector<ngraph::PartialShape> inputDynamicShapes;
std::vector<std::vector<ngraph::Shape>> targetStaticShapes; std::vector<std::vector<ngraph::Shape>> targetStaticShapes;

View File

@ -18,8 +18,8 @@ namespace LayerTestsDefinitions {
using softMaxLayerTestParams = std::tuple< using softMaxLayerTestParams = std::tuple<
ngraph::element::Type_t, // netPrecision ngraph::element::Type_t, // netPrecision
// ngraph::element::Type, // Input precision ngraph::element::Type_t, // Input precision
// ngraph::element::Type, // Output precision ngraph::element::Type_t, // Output precision
// InferenceEngine::Layout, // Input layout // InferenceEngine::Layout, // Input layout
// InferenceEngine::Layout, // Output layout // InferenceEngine::Layout, // Output layout
std::pair<ov::PartialShape, std::vector<ov::Shape>>, // Dynamic shape + Target static shapes std::pair<ov::PartialShape, std::vector<ov::Shape>>, // Dynamic shape + Target static shapes

View File

@ -76,8 +76,8 @@ void SubgraphBaseTest::serialize() {
std::string out_xml_path = output_name + ".xml"; std::string out_xml_path = output_name + ".xml";
std::string out_bin_path = output_name + ".bin"; std::string out_bin_path = output_name + ".bin";
ngraph::pass::Manager manager; ov::pass::Manager manager;
manager.register_pass<ngraph::pass::Serialize>(out_xml_path, out_bin_path); manager.register_pass<ov::pass::serialize>(out_xml_path, out_bin_path);
manager.run_passes(function); manager.run_passes(function);
function->validate_nodes_and_infer_types(); function->validate_nodes_and_infer_types();
@ -140,26 +140,30 @@ void SubgraphBaseTest::compare(const std::vector<ov::runtime::Tensor> &expected,
// ASSERT_EQ(expected.get_shape(), actual.get_shape()); // ASSERT_EQ(expected.get_shape(), actual.get_shape());
//} //}
//void SubgraphBaseTest::configure_model() { void SubgraphBaseTest::configure_model() {
// // configure input precision // configure input precision
// { {
// auto params = function->get_parameters(); auto params = function->get_parameters();
// for (auto& param : params) { for (auto& param : params) {
// param->get_output_tensor(0).set_element_type(inPrc); if (inType != ov::element::Type_t::undefined) {
// } param->get_output_tensor(0).set_element_type(inType);
// } }
// }
// // configure output precision }
// {
// auto results = function->get_results(); // configure output precision
// for (auto& result : results) { {
// result->get_output_tensor(0).set_element_type(outPrc); auto results = function->get_results();
// } for (auto& result : results) {
// } if (outType != ov::element::Type_t::undefined) {
//} result->get_output_tensor(0).set_element_type(outType);
}
}
}
}
void SubgraphBaseTest::compile_model() { void SubgraphBaseTest::compile_model() {
// configure_model(); configure_model();
executableNetwork = core->compile_model(function, targetDevice, configuration); executableNetwork = core->compile_model(function, targetDevice, configuration);
} }
@ -180,7 +184,7 @@ void SubgraphBaseTest::infer() {
} }
inferRequest.infer(); inferRequest.infer();
} }
//
std::vector<ov::runtime::Tensor> SubgraphBaseTest::calculate_refs() { std::vector<ov::runtime::Tensor> SubgraphBaseTest::calculate_refs() {
// nGraph interpreter does not support f16/bf16 // nGraph interpreter does not support f16/bf16
ngraph::pass::ConvertPrecision<element::Type_t::f16, element::Type_t::f32>().run_on_function(function); ngraph::pass::ConvertPrecision<element::Type_t::f16, element::Type_t::f32>().run_on_function(function);
@ -193,7 +197,7 @@ std::vector<ov::runtime::Tensor> SubgraphBaseTest::calculate_refs() {
auto expectedOutputs = ngraph::helpers::interpreterFunction(function, referenceInputs); auto expectedOutputs = ngraph::helpers::interpreterFunction(function, referenceInputs);
return expectedOutputs; return expectedOutputs;
} }
//
std::vector<ov::runtime::Tensor> SubgraphBaseTest::get_outputs() { std::vector<ov::runtime::Tensor> SubgraphBaseTest::get_outputs() {
auto outputs = std::vector<ov::runtime::Tensor>{}; auto outputs = std::vector<ov::runtime::Tensor>{};
for (const auto& output : executableNetwork.get_results()) { for (const auto& output : executableNetwork.get_results()) {

View File

@ -7,18 +7,17 @@
namespace LayerTestsDefinitions { namespace LayerTestsDefinitions {
std::string SoftMaxLayerTest::getTestCaseName(const testing::TestParamInfo<softMaxLayerTestParams>& obj) { std::string SoftMaxLayerTest::getTestCaseName(const testing::TestParamInfo<softMaxLayerTestParams>& obj) {
ngraph::element::Type_t netPrecision; ov::element::Type_t netType, inType, outType;
// InferenceEngine::Precision inPrc, outPrc;
std::pair<ngraph::PartialShape, std::vector<ngraph::Shape>> shapes; std::pair<ngraph::PartialShape, std::vector<ngraph::Shape>> shapes;
size_t axis; size_t axis;
std::string targetDevice; std::string targetDevice;
std::map<std::string, std::string> config; std::map<std::string, std::string> config;
std::tie(netPrecision, shapes, axis, targetDevice, config) = obj.param; std::tie(netType, inType, outType, shapes, axis, targetDevice, config) = obj.param;
std::ostringstream result; std::ostringstream result;
result << "netPRC=" << netPrecision << "_"; result << "NetType=" << netType << "_";
// result << "inPRC=" << inPrc.name() << "_"; result << "InType=" << inType << "_";
// result << "outPRC=" << outPrc.name() << "_"; result << "OutType=" << outType << "_";
result << "IS=" << CommonTestUtils::partialShape2str({shapes.first}) << "_"; result << "IS=" << CommonTestUtils::partialShape2str({shapes.first}) << "_";
result << "TS="; result << "TS=";
for (const auto& item : shapes.second) { for (const auto& item : shapes.second) {
@ -35,7 +34,7 @@ void SoftMaxLayerTest::SetUp() {
ngraph::element::Type_t ngPrc; ngraph::element::Type_t ngPrc;
size_t axis; size_t axis;
std::tie(ngPrc, shapes, axis, targetDevice, configuration) = GetParam(); std::tie(ngPrc, inType, outType, shapes, axis, targetDevice, configuration) = GetParam();
init_input_shapes(shapes); init_input_shapes(shapes);
const auto params = ngraph::builder::makeDynamicParams(ngPrc, inputDynamicShapes); const auto params = ngraph::builder::makeDynamicParams(ngPrc, inputDynamicShapes);