repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
openvino
tools/ovc/unit_tests/moc_tf_fe/check_info_messages_test.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import argparse import io import os import unittest from contextlib import redirect_stdout from unittest.mock import patch from openvino.tools.ovc.main import main from openvino.tools.ovc.get_ov_update_message import get_compression_mes...
62
2,311
openvino
tools/ovc/unit_tests/moc_tf_fe/conversion_with_checkpoint_v1_test.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import tempfile import unittest import numpy as np from unit_tests.moc_tf_fe.utils import basic_check class TestBasicConversion(unittest.TestCase): def prepare_checkpoint_v1(self): # quite old TensorFlow version can produ...
42
2,266
openvino
tools/ovc/unit_tests/moc_tf_fe/conversion_incorrect_models_test.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import tempfile import unittest from openvino.tools.ovc.convert import convert_model class TestMoFreezePlaceholderTFFE(unittest.TestCase): def test_conversion_fake_pb_model(self): # TODO: Should FEs give detailed...
18
624
openvino
tools/ovc/unit_tests/moc_tf_fe/test_models/placeholder_with_default.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import tensorflow.compat.v1 as tf tf.reset_default_graph() with tf.Session() as sess: x = tf.placeholder(tf.int32, [None, 3], 'x') y = tf.placeholder_with_default(tf.constant([[1, 2, 3], [4, 5, 6]], dtype=tf.int32), ...
17
517
openvino
tools/ovc/unit_tests/moc_tf_fe/test_models/model_int32.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import tensorflow.compat.v1 as tf tf.reset_default_graph() with tf.Session() as sess: x = tf.placeholder(tf.int32, [2, 3], 'in1') y = tf.placeholder(tf.int32, [2, 3], 'in2') tf.multiply(x, y, name="add") tf.global_varia...
16
427
openvino
tools/ovc/unit_tests/moc_tf_fe/test_models/model_with_if.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import tensorflow.compat.v1 as tf from tensorflow.python.framework import function tf.reset_default_graph() @function.Defun(tf.int32, tf.int32) def then_branch_func(x, y): return x + y @function.Defun(tf.int32, tf.int32) def els...
33
960
openvino
tools/ovc/unit_tests/moc_tf_fe/test_models/model_fp32.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import tensorflow.compat.v1 as tf tf.reset_default_graph() with tf.Session() as sess: x = tf.placeholder(tf.float32, [2, 2], 'in1') y = tf.placeholder(tf.float32, [2, 2], 'in2') tf.add(x, y, name="add") tf.global_variab...
16
425
openvino
tools/ovc/unit_tests/moc_tf_fe/test_models/model_mul_with_undefined_constant.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import tensorflow.compat.v1 as tf tf.reset_default_graph() # Create the graph and model with tf.Session() as sess: x = tf.placeholder(tf.int32, [2], 'x') const = tf.constant(value=[], dtype=tf.int32, shape=[], name='Const') ...
14
489
openvino
tools/ovc/unit_tests/moc_tf_fe/test_models/model_bool.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import tensorflow.compat.v1 as tf tf.reset_default_graph() with tf.Session() as sess: x = tf.placeholder(tf.bool, [2, 3], 'in1') y = tf.placeholder(tf.bool, [2, 3], 'in2') tf.math.logical_and(x, y) tf.global_variables_i...
16
420
openvino
tools/ovc/unit_tests/moc_tf_fe/test_models/model_switch_merge.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import tensorflow.compat.v1 as tf tf.reset_default_graph() with tf.Session() as sess: x = tf.placeholder(tf.float32, [2, 3], 'x') y = tf.placeholder(tf.float32, [2, 3], 'y') is_training = tf.placeholder(tf.bool, [], 'is_trai...
21
702
openvino
tools/ovc/unit_tests/moc_tf_fe/test_models/mul_with_unknown_rank_y.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import tensorflow.compat.v1 as tf tf.reset_default_graph() with tf.Session() as sess: x = tf.placeholder(tf.float32, [3], 'x') keep_prob = tf.placeholder(tf.float32, None, 'y') tf.multiply(x, keep_prob) tf.global_variab...
16
438
openvino
tools/ovc/unit_tests/moc_tf_fe/test_models/model_with_convolution_dynamic_rank.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import tensorflow.compat.v1 as tf tf.reset_default_graph() with tf.Session() as sess: x = tf.placeholder(tf.float32, None, 'x') filter = tf.placeholder(tf.float32, [2, 2, 3, 1], 'kernel') conv2d = tf.raw_ops.Conv2D(input=x,...
19
616
openvino
tools/ovc/unit_tests/moc_tf_fe/test_models/model_three_inputs.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import tensorflow.compat.v1 as tf tf.reset_default_graph() with tf.Session() as sess: x = tf.placeholder(tf.float32, [3], 'x') y = tf.placeholder(tf.float32, [3], 'y') z = tf.placeholder(tf.float32, [3], 'z') add = tf.ad...
18
515
openvino
tools/ovc/unit_tests/moc_tf_fe/test_models/model_add_with_undefined_constant.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import tensorflow.compat.v1 as tf tf.reset_default_graph() # Create the graph and model with tf.Session() as sess: x = tf.placeholder(tf.float32, [2, 3], 'x') const = tf.constant(value=[], dtype=tf.float32, shape=[3], name='Cons...
14
492
openvino
tools/ovc/unit_tests/moc_tf_fe/test_models/model_bool2.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import tensorflow.compat.v1 as tf tf.reset_default_graph() with tf.Session() as sess: x = tf.placeholder(tf.float32, [3], 'in1') y = tf.placeholder(tf.float32, [3], 'in2') cond = tf.placeholder(tf.bool, [], 'cond') tf.wh...
17
463
openvino
tools/ovc/openvino/tools/ovc/error.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import re class BasicError(Exception): """ Base class for all exceptions in Model Conversion API It operates like Exception but when it is converted to str, it formats string as args[0].format(*args[1:]), where ...
50
1,463
openvino
tools/ovc/openvino/tools/ovc/logger.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import importlib.util import logging as log import os import re from copy import copy # WA for abseil bug that affects logging while importing TF starting 1.14 version # Link to original issue: https://github.com/abseil/abseil-py/issues...
95
3,172
openvino
tools/ovc/openvino/tools/ovc/get_ov_update_message.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import datetime msg_fmt = 'Check for a new version of Intel(R) Distribution of OpenVINO(TM) toolkit here {0} ' \ 'or on https://github.com/openvinotoolkit/openvino' def get_compression_message(): link = "https://docs.ope...
17
739
openvino
tools/ovc/openvino/tools/ovc/main.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import sys try: import openvino_telemetry as tm from openvino_telemetry.backend import backend_ga4 except ImportError: import openvino.tools.ovc.telemetry_stub as tm from openvino.tools.ovc.convert_impl import _convert from ...
41
1,336
openvino
tools/ovc/openvino/tools/ovc/utils.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import importlib.util import logging as log import numpy as np import os import sys from openvino.tools.ovc.error import Error from collections.abc import Iterable from typing import Union try: import openvino_telemetry as tm fr...
198
7,647
openvino
tools/ovc/openvino/tools/ovc/convert_impl.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import argparse import datetime import logging as log import os import sys import traceback import tracemalloc from collections import OrderedDict from pathlib import Path from collections.abc import Callable, Iterable try: import o...
590
24,575
openvino
tools/ovc/openvino/tools/ovc/convert_data_type.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np from openvino.tools.ovc.error import Error """ Packed data of custom types are stored in numpy uint8 data type. To distinguish true uint8 and custom data we introduce this class not to store, but to have unique data ...
83
2,500
openvino
tools/ovc/openvino/tools/ovc/cli_parser.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import argparse import inspect import os import pathlib import re from collections import OrderedDict, namedtuple from typing import Union import openvino from openvino import PartialShape, Dimension, Type # pylint: disable=no-name-in-...
634
25,011
openvino
tools/ovc/openvino/tools/ovc/convert.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pathlib from typing import Any from openvino import Model # pylint: disable=no-name-in-module,import-error from openvino.tools.ovc.cli_parser import get_all_cli_parser from openvino.tools.ovc.convert_impl import _convert from op...
118
5,411
openvino
tools/ovc/openvino/tools/ovc/ovc.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # !/usr/bin/env python3 import sys if __name__ == "__main__": from openvino.tools.ovc.telemetry_utils import init_ovc_telemetry from openvino.tools.ovc.main import main init_ovc_telemetry() sys.exit(main())
14
309
openvino
tools/ovc/openvino/tools/ovc/__init__.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import sys from openvino.tools.ovc.convert import convert_model from openvino.tools.ovc.telemetry_utils import is_optimum, init_ovc_telemetry, is_torch_compile, is_keras3 import importlib.metadata as importlib_metadata try: optimum...
32
1,443
openvino
tools/ovc/openvino/tools/ovc/version.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import re from openvino import get_version as get_ie_version # pylint: disable=no-name-in-module,import-error def extract_release_version(version: str): patterns = [ # captures release version set by CI for example: '2021...
81
2,554
openvino
tools/ovc/openvino/tools/ovc/telemetry_params.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 telemetry_params = { 'TID': "G-W5E9RNLD4H" }
7
132
openvino
tools/ovc/openvino/tools/ovc/environment_setup_utils.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import sys # do not print INFO and WARNING messages from TensorFlow os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' def get_imported_module_version(imported_module): """ Get imported module version :return: version(str)...
51
1,656
openvino
tools/ovc/openvino/tools/ovc/telemetry_utils.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import argparse import numbers import os from openvino import get_version as get_rt_version # pylint: disable=no-name-in-module,import-error from openvino.tools.ovc.cli_parser import get_params_with_paths_list from openvino.tools.ovc.te...
129
4,642
openvino
tools/ovc/openvino/tools/ovc/telemetry_stub.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 class Telemetry(object): """ Stab file for the Telemetry class which is used when Telemetry class is not available. """ def __init__(self, *arg, **kwargs): pass def send_event(self, *arg, **kwargs): ...
29
619
openvino
tools/ovc/openvino/tools/ovc/help.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 def get_convert_model_help_specifics(): from openvino.tools.ovc.cli_parser import CanonicalizePathCheckExistenceAction, readable_dirs_or_files_or_empty from openvino.tools.ovc.version import VersionChecker return { 'i...
49
2,791
openvino
tools/ovc/openvino/tools/ovc/moc_frontend/type_utils.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import sys import numpy as np import openvino as ov from openvino import Type def is_type(val): if isinstance(val, (type, Type)): return True if 'tensorflow' in sys.modules: import tensorflow as tf # pylint: d...
83
2,753
openvino
tools/ovc/openvino/tools/ovc/moc_frontend/pipeline.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import argparse import logging as log import sys import numpy as np import os from openvino.frontend import FrontEnd, InputModel, NotImplementedFailure, \ Place # pylint: disable=no-name-in-module,import-error from openvino import...
295
14,073
openvino
tools/ovc/openvino/tools/ovc/moc_frontend/analysis.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import json from openvino import PartialShape, Model, Type # pylint: disable=no-name-in-module,import-error from openvino.utils.types import get_dtype # pylint: disable=no-name-in-module,import-error def json_model_analysis_dump(fra...
47
2,015
openvino
tools/ovc/openvino/tools/ovc/moc_frontend/paddle_frontend_utils.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import sys import tempfile class paddle_frontend_converter: def __init__(self, model, inputs=None, outputs=None): self.model = model self.inputs = inputs self.outputs = outputs self.tmp = N...
84
3,392
openvino
tools/ovc/openvino/tools/ovc/moc_frontend/extractor.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import re from enum import Enum import numpy as np from openvino._pyopenvino import Place, PartialShape # pylint: disable=no-name-in-module,import-error from openvino.frontend import InputModel # pylint: disable=no-name-in-module,impo...
448
18,316
openvino
tools/ovc/openvino/tools/ovc/moc_frontend/jax_frontend_utils.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import logging as log def get_jax_decoder(model, args): try: from openvino.frontend.jax.jaxpr_decoder import JaxprPythonDecoder except Exception as e: log.error("JAX frontend loading failed") raise e ...
20
481
openvino
tools/ovc/openvino/tools/ovc/moc_frontend/shape_utils.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import sys import numpy as np from openvino import Shape, PartialShape, Dimension # pylint: disable=no-name-in-module,import-error from openvino.tools.ovc.error import Error def get_static_shape(shape: [PartialShape, list, tuple], dy...
110
4,025
openvino
tools/ovc/openvino/tools/ovc/moc_frontend/check_config.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import argparse import os from pathlib import Path from openvino.tools.ovc.error import Error def default_path(): EXT_DIR_NAME = '.' return os.path.abspath(os.getcwd().join(EXT_DIR_NAME)) def any_extensions_used(argv: argpar...
58
2,040
openvino
tools/ovc/openvino/tools/ovc/moc_frontend/pytorch_frontend_utils.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import logging as log import pathlib import sys import numpy as np # pylint: disable=no-name-in-module,import-error from openvino import Tensor, PartialShape from openvino.tools.ovc.cli_parser import input_to_input_cut_info, single_inp...
439
17,879
openvino
tools/ovc/openvino/tools/ovc/moc_frontend/preprocessing.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import argparse import logging as log from openvino.preprocess import PrePostProcessor # pylint: disable=no-name-in-module,import-error # pylint: disable=no-name-in-module,import-error from openvino import Model, Layout, PartialShape f...
221
10,253
openvino
tools/ovc/openvino/tools/ovc/moc_frontend/offline_transformations.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openvino.tools.ovc.error import Error def get_new_placeholder_name(node_id: str, is_out_port: bool = False, port: int = 0): """ Forms a name of new placeholder created by cutting a graph :param node_id: a node name tha...
106
4,274
openvino
tools/ovc/openvino/tools/ovc/moc_frontend/moc_emit_ir.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import argparse from openvino import Model # pylint: disable=no-name-in-module,import-error from openvino.tools.ovc.moc_frontend.preprocessing import apply_preprocessing def moc_emit_ir(ngraph_function: Model, argv: argparse.Namespac...
33
1,424
openvino
tools/ovc/openvino/tools/ovc/moc_frontend/layout_utils.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from collections.abc import Callable from openvino import PartialShape # pylint: disable=no-name-in-module,import-error from openvino.tools.ovc.error import Error from openvino.tools.ovc.utils import refer_to_faq_msg def update_layou...
74
3,250
openvino
tools/commit_slider/commit_slider.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import subprocess # nosec B404 import os import shutil import sys from shutil import copytree from utils.cfg_manager import CfgManager from utils.helpers import safeClearDir, getParams, getActualCfg args, cfgData, customCfgPath = getPa...
122
4,366
openvino
tools/commit_slider/tests/commit_slider_test.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import sys import os from unittest import TestCase from tempfile import TemporaryDirectory from tests import skip_commit_slider_devtest sys.path.append('./') from test_util import getExpectedCommit, \ getBordersByTestData, getActual...
522
18,564
openvino
tools/commit_slider/tests/__init__.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest skip_commit_slider_devtest = pytest.mark.skip( reason="Test is used to check stability of commit_slider after development changes" "and does not suppose regular checks.")
11
283
openvino
tools/commit_slider/tests/test_util.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import subprocess import re import json import sys import shutil from os import path from utils.cfg_manager import CfgManager from test_data import TestData from test_data import TestError from utils.helpers import formatJSON ...
285
8,568
openvino
tools/commit_slider/tests/test_data.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from enum import Enum import json from utils.cfg_manager import CfgManager class TestData(): __test__ = False actualDataReceived = False # prevent slider running before config actualized def getTestCase(): return T...
580
16,182
openvino
tools/commit_slider/utils/cfg_manager.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import json import os class CfgManager(): def __init__(self, cfg) -> None: self.cfg = cfg @staticmethod def singlestepStrFormat(input: str, placeholder: str, substitution: str): return input.replace( ...
219
7,716
openvino
tools/commit_slider/utils/modes.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os from utils.helpers import CfgManager, fetchAppOutput, getActualPath, fetchBenchmarkMetric from utils.helpers import getMeaningfullCommitTail, extractModelPath from utils.helpers import handleCommit, getBlobDiff, applySubstituti...
817
31,856
openvino
tools/commit_slider/utils/log_parser.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import re import zipfile import os import csv import shutil from utils.helpers import CfgError def getMap(hashPatternList, intervalPatternList): intervalPos = 2 # as in 'Check interval i1..i2' pattern hashMap = {} for i, ...
112
3,210
openvino
tools/commit_slider/utils/subscription.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from utils.map_builder import buildMap from utils.e2e_preparator import buildWheelMap class SubscriptionManager(): def __init__(self, cfg) -> None: self.cfg = cfg def apply(self): for sub in self.cfg["subscript...
41
1,366
openvino
tools/commit_slider/utils/e2e_preparator.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from os import walk, path from utils.helpers import CfgError from pathlib import Path # WA to keep CI job working until we add requirements try: import yaml except: import subprocess # nosec B404 import sys p = subproce...
56
1,681
openvino
tools/commit_slider/utils/map_builder.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from os import walk, path from utils.helpers import CfgError def buildMap(commonPath, subPath=None) -> dict: precomPath = commonPath items = next(walk(precomPath), (None, None, []))[1] map = {} for item in items: ...
29
838
openvino
tools/commit_slider/utils/break_validator.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from utils.helpers import CfgError import csv from statistics import mean from enum import Enum def getJSONFromCSV(csvFilePath): data = [] with open(csvFilePath, encoding='utf-8') as csvf: csvReader = csv.DictReader(csvf...
130
4,592
openvino
tools/commit_slider/utils/helpers.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import importlib import shutil import os import sys import subprocess # nosec B404 import csv import shlex from enum import Enum import re import json import logging as log from argparse import ArgumentParser from utils.cfg_manager impo...
1,067
35,796
openvino
tools/commit_slider/utils/common_mode.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from abc import ABC import utils.helpers as util from utils.subscription import SubscriptionManager from utils.break_validator import validateBMOutput from utils.break_validator import BmValidationError import json import os from enum im...
538
21,000
openvino
tools/commit_slider/utils/preprocess/replace.py
.py
import re import fileinput import os from utils.helpers import CfgError def replace(cfg, commit=None): prepCfg = cfg["runConfig"]["preprocess"] filePath = prepCfg["file"] curDir = os.path.abspath(os.path.join( os.path.dirname(__file__), "../../../../")) filePath = os.path.join(curDir, filePath)...
34
1,302
openvino
tools/commit_slider/utils/templates/model_compilation_table.py
.py
from utils.templates.common import CommonTemplate class ModelCompilationTableTemplate(CommonTemplate): def getName(): return 'model_comp_table' def getBilletFileName(): return 'model_compilation_time_table.json' def printResult(commitPath, outLogger, getCommitInfo): print("\n*...
66
2,800
openvino
tools/commit_slider/utils/templates/benchmark_cross_check.py
.py
from utils.templates.common import CommonTemplate class BenchmarkCrossCheckTemplate(CommonTemplate): def getName(): return 'bm_cc' def getBilletFileName(): return 'benchmark_crosscheck.json' def printResult(commitPath, outLogger, getCommitInfo): print("\n*****************<Comm...
64
2,716
openvino
tools/commit_slider/utils/templates/common.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from abc import ABC from utils.subscription import SubscriptionManager from utils.break_validator import BmValidationError from utils.helpers import getClassByMethod from enum import Enum from utils.cfg_manager import CfgManager class C...
82
3,155
openvino
tools/commit_slider/utils/templates/broken_compilation.py
.py
from utils.templates.common import CommonTemplate class BrokenCompilationTemplate(CommonTemplate): def getName(): return 'broken_comp' def getBilletFileName(): return 'broken_compilation.json' def printResult(commitPath, outLogger, getCommitInfo): print("\n*****************<Co...
52
2,272
openvino
cmake/developer_package/check_python_requirements.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import re import os from importlib.metadata import PackageNotFoundError, version as _installed_version from packaging.requirements import Requirement def check_python_requirements(requirements_path: str) -> None: """ Checks if...
83
3,410
openvino
cmake/rpi_cross/scons-site-init.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import SCons.Platform import SCons.Script _environment = SCons.Script.Environment def Environment(*args, **kwargs): kwargs.setdefault("tools", ["gcc", "g++", "gnulink", "ar", "as", "gas"]) env = _environment(*args, **kwargs) ...
21
594
openvino
docs/sphinx_setup/conf.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # Configuration file for the Sphinx documentation builder. # # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Project information ---------...
252
7,451
openvino
docs/optimization_guide/nncf/code/qat_torch.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 #! [quantize] model = TorchModel() # instance of torch.nn.Module quantized_model = nncf.quantize(model, ...) #! [quantize] #! [tune_model] ... # fine-tuning preparations, e.g. dataset, loss, optimization setup, etc. # tune quantized mo...
39
1,196
openvino
docs/optimization_guide/nncf/ptq/code/ptq_aa_onnx.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 #! [dataset] import nncf import torch calibration_loader = torch.utils.data.DataLoader(...) def transform_fn(data_item): images, _ = data_item return {input_name: images.numpy()} # input_name should be taken from the model, ...
79
2,243
openvino
docs/optimization_guide/nncf/ptq/code/ptq_openvino.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 #! [dataset] import nncf import torch calibration_loader = torch.utils.data.DataLoader(...) def transform_fn(data_item): images, _ = data_item return images.numpy() calibration_dataset = nncf.Dataset(calibration_loader, transf...
34
782
openvino
docs/optimization_guide/nncf/ptq/code/ptq_aa_openvino.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 #! [dataset] import nncf import torch calibration_loader = torch.utils.data.DataLoader(...) def transform_fn(data_item): images, _ = data_item return images calibration_dataset = nncf.Dataset(calibration_loader, transform_fn) ...
73
1,997
openvino
docs/optimization_guide/nncf/ptq/code/ptq_onnx.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 #! [dataset] import nncf import torch calibration_loader = torch.utils.data.DataLoader(...) def transform_fn(data_item): images, _ = data_item return {input_name: images.numpy()} # input_name should be taken from the model, ...
43
1,142
openvino
docs/optimization_guide/nncf/ptq/code/ptq_torch.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 #! [dataset] import nncf import torch calibration_loader = torch.utils.data.DataLoader(...) def transform_fn(data_item): images, _ = data_item return images calibration_dataset = nncf.Dataset(calibration_loader, transform_fn) ...
40
935
openvino
docs/optimization_guide/nncf/ptq/code/ptq_torch_fx.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 #! [dataset] import nncf import torch calibration_loader = torch.utils.data.DataLoader(...) def transform_fn(data_item): images, _ = data_item return images calibration_dataset = nncf.Dataset(calibration_loader, transform_fn) ...
42
1,197
openvino
docs/articles_en/assets/snippets/ov_python_exclusives.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import openvino as ov from utils import get_path_to_model, get_image #! [properties_example] import openvino.opset12 as ops core = ov.Core() input_a = ops.parameter([8], name="input_a") res = ops.absolute(input_a) ...
196
5,176
openvino
docs/articles_en/assets/snippets/ov_properties_api.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # import openvino as ov import openvino.properties as props import openvino.properties.hint as hints import openvino.properties.device as device from utils import get_model def main(): # [get_available_devices] core = ov.Core(...
65
2,141
openvino
docs/articles_en/assets/snippets/ov_stateful_models_intro.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import logging as log import numpy as np import openvino as ov from openvino import opset13 as ops from openvino.op.util import VariableInfo, Variable from openvino.passes import LowLatency2, MakeStateful, Manager from openvino.utils i...
211
7,406
openvino
docs/articles_en/assets/snippets/ov_sparse_weights_decompression.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # import openvino as ov from snippets import get_model model = get_model() device_name = "CPU" xml_path = "model.xml" # ! [ov:intel_cpu:sparse_weights_decompression:part0] import openvino.properties.intel_cpu as intel_cpu core = ov.Co...
20
550
openvino
docs/articles_en/assets/snippets/ov_extensions.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # import openvino as ov from ov_custom_op import Identity #! [py_frontend_extension_ThresholdedReLU_header] import openvino.opset14 as ops from openvino.frontend import ConversionExtension #! [py_frontend_extension_ThresholdedReLU_heade...
86
2,634
openvino
docs/articles_en/assets/snippets/main.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # import sys import os import io import importlib from contextlib import redirect_stdout, redirect_stderr skip_snippets = ["main.py", "__init__.py", "utils.py", "ov_common.py", "ov_stateful_models_intro.py"] def import_python_modules(...
45
1,366
openvino
docs/articles_en/assets/snippets/utils.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # import tempfile import numpy as np from sys import platform import openvino as ov import openvino.opset13 as ops def get_dynamic_model(): param = ops.parameter(ov.PartialShape([-1, -1]), name="input") return ov.Model(ops.rel...
66
1,932
openvino
docs/articles_en/assets/snippets/compile_model_cpu.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from snippets import get_model def main(): model = get_model() #! [compile_model_default] import openvino as ov core = ov.Core() compiled_model = core.compile_model(model, "CPU") #! [compile_model_default] ...
29
739
openvino
docs/articles_en/assets/snippets/ov_dynamic_shapes.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np from utils import get_dynamic_model #! [import] import openvino as ov #! [import] model = get_dynamic_model() #! [reshape_undefined] core = ov.Core() # Set first dimension to be dynamic while keeping others static ...
119
3,139
openvino
docs/articles_en/assets/snippets/ov_patterns.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # # ! [ov:imports] import pytest from openvino import PartialShape from openvino import opset13 as ops from openvino.passes import Matcher, WrapType, Or, AnyInput, Optional # ! [ov:imports] from openvino.passes import ( consumers_cou...
218
8,410
openvino
docs/articles_en/assets/snippets/ov_auto_batching.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # import openvino as ov from utils import get_model def main(): core = ov.Core() model = get_model() if "GPU" not in core.available_devices: return 0 # [compile_model] import openvino.properties as props ...
56
2,160
openvino
docs/articles_en/assets/snippets/ov_matcher_pass.py
.py
# ! [matcher_pass:ov_matcher_pass_py] ''' ``MatcherPass`` is used for pattern-based transformations. To create transformation, you need to: 1. Create a pattern. 2. Implement a callback. 3. Register the pattern and ``Matcher``. The next example defines transformation that searches for the ``Relu`` layer and inserts af...
95
2,500
openvino
docs/articles_en/assets/snippets/ov_hetero.py
.py
import openvino as ov import openvino as properties from utils import get_model def main(): model = get_model() core = ov.Core() #! [set_manual_affinities] for op in model.get_ops(): rt_info = op.get_rt_info() rt_info["affinity"] = "CPU" #! [set_manual_affinities] if "GPU" not...
68
2,151
openvino
docs/articles_en/assets/snippets/ov_layout.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # import openvino as ov import openvino.opset12 as ops # ! [ov:layout:simple] from openvino import Layout layout = Layout('NCHW') # ! [ov:layout:simple] # ! [ov:layout:complex] # Each dimension has name separated by comma # Layout is wra...
81
2,271
openvino
docs/articles_en/assets/snippets/torchvision_preprocessing.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 def main(): #! [torchvision_preprocessing] import torch.nn.functional as f import openvino as ov import numpy as np import torchvision import torch import os from openvino.preprocess.torchvision import ...
66
2,361
openvino
docs/articles_en/assets/snippets/export_compiled_model.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # from utils import get_path_to_model device = "CPU" model_path = get_path_to_model() properties = {} #! [export_compiled_model] import openvino as ov core = ov.Core() compiled_model = core.compile_model(model_path, device, properti...
20
397
openvino
docs/articles_en/assets/snippets/ov_model_pass.py
.py
# ! [model_pass:ov_model_pass_py] ''' ``ModelPass`` can be used as a base class for transformation classes that take entire ``Model`` and proceed with it. To create transformation, you need to: 1. Define a class with ``ModelPass`` as a parent. 2. Redefine the run_on_model method that will receive ``Model`` as an argum...
47
1,490
openvino
docs/articles_en/assets/snippets/ov_denormals.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # import openvino as ov from utils import get_model device_name = 'CPU' model = get_model() # ! [ov:intel_cpu:denormals_optimization:part0] import openvino.properties.intel_cpu as intel_cpu core = ov.Core() core.set_property("CPU", in...
19
502
openvino
docs/articles_en/assets/snippets/ov_execution_mode.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 #! [ov:execution_mode:part0] import openvino as ov import openvino.properties.hint as hints core = ov.Core() # in case of Accuracy core.set_property( "CPU", {hints.execution_mode: hints.ExecutionMode.ACCURACY}, ) # in case of Pe...
20
452
openvino
docs/articles_en/assets/snippets/ShapeInference.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import openvino as ov from utils import get_model, get_image model = get_model() #! [picture_snippet] model.reshape([8, 3, 448, 448]) #! [picture_snippet] #! [set_batch] model.get_parameters()[0].set_layout(ov.Layout("N...")) ov.set_b...
56
1,382
openvino
docs/articles_en/assets/snippets/ov_preprocessing.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # import openvino.properties as props from openvino.preprocess import ResizeAlgorithm, ColorFormat from openvino import Layout, Type, serialize import openvino as ov import openvino.opset12 as ops from utils import get_model, get_temp_di...
234
7,884
openvino
docs/articles_en/assets/snippets/ov_python_inference.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import openvino as ov import openvino.opset12 as ops INPUT_SIZE = 1_000_000 # Use bigger values if necessary, i.e.: 300_000_000 input_0 = ops.parameter([INPUT_SIZE], name="input_0") input_1 = ops.parameter([INPUT_SI...
75
2,538
openvino
docs/articles_en/assets/snippets/ov_custom_op.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # # ! [op:common_include] from openvino import Op # ! [op:common_include] # ! [op:header] class Identity(Op): # ! [op:header] # ! [op:ctor] def __init__(self, inputs=None, **attrs): super().__init__(self, inputs) ...
46
1,027
openvino
docs/articles_en/assets/snippets/ov_infer_request.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from utils import get_model #! [import] import openvino as ov #! [import] core = ov.Core() model = get_model() compiled_model = core.compile_model(model, "AUTO") #! [create_infer_request] infer_request = compiled_model.create_infer_re...
98
2,398
openvino
docs/articles_en/assets/snippets/compile_model_npu.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import openvino as ov from snippets import get_model def main(): model = get_model() core = ov.Core() if "NPU" not in core.available_devices: return 0 #! [compile_model_default_npu] core = ov.Core() co...
19
403
openvino
docs/articles_en/assets/snippets/ov_auto.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # #! [py_ov_property_import_header] import openvino as ov import openvino.properties as properties import openvino.properties.device as device import openvino.properties.hint as hints import openvino.properties.streams as streams import ...
195
5,441