Allow to specify conformance by shape_type (#10667)

* Init

* the solution

* Remove extra

* Update CMakeLists.txt

* Readme

* fix build

* dd
This commit is contained in:
Irina Efode
2022-02-28 15:06:03 +03:00
committed by GitHub
parent bed0adf5ef
commit f6fbef1f66
6 changed files with 47 additions and 13 deletions

View File

@@ -4,6 +4,13 @@
set(TARGET_NAME subgraphsDumper)
list(APPEND DEPENDENCIES
gflags
inference_engine
commonTestUtils
pugixml::static
)
addIeTargetTest(
NAME ${TARGET_NAME}
ROOT ${CMAKE_CURRENT_SOURCE_DIR}
@@ -11,10 +18,9 @@ addIeTargetTest(
${CMAKE_CURRENT_SOURCE_DIR}/include
LINK_LIBRARIES
PRIVATE
gflags
inference_engine
commonTestUtils
pugixml::static
${DEPENDENCIES}
DEPENDENCIES
${DEPENDENCIES}
ADD_CPPLINT
)

View File

@@ -45,6 +45,8 @@ The target is able to take the following command-line arguments:
* `--save_report_timeout` allows to try to save report in cycle using timeout (in seconds).
* `--output_folder` Paths to the output folder to save report.
* `--extract_body` allows to count extracted operation bodies to report.
* `--shape_mode` Optional. Allows to run `static`, `dynamic` or both scenarios. Default value is empty string allows to run both scenarios. Possible values
are `static`, `dynamic`, ``
* All `gtest` command-line parameters
The result of execution is `report.xml` file. It demonstrates tests statistic like pass rate, passed, crashed, skipped failed tests and plugin implementation

View File

@@ -33,6 +33,8 @@ static const char skip_config_path_message[] = "Optional. Allows to specify path
static const char config_path_message[] = "Optional. Allows to specify path to file contains plugin config. "
"Default value is empty string.";
static const char extract_body_message[] = "Optional. Allows to count extracted operation bodies to report. Default value is false.";
static const char shape_mode_message[] = "Optional. Allows to run `static`, `dynamic` or both scenarios. Default value is empty string allows to run both"
" scenarios. Possible values are `static`, `dynamic`, ``";
DEFINE_bool(h, false, help_message);
@@ -47,6 +49,7 @@ DEFINE_bool(disable_test_config, true, disable_test_config_message);
DEFINE_bool(extend_report, false, extend_report_config_message);
DEFINE_bool(report_unique_name, false, report_unique_name_message);
DEFINE_bool(extract_body, false, extract_body_message);
DEFINE_string(shape_mode, "", shape_mode_message);
/**
* @brief This function shows a help message
@@ -68,6 +71,7 @@ static void showUsage() {
std::cout << " --input_folders \"<paths>\" " << input_folders_message << std::endl;
std::cout << " --output_folder \"<path>\" " << output_folder_message << std::endl;
std::cout << " --plugin_lib_name " << output_folder_message << std::endl;
std::cout << " --shape_mode \"<value>\" " << shape_mode_message << std::endl;
}
} // namespace conformance

View File

@@ -10,6 +10,14 @@ namespace ov {
namespace test {
namespace subgraph {
enum ShapeMode {
DYNAMIC,
STATIC,
BOTH
};
extern ShapeMode shapeMode;
using ReadIRParams = std::tuple<
std::string, // IR path
std::string, // Target Device

View File

@@ -2,12 +2,18 @@
// SPDX-License-Identifier: Apache-2.0
//
#include <signal.h>
#ifdef _WIN32
#include <process.h>
#endif
#include "gtest/gtest.h"
#include "common_test_utils/file_utils.hpp"
#include "functional_test_utils/skip_tests_config.hpp"
#include "shared_test_classes/base/layer_test_utils.hpp"
#include "functional_test_utils/layer_test_utils/environment.hpp"
#include "read_ir_test/read_ir.hpp"
#include "gflag_config.hpp"
#include "conformance.hpp"
@@ -42,6 +48,13 @@ int main(int argc, char* argv[]) {
LayerTestsUtils::Summary::setSaveReportWithUniqueName(FLAGS_report_unique_name);
LayerTestsUtils::Summary::setOutputFolder(FLAGS_output_folder);
LayerTestsUtils::Summary::setSaveReportTimeout(FLAGS_save_report_timeout);
if (FLAGS_shape_mode == std::string("static")) {
ov::test::subgraph::shapeMode = ov::test::subgraph::ShapeMode::STATIC;
} else if (FLAGS_shape_mode == std::string("dynamic")) {
ov::test::subgraph::shapeMode = ov::test::subgraph::ShapeMode::DYNAMIC;
} else if (FLAGS_shape_mode != std::string("")) {
throw std::runtime_error("Incorrect value for `--shape_mode`. Should be `dynamic`, `static` or ``. Current value is `" + FLAGS_shape_mode + "`");
}
// ---------------------------Initialization of Gtest env -----------------------------------------------
ov::test::conformance::targetDevice = FLAGS_device.c_str();

View File

@@ -24,6 +24,9 @@
namespace ov {
namespace test {
namespace subgraph {
ShapeMode shapeMode = ShapeMode::BOTH;
std::string ReadIRTest::getTestCaseName(const testing::TestParamInfo<ReadIRParams> &obj) {
using namespace CommonTestUtils;
std::string pathToModel, deviceName;
@@ -158,19 +161,17 @@ void ReadIRTest::SetUp() {
}
}
}
std::vector<ov::Shape> staticShapes;
for (const auto param : function->get_parameters()) {
if (param->get_partial_shape().is_static()) {
staticShapes.push_back(param->get_shape());
} else {
staticShapes.push_back(param->get_partial_shape().get_max_shape());
}
}
std::vector<InputShape> inputShapes;
for (const auto& param : function -> get_parameters()) {
if (param->get_partial_shape().is_static()) {
if (ov::test::subgraph::shapeMode == ov::test::subgraph::ShapeMode::DYNAMIC) {
GTEST_SKIP() << "Static cases are skipped according `shape_mode`";
}
inputShapes.push_back(InputShape{{}, {param->get_shape()}});
} else {
if (ov::test::subgraph::shapeMode == ov::test::subgraph::ShapeMode::STATIC) {
GTEST_SKIP() << "Dynamic cases are skipped according `shape_mode`";
}
ov::Shape midShape;
for (const auto s : param->get_partial_shape()) {
int dimValue = s.get_length();