diff --git a/src/tests/functional/plugin/conformance/subgraphs_dumper/CMakeLists.txt b/src/tests/functional/plugin/conformance/subgraphs_dumper/CMakeLists.txt index 8999c9d9282264..2e105315e72525 100644 --- a/src/tests/functional/plugin/conformance/subgraphs_dumper/CMakeLists.txt +++ b/src/tests/functional/plugin/conformance/subgraphs_dumper/CMakeLists.txt @@ -10,6 +10,30 @@ list(APPEND LIBRARIES openvino::core::dev ) +if(ENABLE_OV_IR_FRONTEND) + list(APPEND COMPILE_DEFINITIONS ENABLE_OV_IR_FRONTEND) +endif() + +if(ENABLE_OV_ONNX_FRONTEND) + list(APPEND COMPILE_DEFINITIONS ENABLE_OV_ONNX_FRONTEND) +endif() + +if(ENABLE_OV_PADDLE_FRONTEND) + list(APPEND COMPILE_DEFINITIONS ENABLE_OV_PADDLE_FRONTEND) +endif() + +if(ENABLE_OV_TF_FRONTEND) + list(APPEND COMPILE_DEFINITIONS ENABLE_OV_TF_FRONTEND) +endif() + +if(ENABLE_OV_TF_LITE_FRONTEND) + list(APPEND COMPILE_DEFINITIONS ENABLE_OV_TF_LITE_FRONTEND) +endif() + +if(ENABLE_OV_PYTORCH_FRONTEND) + list(APPEND COMPILE_DEFINITIONS ENABLE_OV_PYTORCH_FRONTEND) +endif() + # add subgraphs_dumpers tool ov_add_test_target( NAME ${TARGET_NAME} @@ -24,6 +48,8 @@ ov_add_test_target( DEPENDENCIES ov_frontends ${LIBRARIES} + DEFINES + ${COMPILE_DEFINITIONS} ADD_CPPLINT ) @@ -44,6 +70,8 @@ ov_add_target( DEPENDENCIES ov_frontends ${LIBRARIES} + DEFINES + ${COMPILE_DEFINITIONS} ADD_CPPLINT ) diff --git a/src/tests/functional/plugin/conformance/subgraphs_dumper/src/utils/model.cpp b/src/tests/functional/plugin/conformance/subgraphs_dumper/src/utils/model.cpp index 79b3a10225cd86..b6ff7762ee6e8a 100644 --- a/src/tests/functional/plugin/conformance/subgraphs_dumper/src/utils/model.cpp +++ b/src/tests/functional/plugin/conformance/subgraphs_dumper/src/utils/model.cpp @@ -21,10 +21,10 @@ get_input_info_by_model(const std::shared_ptr& model) { for (const auto& node : model->get_ordered_ops()) { ov::conformance::InputInfo::Range ranges(ov::conformance::DEFAULT_MIN_VALUE, ov::conformance::DEFAULT_MAX_VALUE); bool is_const = false; - if (ov::op::util::is_constant(node)) { + if (ov::op::util::is_constant(node) && ov::shape_size(node->get_output_shape(0)) != 0) { std::shared_ptr constant = std::dynamic_pointer_cast(node); auto const_ranges = get_const_ranges(constant, - constant->get_default_output().get_element_type()); + constant->get_default_output().get_element_type()); ranges = const_ranges; } else if (!ov::op::util::is_parameter(node)) { continue; diff --git a/src/tests/functional/plugin/conformance/subgraphs_dumper/src/utils/node.cpp b/src/tests/functional/plugin/conformance/subgraphs_dumper/src/utils/node.cpp index 4f3b37a1f04aff..48a12bded403d9 100644 --- a/src/tests/functional/plugin/conformance/subgraphs_dumper/src/utils/node.cpp +++ b/src/tests/functional/plugin/conformance/subgraphs_dumper/src/utils/node.cpp @@ -87,12 +87,16 @@ get_input_info_by_node(const std::shared_ptr& node) { ov::conformance::InputInfo in_info(node->get_input_partial_shape(port_id)); std::string input_name = input_node->get_friendly_name(); if (std::dynamic_pointer_cast(input_node)) { - if (ov::shape_size(input_node->get_output_shape(0)) == 0) - continue; - auto const_node = ov::as_type_ptr(input_node); - in_info.is_const = true; - in_info.ranges = get_const_ranges(const_node, - const_node->get_default_output().get_element_type()); + if (ov::shape_size(input_node->get_output_shape(0)) == 0) { + auto const_node = ov::as_type_ptr(input_node); + in_info.is_const = true; + in_info.ranges = ov::conformance::InputInfo::Range(ov::conformance::DEFAULT_MIN_VALUE, ov::conformance::DEFAULT_MAX_VALUE); + } else { + auto const_node = ov::as_type_ptr(input_node); + in_info.is_const = true; + in_info.ranges = get_const_ranges(const_node, + const_node->get_default_output().get_element_type()); + } } input_info.insert({input_name, in_info}); } diff --git a/src/tests/test_utils/functional_test_utils/layer_tests_summary/conformance_helper_tools/find_models_for_subgraphs_dumper.py b/src/tests/test_utils/functional_test_utils/layer_tests_summary/conformance_helper_tools/find_models_for_subgraphs_dumper.py index 480193e9c6d4c2..051a60b212b913 100644 --- a/src/tests/test_utils/functional_test_utils/layer_tests_summary/conformance_helper_tools/find_models_for_subgraphs_dumper.py +++ b/src/tests/test_utils/functional_test_utils/layer_tests_summary/conformance_helper_tools/find_models_for_subgraphs_dumper.py @@ -17,6 +17,10 @@ def get_default_re_path(is_take_all_models = False): SCRIPT_DIR_PATH, _ = os.path.split(os.path.abspath(__file__)) return os.path.join(SCRIPT_DIR_PATH, "..", "data", "custom_re_to_find_models.lst") if is_take_all_models else os.path.join(SCRIPT_DIR_PATH, "..", "data", "default_re_to_find_models.lst") +def get_default_re_exclude_model_path(is_take_all_models = False): + SCRIPT_DIR_PATH, _ = os.path.split(os.path.abspath(__file__)) + return '' if is_take_all_models else os.path.join(SCRIPT_DIR_PATH, "..", "data", "default_re_to_exclude_modes.lst") + def parse_arguments(): parser = ArgumentParser() @@ -24,6 +28,7 @@ def parse_arguments(): output_help = "Path to output dir to save model list file" filename_help = "Output filename to save model list file" latest_only_help = "Use only latest directory matched reg exp. In other case all directories will be taken from the dir" + exclude_model_list = "" parser.add_argument("-m", "--model_dirs", type=str, help=model_help, required=True) parser.add_argument("-o", "--output_dir", type=str, help=output_help, required=False, default=".") @@ -54,7 +59,7 @@ def str_to_dir_list(input_str: str): return dir_path_list -def read_dir_re_exp(re_exp_file_path: str): +def read_re_exp(re_exp_file_path: str): dir_re_exps = [] if os.path.isfile(re_exp_file_path): with open(re_exp_file_path, "r") as re_exp_file: @@ -64,14 +69,15 @@ def read_dir_re_exp(re_exp_file_path: str): dir_re_exps.append(line.replace('\n', '')) if len(dir_re_exps) == 0: dir_re_exps.append('*') - logger.info(f"Model dir re exp list: {dir_re_exps}") return dir_re_exps +import re -def generate_model_list_file(input_str: str, re_exp_file_path: str, output_file_path: os.path, is_latest_only: bool): +def generate_model_list_file(input_str: str, re_exp_file_path: str, output_file_path: os.path, is_latest_only: bool, re_exclude_model_file: str): with open(output_file_path, 'w', newline='\n') as output_file: model_dir_paths = str_to_dir_list(input_str) - dir_re_exps = read_dir_re_exp(re_exp_file_path) + dir_re_exps = read_re_exp(re_exp_file_path) + logger.info(f"Model dir re exp list: {dir_re_exps}") model_list = list() for model_dir_path in model_dir_paths: for dir_re_exp in dir_re_exps: @@ -92,9 +98,16 @@ def generate_model_list_file(input_str: str, re_exp_file_path: str, output_file_ break except: pass + exclude_re_exps = read_re_exp(re_exclude_model_file) if re_exclude_model_file else [] + logger.info(f"Model exclude re exp list: {dir_re_exps}") for line in model_list: str_line = str(line) - if "tfhub_module.pb" in str_line or "_metadata.pb" in str_line: + exclude = False + for r in exclude_re_exps: + print('aa', r) + if re.match(r, str_line): + exclude = True + if "tfhub_module.pb" in str_line or "_metadata.pb" in str_line or exclude: continue output_file.write(f"{line}\n") output_file.close() @@ -107,8 +120,9 @@ def generate_model_list_file(input_str: str, re_exp_file_path: str, output_file_ logger.info(f"[ ARGUMENTS ] --filename={args.filename}") logger.info(f"[ ARGUMENTS ] --latest_only={args.latest_only}") re_file = get_default_re_path(not args.latest_only) + re_exclude_model_file = get_default_re_exclude_model_path(not args.latest_only) if not args.latest_only: logger.warning(f"{re_file} will be taken to get all models from the dirs") output_model_list_file = os.path.join(args.output_dir, f"{args.filename}.lst") - generate_model_list_file(args.model_dirs, re_file, output_model_list_file, args.latest_only) + generate_model_list_file(args.model_dirs, re_file, output_model_list_file, args.latest_only, re_exclude_model_file) logger.info(f"Model file list is saved to {output_model_list_file}") diff --git a/src/tests/test_utils/functional_test_utils/layer_tests_summary/data/default_re_to_exclude_modes.lst b/src/tests/test_utils/functional_test_utils/layer_tests_summary/data/default_re_to_exclude_modes.lst new file mode 100644 index 00000000000000..2c82755b760a41 --- /dev/null +++ b/src/tests/test_utils/functional_test_utils/layer_tests_summary/data/default_re_to_exclude_modes.lst @@ -0,0 +1 @@ +.*onnx.*torchvision_swin3d_b.* \ No newline at end of file