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
src/bindings/python/tests/test_runtime/test_stateful.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import os import pytest from openvino import ( Core, CompiledModel, InferRequest, Tensor, compile_model, ) from tests.utils.helpers import generate_model_with_memory from o...
99
3,594
openvino
src/bindings/python/tests/test_runtime/test_string_infer.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import openvino.opset13 as ops from openvino import ( CompiledModel, InferRequest, Model, Type, compile_model, ) def create_string_compiled_model(shape): ...
113
3,501
openvino
src/bindings/python/tests/test_runtime/test_experimental.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openvino.experimental import evaluate_as_partial_shape, evaluate_both_bounds, set_element_type, set_tensor_type import pytest from openvino import Shape, PartialShape, Dimension, Type from openvino.op import...
71
2,251
openvino
src/bindings/python/tests/test_runtime/test_input_node.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import numpy as np from openvino import Input, RTMap from openvino._pyopenvino import DescriptorTensor import openvino.opset13 as ops from openvino import Core, OVAny, Shape, PartialShape, Type, Tensor,...
175
6,007
openvino
src/bindings/python/tests/test_runtime/test_memory_modes.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from openvino import Tensor, Type from openvino.op import Constant from tests.utils.helpers import generate_image @pytest.mark.parametrize(("cls", "cls_str"), [ (Tensor, "T...
151
5,249
openvino
src/bindings/python/tests/test_runtime/test_compiled_model.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import pytest import numpy as np from tests.utils.helpers import ( get_relu_model, generate_image, tensor_from_bytes, generate_model_and_image, generate_concat_compiled_model, ge...
386
12,796
openvino
src/bindings/python/tests/test_runtime/test_dimension.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openvino import Dimension, Symbol def test_dynamic_dimension(): dim = Dimension() assert dim.is_dynamic assert str(dim) == "?" assert dim.to_string() == "?" assert "<Dimension: ?>" in st...
97
3,104
openvino
src/bindings/python/tests/test_runtime/test_ovdict.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import openvino.opset13 as ops from openvino import Core, CompiledModel, InferRequest, Model from openvino import ConstOutput from openvino.utils.data_helpers import OVDict def ...
259
7,911
openvino
src/bindings/python/tests/test_runtime/test_sync_infer_request.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from contextlib import nullcontext as does_not_raise from copy import deepcopy import numpy as np import os import pytest import datetime import openvino.properties as props import openvino.opset13 as ops from op...
842
30,566
openvino
src/bindings/python/tests/test_runtime/test_properties.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import numpy as np import os from pathlib import Path import openvino as ov import openvino.properties as props import openvino.properties.hint as hints import openvino.properties.intel_cpu as intel...
754
25,529
openvino
src/bindings/python/tests/test_runtime/test_async_infer_request.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from collections.abc import Iterable from copy import deepcopy import numpy as np import pytest import time import openvino.opset13 as ops from openvino import ( Core, InferRequest, AsyncInferQueue, ...
385
12,428
openvino
src/bindings/python/tests/test_runtime/test_tensor_string.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import openvino as ov import pytest from enum import Enum class DataGetter(Enum): BYTES = 1 STRINGS = 2 def _check_tensor_string(tensor_data, test_data): assert tensor_data.sha...
300
10,871
openvino
src/bindings/python/tests/test_runtime/test_output_const_node.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from copy import copy, deepcopy import openvino.opset13 as ops from openvino import ( Shape, PartialShape, Type, Core, OVAny, ) from openvino import ( ConstOutput, Output...
169
5,096
openvino
src/bindings/python/tests/test_runtime/test_output_node.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import openvino.opset13 as ops from openvino import Type, Tensor, Symbol import numpy as np def test_output_replace(device): param = ops.parameter([1, 64], Type.i64) param.output(0).get_tensor().set_nam...
54
1,628
openvino
src/bindings/python/tests/test_runtime/test_model.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import sys import numpy as np import pytest import math from contextlib import nullcontext as does_not_raise from copy import copy import tempfile import openvino.opset13 as ops from openvino import ( ...
955
36,664
openvino
src/bindings/python/tests/test_runtime/test_nogil.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import time import pytest import os import io import threading import numpy as np import openvino.properties as props from openvino import Core, Model, AsyncInferQueue, PartialShape, Layout, serialize from openvi...
255
6,881
openvino
src/bindings/python/tests/test_runtime/subprocess_test_tensor.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np from openvino import Tensor, Type def test_run(): tensor = Tensor(np.random.randn(1, 3, 224, 224).astype(np.float32)) assert tensor.element_type == Type.f32 if __name__ == "__main__...
17
338
openvino
src/bindings/python/tests/test_utils/test_data_dispatch.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import pytest from copy import deepcopy import numpy as np from tests.utils.helpers import generate_add_compiled_model, generate_relu_compiled_model from openvino import Core, Model, Type, Shape, Tenso...
438
17,046
openvino
src/bindings/python/tests/test_utils/test_utils.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import os import numpy as np import openvino as ov from pathlib import Path from openvino.utils import deprecated, get_cmake_path, make_postponed_constant from tests.utils.helpers import compare_mode...
197
6,213
openvino
src/bindings/python/tests/utils/helpers.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import io from typing import Union import os import sys import numpy as np import base64 import re from sys import platform from pathlib import Path import openvino from openvino import Model, Core, Shape, Tens...
342
12,347
openvino
src/bindings/python/tests/test_graph/test_grouped_matmul.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openvino import Type, PartialShape from openvino.opset15 import parameter import openvino.opset17 as ov import pytest @pytest.mark.parametrize(("a_shape", "b_shape", "out_shape"), [ ((2, 4, 8), (2, 16, ...
41
1,594
openvino
src/bindings/python/tests/test_graph/test_any.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openvino import OVAny import pytest @pytest.mark.parametrize(("value", "data_type"), [ ("test_string", str), (2137, int), (21.37, float), (False, bool), ([1, 2, 3], list), ((1, 2, 3)...
103
2,601
openvino
src/bindings/python/tests/test_graph/test_core.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import copy import numpy as np import pytest from openvino import Dimension, Model, PartialShape, Shape import openvino.opset13 as ov def test_dimension(): dim = Dimension() assert dim.is_dynamic ...
471
14,612
openvino
src/bindings/python/tests/test_graph/test_ops_unary.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import openvino.opset13 as ops import openvino.opset17 as ops_opset17 from openvino import Shape, Type R_TOLERANCE = 1e-6 # global relative tolerance @pytest.mark.parametrize(...
244
7,441
openvino
src/bindings/python/tests/test_graph/test_roll.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import openvino.opset8 as ov import numpy as np def test_roll(): input_vals = np.reshape(np.arange(10), (2, 5)) input_tensor = ov.constant(input_vals) input_shift = ov.constant(np.array([-10, 7], dty...
19
610
openvino
src/bindings/python/tests/test_graph/test_string_tensor_pack.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openvino import Type import openvino.opset15 as ov import pytest @pytest.mark.parametrize(("dtype"), [ Type.i32, Type.i64 ]) @pytest.mark.parametrize(("indices_shape"), [ (4,), (1, 3, 4), ...
29
875
openvino
src/bindings/python/tests/test_graph/test_ops_result.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np from openvino import PartialShape, Model, Type import openvino.opset13 as ops from openvino.op import Result def test_result(): param = ops.parameter(PartialShape([1]), dtype=np.float32, ...
29
925
openvino
src/bindings/python/tests/test_graph/test_ops_util_variable.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openvino import PartialShape, Type from openvino.op.util import VariableInfo, Variable def test_info_as_property(): info = VariableInfo() info.data_shape = PartialShape([1]) info.data_type = Typ...
48
1,509
openvino
src/bindings/python/tests/test_graph/test_identity.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from openvino.opset15 import parameter from openvino.opset16 import identity from openvino import PartialShape, Type @pytest.mark.parametrize( ("input_shape", "expected_outp...
32
1,021
openvino
src/bindings/python/tests/test_graph/test_idft.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openvino import Type import openvino.opset8 as ov import numpy as np import pytest def get_data(): np.random.seed(202104) return np.random.uniform(0, 1, (2, 10, 10, 2)).astype(np.float32) def test...
127
5,563
openvino
src/bindings/python/tests/test_graph/test_random_uniform.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import openvino.opset8 as ops from openvino import Type def test_random_uniform(): input_tensor = ops.constant(np.array([2, 4, 3], dtype=np.int32)) min_val = ops.constant(np.array([-2....
22
884
openvino
src/bindings/python/tests/test_graph/test_swish.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import openvino.opset8 as ov from openvino import Shape, Type @pytest.mark.parametrize(("beta"), [ [], [ov.parameter(Shape([]), dtype=np.float32, name="beta")]]) def test...
22
629
openvino
src/bindings/python/tests/test_graph/test_col2im.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openvino import Type import openvino.opset15 as ov import numpy as np import pytest @pytest.mark.parametrize(("input_shape", "output_size", "kernel_size", "expected_shape", "params"), [ ((3, 4), [2, 2],...
28
1,191
openvino
src/bindings/python/tests/test_graph/test_constant.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import openvino as ov import openvino.opset13 as ops from openvino import Type, PartialShape, Model, Strides, Tensor, compile_model from openvino.op import Constant from openvino.helpers import...
799
23,666
openvino
src/bindings/python/tests/test_graph/test_sparse_fill_empty_rows.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openvino import Type from openvino.opset15 import parameter import openvino.opset16 as ov import pytest @pytest.mark.parametrize("values_dtype", [ Type.f32, Type.f16, Type.i32 ]) @pytest.mark.pa...
43
1,583
openvino
src/bindings/python/tests/test_graph/test_preprocess.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import openvino.opset13 as ops from openvino import Core, Layout, Model, Shape, Tensor, Type from openvino.utils.decorators import custom_preprocess_function from openvino import...
805
29,160
openvino
src/bindings/python/tests/test_graph/test_gather.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openvino import Tensor, Type import openvino.opset8 as ov import numpy as np import pytest @pytest.mark.parametrize(("input_shape", "indices", "axis", "expected_shape", "batch_dims"), [ ((3, 3), (1, 2),...
52
2,203
openvino
src/bindings/python/tests/test_graph/test_ops_multioutput.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import openvino.opset8 as ov def test_split(): input_tensor = ov.constant(np.array([0, 1, 2, 3, 4, 5], dtype=np.int32)) axis = ov.constant(0, dtype=np.int64) splits = 3 split...
33
1,147
openvino
src/bindings/python/tests/test_graph/test_ops_scatter_nd_update.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from openvino import PartialShape, Type from openvino import opset4, opset15 scatter_version_opset = pytest.mark.parametrize("opset", [opset4, opset15]) @scatter_version_opset ...
232
8,839
openvino
src/bindings/python/tests/test_graph/test_tensor_iterator.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import openvino.opset8 as ov from openvino import Model, Shape from openvino.op.util import ( InvariantInputDescription, BodyOutputDescription, SliceInputDescription, MergedInpu...
173
6,352
openvino
src/bindings/python/tests/test_graph/test_ops_matmul.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import openvino.opset8 as ov @pytest.mark.parametrize( ("shape_a", "shape_b", "transpose_a", "transpose_b", "output_shape"), [ # matrix, vector ([2, 4], ...
36
1,180
openvino
src/bindings/python/tests/test_graph/test_type_info.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np from openvino import Op from openvino import DiscreteTypeInfo, Shape import openvino.opset14 as ops from openvino.utils.node_factory import NodeFactory class CustomAdd(Op): class_type_inf...
80
2,476
openvino
src/bindings/python/tests/test_graph/test_pad.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import openvino.opset13 as ov from openvino import Type @pytest.mark.parametrize("pad_mode", [ "constant", "edge", "reflect", "symmetric", ]) def test_pad_mode(pad_mode): ...
41
1,282
openvino
src/bindings/python/tests/test_graph/test_ops.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # flake8: noqa import numpy as np import pytest from contextlib import nullcontext as does_not_raise import openvino.opset8 as ov from openvino import Shape, Type from openvino import AxisSet from openvino.op im...
463
14,454
openvino
src/bindings/python/tests/test_graph/util.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 def count_ops_of_type(model, op_type): count = 0 for op in model.get_ops(): if (type(op) is type(op_type)): count += 1 return count
12
272
openvino
src/bindings/python/tests/test_graph/test_ops_embedding.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from openvino import Type from openvino import opset15 def test_embedding_bag_offsets_15(): emb_table = opset15.parameter([5, 2], name="emb_table", dtype=np.float32) ind...
101
4,276
openvino
src/bindings/python/tests/test_graph/test_basic.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import openvino.opset8 as ops import openvino as ov from openvino import ( Model, Layout, PartialShape, RTMap, Shape, Strides, Tensor, Type, ...
849
29,597
openvino
src/bindings/python/tests/test_graph/test_affix_ops.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import re import openvino.opset13 as ov from openvino import Type @pytest.mark.parametrize("op_name", [ "ABC", "Fakeee", "123456", "FakeQuantize", ]) def test_af...
151
4,648
openvino
src/bindings/python/tests/test_graph/test_ops_scatter.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import openvino.opset13 as ov from openvino import Type def test_scatter_update_props(): dtype = np.int8 parameter_r = ov.parameter([2, 3, 4], dtype=dtype, name="data") ...
63
2,197
openvino
src/bindings/python/tests/test_graph/test_manager.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import numpy as np import pytest import openvino.opset10 as ops from openvino import Core, Model from openvino.passes import Manager, Serialize, ConstantFolding, Version from tests.test_graph.util imp...
191
6,548
openvino
src/bindings/python/tests/test_graph/test_scaled_dot_product_attention.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import openvino.opset13 as ops from openvino import PartialShape, Type @pytest.mark.parametrize( ("query", "key", "value", "attention_mask", "scale", "causal", "dtype", "boo...
84
3,494
openvino
src/bindings/python/tests/test_graph/test_eye.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import openvino.opset10 as ov import numpy as np import pytest from openvino.utils.types import get_element_type_str from openvino.utils.types import get_element_type @pytest.mark.parametrize( ("num_rows", ...
91
3,630
openvino
src/bindings/python/tests/test_graph/test_log_softmax.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import openvino.opset8 as ov from openvino import Shape, Type def test_log_softmax(): data = ov.parameter(Shape([3, 10]), dtype=np.float32, name="data") node = ov.log_softmax(data, 1)...
18
516
openvino
src/bindings/python/tests/test_graph/test_convolution.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from openvino import Type import openvino.opset8 as ov @pytest.mark.parametrize(("strides", "pads_begin", "pads_end", "dilations", "expected_shape"), [ (np.array([1, 1]), np...
53
2,331
openvino
src/bindings/python/tests/test_graph/test_string_tensor_unpack.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openvino import Type, PartialShape, Dimension import openvino.opset15 as ov import pytest @pytest.mark.parametrize("input_shape", [ ((4,)), ((1, 3, 4)), ((3, 1, 2, 5)) ]) def test_string_tensor_...
27
938
openvino
src/bindings/python/tests/test_graph/test_fake_convert.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import openvino.opset13 as ops from openvino import PartialShape, Type @pytest.mark.parametrize( ("data_shape", "scale_shape", "shift_shape", "input_type", "destination_type...
59
2,455
openvino
src/bindings/python/tests/test_graph/test_detection_output.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import openvino.opset8 as ov import pytest np_types = [np.float32, np.int32] integral_np_types = [ np.int8, np.int16, np.int32, np.int64, np.uint8, np.uint16, np.uin...
119
4,262
openvino
src/bindings/python/tests/test_graph/test_segment_max.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openvino import Type, PartialShape, Dimension from openvino.opset15 import parameter import openvino.opset16 as ov import pytest @pytest.mark.parametrize("dtype_segment_ids", [ Type.i32, Type.i64 ])...
54
1,965
openvino
src/bindings/python/tests/test_graph/test_inverse.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import openvino.opset14 as ops from openvino import PartialShape, Type @pytest.mark.parametrize( ("input_shape", "adjoint", "expected_output_shape"), [ ([4, 4], ...
68
2,305
openvino
src/bindings/python/tests/test_graph/test_custom_op.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import sys import pytest import numpy as np from contextlib import nullcontext as does_not_raise from openvino import Op, OpExtension from openvino import CompiledModel, Core, Model, Dimension, Shape, T...
305
10,674
openvino
src/bindings/python/tests/test_graph/test_dyn_attributes.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import openvino.opset8 as ov import pytest @pytest.fixture def proposal_node(): attributes = { "base_size": np.uint16(1), "pre_nms_topn": np.uint16(20), "post_nms_t...
158
5,760
openvino
src/bindings/python/tests/test_graph/test_normalization.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np from openvino import Type import openvino.opset13 as ov def test_lrn(): input_image_shape = (2, 3, 2, 1) input_image = np.arange(int(np.prod(input_image_shape))).reshape(input_image_s...
102
3,568
openvino
src/bindings/python/tests/test_graph/test_ops_reshape.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import openvino.opset8 as ov import numpy as np import pytest from openvino import Type from openvino.utils.types import get_element_type @pytest.mark.parametrize("op_name", ["ABC", "concat", "123456"]) def tes...
221
7,898
openvino
src/bindings/python/tests/test_graph/test_node_factory.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from sys import platform from openvino import compile_model, Model from openvino import Extension import openvino.opset8 as ov from openvino.exceptions import UserInputError from o...
142
4,438
openvino
src/bindings/python/tests/test_graph/test_squeeze.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import openvino.opset1 as ov_opset1 import openvino.opset15 as ov_opset15 import numpy as np import pytest def test_squeeze_v1_operator(): data_shape = [1, 2, 1, 3, 1, 1] parameter_data = ov_opset1.param...
52
1,938
openvino
src/bindings/python/tests/test_graph/test_rdft.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import openvino.opset10 as ov from openvino import Shape, Type import numpy as np import pytest np.random.seed(0) @pytest.mark.parametrize(("shape", "axes", "expected_shape"), [ ([50], [0], [26, 2]), (...
73
2,885
openvino
src/bindings/python/tests/test_graph/test_ops_binary.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import operator import numpy as np import pytest import warnings from openvino import Type import openvino.opset13 as ov import openvino.opset15 as ov_opset15 @pytest.mark.parametrize( ("graph_api_helper",...
275
8,757
openvino
src/bindings/python/tests/test_graph/test_convert_promote_types.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import openvino.opset14 as ops from openvino import Type @pytest.mark.parametrize( ( "lhs", "rhs", "promote_unsafe", "pytorch_scalar_promotion", "u64_integer...
104
4,515
openvino
src/bindings/python/tests/test_graph/test_einsum.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import openvino.opset8 as ov import numpy as np import pytest from openvino.utils.types import get_element_type def einsum_op_check(input_shapes: list, equation: str, data_type: np.dtype, se...
88
3,023
openvino
src/bindings/python/tests/test_graph/test_create_op.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from openvino import PartialShape, Dimension, Model, Type from openvino.exceptions import UserInputError from openvino.utils.types import make_constant_node import openvino.opset...
2,363
86,352
openvino
src/bindings/python/tests/test_graph/test_pooling.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import openvino.opset14 as ov import openvino.opset16 as ov16 from openvino import Type avg_pooling_test_params = [ ( [ [2, 2], # strides [0...
330
9,858
openvino
src/bindings/python/tests/test_graph/test_proposal.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import openvino.opset8 as ov from openvino import Shape, Type def test_proposal_props(): float_dtype = np.float32 batch_size = 1 post_nms_topn = 20 probs = ov.parameter(Shape([...
38
1,343
openvino
src/bindings/python/tests/test_graph/test_loop.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import numpy as np import openvino.opset8 as ov from openvino import Model, Shape from openvino.op.util import ( InvariantInputDescription, BodyOutputDescription, SliceInputDescription, ...
278
10,056
openvino
src/bindings/python/tests/test_graph/test_sequence_processing.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import openvino as ov import openvino.opset16 as ov16 @pytest.mark.parametrize(("depth", "on_value", "off_value", "axis", "expected_shape"), [ (2, 5, 10, -1, [3, 2]), (3...
77
2,473
openvino
src/bindings/python/tests/test_graph/test_nms_rotated.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import openvino.opset13 as ov_opset13 from openvino import PartialShape, Dimension, Type from openvino.utils.types import make_constant_node @pytest.mark.parametrize( ("box...
84
4,195
openvino
src/bindings/python/tests/test_graph/test_ctc_loss.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import openvino.opset8 as ov from openvino import Type def test_ctc_loss_props(): ind_dtype = np.int32 float_dtype = np.float32 logits = ov.parameter([2, 100, 80], dtype=float_dty...
29
1,069
openvino
src/bindings/python/tests/test_graph/test_gqa_extension.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from openvino import Core, Extension from openvino.op import _GroupQueryAttentionExtension def test_gqa_extension_is_extension(): ext = _GroupQueryAttentionExtension() assert isinstance(ex...
20
480
openvino
src/bindings/python/tests/test_graph/test_if.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import numpy as np import openvino.opset8 as ov from openvino import Model from openvino.op.util import InvariantInputDescription, BodyOutputDescription from tests.utils.helpers import compare_mode...
240
8,403
openvino
src/bindings/python/tests/test_graph/test_reduction.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import openvino.opset10 as ov @pytest.mark.parametrize( ("graph_api_helper", "reduction_axes", "expected_shape"), [ (ov.reduce_max, np.array([0, 1, 2, 3]), []), ...
202
6,446
openvino
src/bindings/python/tests/test_graph/test_data_movement.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import openvino.opset8 as ov from openvino import Type, Shape def test_reverse_sequence(): input_data = ov.parameter((2, 3, 4, 2), name="input_data", dtype=np.int32) seq...
66
2,457
openvino
src/bindings/python/tests/test_graph/test_utils.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from openvino._pyopenvino.util import deprecation_warning def test_deprecation_warning(): with pytest.warns(DeprecationWarning, match="function1 is deprecated"): deprecation_warning("fu...
21
947
openvino
src/bindings/python/tests/test_graph/test_dft.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from openvino import Type import openvino.opset10 as ov import numpy as np import pytest def build_fft_input_data(): np.random.seed(202104) return np.random.uniform(0, 1, (2, 10, 10, 2)).astype(np.float3...
46
1,598
openvino
src/bindings/python/tests/test_graph/test_ops_fused.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import openvino.opset8 as ov from openvino import Type def test_elu_operator_with_scalar_and_array(): data_value = ov.parameter((2, 2), name="data_value", dtype=np.float32) ...
330
11,583
openvino
src/bindings/python/tests/test_graph/test_input_validation.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from openvino.exceptions import UserInputError from openvino.utils.input_validation import ( _check_value, check_valid_attribute, check_valid_attributes, is_non_ne...
159
4,903
openvino
src/bindings/python/tests/test_graph/test_multinomial.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import openvino.opset13 as ops from openvino import PartialShape, Type @pytest.mark.parametrize( ( "probs_shape", "num_samples_shape", "convert_type", "with_replacem...
101
4,135
openvino
src/bindings/python/scripts/generate_pyapi_stubs.py
.py
import re import subprocess #nosec B404 from pathlib import Path import sys # Constants INVALID_EXPRESSIONS = [ "ov::Node", # In openvino._pyopenvino.Input.get_node : Invalid expression 'ov::Node' "ov::Input<ov::Node>", # In openvino._pyopenvino.Output.get_tar...
119
6,431
openvino
src/bindings/python/src/openvino/exceptions.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """openvino exceptions hierarchy. All exceptions are descendants of OVError.""" class OVError(Exception): """Base class for OV exceptions.""" class UserInputError(OVError): """User provided unexpected ...
18
402
openvino
src/bindings/python/src/openvino/_op_base.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from typing import Union, Optional from openvino._pyopenvino import Op as OpBase from openvino._pyopenvino import Node, Output class Op(OpBase): def __init__( self, py_obj: "Op", inp...
29
896
openvino
src/bindings/python/src/openvino/_ov_api.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import io from types import TracebackType from typing import Any, Union, Optional from collections.abc import Iterator from pathlib import Path import traceback # noqa: F811 from openvino._pyopenvino import Mod...
747
30,292
openvino
src/bindings/python/src/openvino/package_utils.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import sys from functools import wraps from typing import Any, Optional from pathlib import Path import importlib.util from types import ModuleType from collections.abc import Callable def _add_openvin...
157
6,056
openvino
src/bindings/python/src/openvino/opset15/ops.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Factory functions for ops added to openvino opset15.""" from functools import partial from typing import Literal, Optional import numpy as np from openvino import Node, Type from openvino.opset1 import convert...
394
14,693
openvino
src/bindings/python/src/openvino/opset11/ops.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Factory functions for all openvino ops.""" from functools import partial from typing import Optional from openvino import Node from openvino.utils.node_factory import _get_node_factory from openvino.utils.deco...
112
4,520
openvino
src/bindings/python/src/openvino/properties/_properties.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import sys from types import BuiltinFunctionType, ModuleType from typing import Any, Union from collections.abc import Callable class Property(str): """This class allows to make a string object callable. Cal...
60
2,326
openvino
src/bindings/python/src/openvino/opset2/ops.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Factory functions for all openvino ops.""" from typing import Optional, Union import numpy as np from functools import partial import warnings from openvino import Node, Shape from openvino.op import Constant...
217
7,648
openvino
src/bindings/python/src/openvino/opset9/ops.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Factory functions for all openvino ops.""" from functools import partial from typing import Optional import numpy as np from openvino import Node from openvino.utils.node_factory import _get_node_factory from ...
353
13,869
openvino
src/bindings/python/src/openvino/opset5/ops.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Factory functions for all openvino ops.""" from typing import Optional, Union import numpy as np from functools import partial from openvino import Node, Shape from openvino.op import Constant, Parameter, loo...
371
14,826
openvino
src/bindings/python/src/openvino/passes/manager.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # type: ignore from openvino._pyopenvino.passes import Manager as ManagerBase from openvino._pyopenvino.passes import PassBase class Manager(ManagerBase): """Manager that additionally holds transformations ob...
27
870
openvino
src/bindings/python/src/openvino/passes/__init__.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # type: ignore # flake8: noqa from openvino._pyopenvino.passes import ModelPass, Matcher, MatcherPass, PassBase, WrapType, Or, AnyInput, Optional, Predicate from openvino._pyopenvino.passes import ( consumers_count, has_static_di...
22
740
openvino
src/bindings/python/src/openvino/passes/graph_rewrite.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # type: ignore from openvino._pyopenvino.passes import MatcherPass from openvino._pyopenvino.passes import GraphRewrite as GraphRewriteBase from openvino._pyopenvino.passes import BackwardGraphRewrite as BackwardGr...
34
1,345
openvino
src/bindings/python/src/openvino/opset1/ops.py
.py
# -*- coding: utf-8 -*- # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Factory functions for all openvino ops.""" from typing import Optional, Union, get_args import numpy as np from functools import partial from openvino import Node, PartialShape, Type from openvino.op import C...
2,980
110,562