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
docs/articles_en/assets/snippets/ov_multi.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import openvino as ov import openvino.properties as properties import openvino.properties.device as device import openvino.properties.streams as streams from utils import get_model model = get_model() def MULTI_0(): #! [MULTI_0] ...
129
3,663
openvino
docs/articles_en/assets/snippets/Bfloat16Inference.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import openvino as ov import openvino.properties.device as device import openvino.properties.hint as hints from snippets import get_model model = get_model() #! [part0] core = ov.Core() cpu_optimization_capabilities = core.get_proper...
28
633
openvino
docs/articles_en/assets/snippets/ov_model_snippets.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np #! [import] import openvino as ov #! [import] import openvino.opset12 as ops #! [import] import openvino.passes as passes # ! [ov:create_simple_model] def create_simple_model(): # This example shows how to create...
91
2,971
openvino
docs/articles_en/assets/snippets/dynamic_shape.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from snippets import get_model model = get_model() #! [static_shape] import openvino as ov core = ov.Core() model.reshape([10, 20, 30, 40]) #! [static_shape]
14
244
openvino
docs/articles_en/assets/snippets/multi_threading.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # from openvino import Core, properties from snippets import get_model model = get_model() device_name = "CPU" core = Core() core.set_property("CPU", properties.intel_cpu.sparse_weights_decompression_rate(0.8)) # ! [ov:intel_cpu:multi...
51
1,467
openvino
docs/articles_en/assets/snippets/ov_caching.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # # ! [ov:caching:part0] from utils import get_path_to_model, get_temp_dir import openvino as ov import openvino.properties as props # For example: "CPU", "GPU", "NPU". device_name = 'CPU' model_path = get_path_to_model() path_to_cache...
90
2,721
openvino
docs/articles_en/assets/snippets/gpu/dynamic_batch.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 "GPU" not in core.available_devices: return 0 #! [dynamic_batch] core = ov.Core() C = 3 ...
40
921
openvino
docs/articles_en/assets/snippets/gpu/preprocessing_nv12_two_planes.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from snippets import get_model import openvino as ov def init_preproc(): model = get_model() #! [init_preproc] import openvino as ov from openvino.preprocess import PrePostProcessor, ColorFormat core = ov.Core() ...
32
790
openvino
docs/articles_en/assets/snippets/gpu/compile_model_gpu.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 "GPU" not in core.available_devices: return 0 #! [compile_model_default_gpu] core = ov.Core() c...
58
1,542
openvino
docs/articles_en/assets/snippets/gpu/custom_kernels_api.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import openvino as ov def main(): core = ov.Core() if "GPU" not in core.available_devices: return 0 # TODO: missing property to replace string #! [part0] core = ov.Core() core.set_property("GPU", {"CON...
18
373
openvino
docs/scripts/filehelper.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import argparse import logging import os import re import shutil from pathlib import Path INLINE_LINKS_PATTERN = r'!?\[.*?\]\(([\w\/\-\.]+\.md)\)' REFERENCE_LINKS_PATTERN = r'\[.+\]\:\s*?([\w\/\-\.]+\.md)' INLINE_IMAGES_PATTERN = r'!?...
214
7,372
openvino
docs/scripts/create_doc_mapping.py
.py
import re import os import json from pathlib import Path import argparse import logging # from github import Github def create_mapping(output_dir: Path, doc_dir_name: str): mapping = {} output_dir = output_dir.resolve() script_dir = os.path.dirname(os.path.realpath(__file__)) directory = os.path.abspat...
75
2,763
openvino
docs/scripts/articles_helper.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import argparse import logging import os import shutil from pathlib import Path def copy_directory_structure(input_dir, output_dir): """ Recursively find files and process them accordingly """ try: shutil.copyt...
46
1,506
openvino
docs/scripts/create_mapping.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import argparse import json import logging from lxml import etree from pathlib import Path REPOSITORIES = [ 'openvino', 'omz', 'pot', 'ovms', 'ote', ] def create_mapping(xml_input: Path, output_dir: Path, strip_pat...
91
3,204
openvino
docs/scripts/remove_xml.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os import shutil def remove_xml_dir(path): """ Remove doxygen xml folder """ if os.path.exists(path): shutil.rmtree(path, ignore_errors=True) def main(): import argparse parser = argparse.Argumen...
25
469
openvino
docs/scripts/apidoc.py
.py
# -*- coding: utf-8 -*- """ Script is originally taken from breathe repository. It has been modified to match project's requirements. breathe.apidoc ~~~~~~~~~~~~~~ Parses doxygen XML tree looking for C/C++ modules and creates ReST files appropriately to create code documentation with Sphinx. I...
295
9,122
openvino
docs/scripts/install_appropriate_openvino_version.py
.py
import re import argparse import subprocess import requests from packaging import version from pathlib import Path def determine_openvino_version(file_path): pattern = r"version_name\s*=\s*['\"]([^'\"]+)['\"]" with open(file_path, 'r') as file: content = file.read() match = re.search(pattern, cont...
78
2,946
openvino
docs/scripts/copy_images.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import argparse import shutil from pathlib import Path def copy_images(input_dir: Path, output_dir: Path): """ Copy images from doxygen xml folder to sphinx folder """ output_dir.mkdir(parents=True, exist_ok=True) e...
32
951
openvino
docs/scripts/tests/validate_benchmarks.py
.py
import os import json import requests import argparse from jsonschema import Draft7Validator import sys def load_json(file_path): """Load JSON data from a file.""" with open(file_path, 'r') as file: return json.load(file) def validate_json_files(benchmarks_dir): """Validate all JSON files in the ...
81
2,852
openvino
docs/scripts/tests/test_docs.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ Test for Doxygen based documentation generation. Refer to conftest.py on the test usage. """ def test_documentation_page(errors): """ Test documentation page has no errors generating """ if errors: assert False,...
15
411
openvino
docs/scripts/tests/conftest.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ Configuration for tests. Tests for documentation utilize pytest test framework for tests execution and reports generation. Documentation generation tests process Doxygen/Sphinx log to generate test per documentation source file (.h...
140
4,967
openvino
docs/scripts/tests/utils/log.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ Doxygen and Sphinx logs parsing routines """ import re from pathlib import Path class LogParser: """ This class reads a log file and converts it to a structured format represented as a python `dict` """ exclude_sym...
121
4,354
openvino
docs/openvino_custom_sphinx_sitemap/openvino_custom_sphinx_sitemap/__init__.py
.py
import xml.etree.ElementTree as ET import queue from pathlib import Path from sphinx_sitemap import setup as base_setup, add_html_link, record_builder_type from sphinx.util.logging import getLogger logger = getLogger(__name__) def setup(app): app.add_config_value('ov_sitemap_urlset', default=None, rebuild='') ...
120
4,675
openvino
docs/openvino_sphinx_theme/setup.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from setuptools import setup setup( name='openvino-sphinx-theme', version='0.0.2', packages=['openvino_sphinx_theme'], maintainer='OpenVINO Documentation Team', include_package_data=True, entry_points={"sphinx.ht...
22
665
openvino
docs/openvino_sphinx_theme/openvino_sphinx_theme/__init__.py
.py
import os import json import sys from json import JSONDecodeError from sphinx.errors import ExtensionError import jinja2 from docutils.parsers import rst from pathlib import Path from sphinx.util import logging from .directives.code import DoxygenSnippet, Scrollbox, Nodescrollbox, visit_scrollbox, depart_scrollbox, Dat...
109
4,583
openvino
docs/openvino_sphinx_theme/openvino_sphinx_theme/directives/code.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import os.path from sphinx.directives.code import LiteralInclude, LiteralIncludeReader, container_wrapper from sphinx.util import logging from docutils.parsers.rst import Directive, directives from docutils.nodes import Node from docutil...
189
8,736
openvino
docs/snippets/src/main.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np #! [import] import openvino as ov #! [import] #! [part1] core = ov.Core() #! [part1] #! [part2_1] compiled_model = core.compile_model("model.xml", "AUTO") #! [part2_1] #! [part2_2] compiled_model = core.compile_model...
65
1,640
openvino
tests/samples_tests/smoke_tests/test_hello_reshape_ssd.py
.py
""" Copyright (C) 2018-2026 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in w...
32
1,408
openvino
tests/samples_tests/smoke_tests/test_benchmark_app.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ Copyright (C) 2018-2026 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.a...
521
22,784
openvino
tests/samples_tests/smoke_tests/test_throughput_benchmark.py
.py
""" Copyright (C) 2018-2026 Intel Corporation Licensed under the Apache License, Version 2.0 (the 'License'); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in w...
32
1,321
openvino
tests/samples_tests/smoke_tests/test_sync_benchmark.py
.py
""" Copyright (C) 2018-2026 Intel Corporation Licensed under the Apache License, Version 2.0 (the 'License'); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in w...
32
1,297
openvino
tests/samples_tests/smoke_tests/test_classification_sample_async.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ Copyright (C) 2018-2026 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.a...
75
2,711
openvino
tests/samples_tests/smoke_tests/test_hello_classification.py
.py
""" Copyright (C) 2018-2026 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in w...
149
6,544
openvino
tests/samples_tests/smoke_tests/test_hello_query_device.py
.py
""" Copyright (C) 2018-2026 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in w...
44
1,667
openvino
tests/samples_tests/smoke_tests/test_model_creation_sample.py
.py
""" Copyright (C) 2018-2026 Intel Corporation Licensed under the Apache License, Version 2.0 (the 'License'); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in w...
38
1,764
openvino
tests/samples_tests/smoke_tests/test_hello_nv12_input_classification.py
.py
""" Copyright (C) 2018-2026 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in w...
61
2,306
openvino
tests/samples_tests/smoke_tests/common/specific_samples_parsers.py
.py
""" Copyright (C) 2018-2026 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in w...
61
3,207
openvino
tests/samples_tests/smoke_tests/common/common_utils.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ Copyright (C) 2018-2026 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.a...
81
3,437
openvino
tests/samples_tests/smoke_tests/common/samples_common_test_class.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ Copyright (C) 2018-2026 Intel Corporation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.a...
315
13,139
openvino
tests/layer_tests/conftest.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import re import tempfile from pathlib import Path import pytest from common import constants def pytest_make_parametrize_id(config, val, argname): return " {0}:{1} ".format(argname, val) def pytest_collection_modifyitems(items...
90
3,193
openvino
tests/layer_tests/pytorch_tests/test_quantized_mul.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class quantized_mul(torch.nn.Module): def __init__(self, scale, zero_point, dtype) -> None: torch.nn.Modu...
53
1,845
openvino
tests/layer_tests/pytorch_tests/test_convolution_mode.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestConv2D(PytorchLayerTest): def _prepare_input(self, ndim=4): input_shape = (1, 3, 10, 10, 10) return (self.random.randn(*input_shape[:ndi...
140
8,675
openvino
tests/layer_tests/pytorch_tests/test_any.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest, skip_if_export class aten_any_noparam(torch.nn.Module): def __init__(self) -> None: torch.nn.Module.__ini...
128
4,798
openvino
tests/layer_tests/pytorch_tests/test_clone.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestClone(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(1, 3, 224, 224),) def create_model(self): import torch...
29
711
openvino
tests/layer_tests/pytorch_tests/test_and.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestAnd(PytorchLayerTest): def _prepare_input(self): return self.input_data def create_model_tensor_input(self)...
84
2,882
openvino
tests/layer_tests/pytorch_tests/test_rand.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pytorch_layer_test_class import PytorchLayerTest # Random ops produce different outputs on each trace run, so the tracer always # warns that the traced output doesn't match the Python function output. # ...
150
5,576
openvino
tests/layer_tests/pytorch_tests/test_remainder.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pytorch_layer_test_class import PytorchLayerTest @pytest.mark.parametrize( "input_shape_rhs", [ [2, 5, 3, 4], [1, 5, 3, 4], [1] ] ) class TestRemainder(PytorchLayerTes...
110
3,721
openvino
tests/layer_tests/pytorch_tests/test_embedding.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestEmbedding(PytorchLayerTest): def _prepare_input(self, indicies_size, indicies_dtype): return (self.random.randint(0, 9, size=indicies_size, dtyp...
33
1,159
openvino
tests/layer_tests/pytorch_tests/test_div.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestDiv(PytorchLayerTest): def _prepare_input(self): return (self.input_array.astype(self.input_typ...
139
6,353
openvino
tests/layer_tests/pytorch_tests/test_len.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest @pytest.mark.parametrize('input_tensor', [ [2, 1, 3], [3, 7], [1, 1, 4, 4] ]) class TestLen(PytorchLayerTest): def _prepare_i...
75
2,136
openvino
tests/layer_tests/pytorch_tests/test_roll.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from pytorch_layer_test_class import PytorchLayerTest class TestRoll(PytorchLayerTest): def _prepare_input(self): return (self.random.uniform(0, 50, (2, 3, 4), dtype=np.float32),) def ...
44
1,292
openvino
tests/layer_tests/pytorch_tests/test_masked_select.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import torch from packaging.version import parse as parse_version import pytest from pytorch_layer_test_class import PytorchLayerTest class TestMaskedSelect(PytorchLayerTest): def _prepare_input(self, mask_selec...
61
2,510
openvino
tests/layer_tests/pytorch_tests/test_rot90.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # import torch import numpy as np import pytest from pytorch_layer_test_class import PytorchLayerTest class TestRot90(PytorchLayerTest): def _prepare_input(self): return (self.random.uniform(0, 50, (2, 3, 4)).astype(np.flo...
43
1,505
openvino
tests/layer_tests/pytorch_tests/test_gcd.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestGcd(PytorchLayerTest): def _prepare_input(self): return self.input_data def create_model_tensor_input(self)...
123
3,636
openvino
tests/layer_tests/pytorch_tests/test_tuple_unpack.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestTupleUnpack(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(2, 4, 6, 8),) def create_model(self): ...
110
4,076
openvino
tests/layer_tests/pytorch_tests/test_batch_norm.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestBatchNorm(PytorchLayerTest): def _prepare_input(self, ndim=4): shape5d = [20, 6, 10, 10, 10] shape = shape5d[:ndim] return (self....
65
2,965
openvino
tests/layer_tests/pytorch_tests/test_getitem_oob_index.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ Regression tests for out-of-bounds index validation in aten::__getitem__ replacer transforms (CVE fix). These tests verify that ov.convert_model raises a proper exception (instead of crashing with SIGSEGV) when a TorchScript model c...
433
16,211
openvino
tests/layer_tests/pytorch_tests/test_logical_ops.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from pytorch_layer_test_class import PytorchLayerTest, skip_if_export class TestLogicalOp(PytorchLayerTest): def _prepare_input(self, out, unary, first_dtype, second_dtype): x = self.random....
69
2,597
openvino
tests/layer_tests/pytorch_tests/test_reshape_as.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestReshapeAs(PytorchLayerTest): def _prepare_input(self, shape1, shape2): return (np.ones(shape1, dtype=np.float32...
40
1,452
openvino
tests/layer_tests/pytorch_tests/test_transpose.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from packaging import version from pytorch_layer_test_class import PytorchLayerTest # x.T (numpy_T) on non-2D tensors is deprecated in PyTorch 2.9: # - 0-D: "Tensor.T is deprecated on 0-D te...
125
4,866
openvino
tests/layer_tests/pytorch_tests/test_fake_quantize.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import pytest import torch from pytorch_layer_test_class import PytorchLayerTest, skip_check class TestFakeQuantizePerTensorAffine(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(3, ...
170
6,601
openvino
tests/layer_tests/pytorch_tests/test_pixel_shuffle.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestPixelShuffle(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(*self.shape),) def create_model(self, upscale_factor): ...
99
3,385
openvino
tests/layer_tests/pytorch_tests/test_det.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch import openvino as ov from pytorch_layer_test_class import PytorchLayerTest class TestDet(PytorchLayerTest): """aten::det / aten::linalg_det — batched matrix determinant. The PyTo...
119
5,438
openvino
tests/layer_tests/pytorch_tests/test_native_multi_head_attention.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import pytest import torch from pytorch_layer_test_class import PytorchLayerTest EMBED_DIM = 8 NUM_HEADS = 4 SEQ_LENGTH = 6 BATCH_SIZE = 1 NO_MASK, ATTN_MASK, KEY_PAD_MASK, MERGED_MASK = -1, 0, 1, 2 class aten_native...
148
7,588
openvino
tests/layer_tests/pytorch_tests/test_shift_operations.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestShiftOperators(PytorchLayerTest): def _prepare_input(self, lhs_dtype, rhs_dtype, lhs_shape, rhs_shape): choices =...
108
3,630
openvino
tests/layer_tests/pytorch_tests/test_getitem.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestGetItem(PytorchLayerTest): def _prepare_input(self, input_shape): return (self.random.randn(*input_shape),) def create_model(s...
103
3,231
openvino
tests/layer_tests/pytorch_tests/test_fft.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from sys import platform import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestRFFTN(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(*self.input_shape),) de...
165
7,156
openvino
tests/layer_tests/pytorch_tests/test_polar.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestPolar(PytorchLayerTest): def _prepare_input(self, input_shape=(1, 1000), dtype=np.float32): return ( s...
39
1,319
openvino
tests/layer_tests/pytorch_tests/test_derive_index_range_length.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest @pytest.mark.parametrize( "start, stop, step", [ [1, 32, 1], [1, 32, 2], [1, 32, 10], [1, 32, -...
58
1,740
openvino
tests/layer_tests/pytorch_tests/test_isnan.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest @pytest.mark.parametrize('input_tensor', (np.array([1, float('nan'), 2]),)) class TestIsNan(PytorchLayerTest): def _prepare_input...
31
880
openvino
tests/layer_tests/pytorch_tests/test_prelu.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestPRelu(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(1, 3, 224, 224),) def create_model(self, alpha): impor...
34
970
openvino
tests/layer_tests/pytorch_tests/test_pow.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest @pytest.mark.parametrize('test_input,inplace', [ ((np.array([[1, 2], [3, 4]], dtype=np.float32), np.array([[1, 1], [2, 2]], dtype=...
141
6,036
openvino
tests/layer_tests/pytorch_tests/test_col2im.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import math from pytorch_layer_test_class import PytorchLayerTest class TestCol2Im(PytorchLayerTest): def _prepare_input(self, input_shape): return (self.random.randn(*input_shape),) def create_model(sel...
57
2,326
openvino
tests/layer_tests/pytorch_tests/test_mul.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestMul(PytorchLayerTest): def _prepare_input(self): return (self.input_array.astype(self.input_type), self.other_ar...
319
12,545
openvino
tests/layer_tests/pytorch_tests/test_argsort.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestArgSort(PytorchLayerTest): def _prepare_input(self): return (self.input_tensor,) def create_model(self, dim...
85
3,431
openvino
tests/layer_tests/pytorch_tests/test_quantized_hardswish.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class quantized_hardswish(torch.nn.Module): def __init__(self, scale, zero_point, dtype) -> None: torch.n...
51
1,702
openvino
tests/layer_tests/pytorch_tests/test_masked_fill.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import torch from packaging.version import parse as parse_version import pytest from pytorch_layer_test_class import PytorchLayerTest, skip_if_export class TestMaskedFill(PytorchLayerTest): def _prepare_input(se...
77
3,334
openvino
tests/layer_tests/pytorch_tests/test_leaky_relu.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest, skip_check class TestLeakyRelu(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(1, 3, 224, 224),) def create_model(self, alpha...
37
1,246
openvino
tests/layer_tests/pytorch_tests/test_unfold.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pytorch_layer_test_class import PytorchLayerTest @pytest.mark.parametrize('dimension', (0, 1, 2)) @pytest.mark.parametrize('size', (1, 2)) @pytest.mark.parametrize('step', (1, 2, 3, 4)) @pytest.mark.par...
48
1,557
openvino
tests/layer_tests/pytorch_tests/test_mm.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestMatMul(PytorchLayerTest): def _prepare_input(self, matrix1_shape=(2, 2), matrix2_shape=(2, 2)): return (self.random.randn(*matrix1_shape), self....
88
3,753
openvino
tests/layer_tests/pytorch_tests/test_index_select.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest, skip_if_export class TestIndexSelect(PytorchLayerTest): def _prepare_input(self, index, out=False, dim=0): import numpy as np index = np.array(in...
48
1,760
openvino
tests/layer_tests/pytorch_tests/test_gather.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest, skip_if_export class TestGather(PytorchLayerTest): def _prepare_input(self, m, n, max_val, out=False): import numpy as np index = self.random.ran...
50
1,698
openvino
tests/layer_tests/pytorch_tests/test_scatter.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest, skip_if_export class TestScatter(PytorchLayerTest): def _prepare_input(self, dtype, out=False): inp = self.random.randn(6,...
275
11,252
openvino
tests/layer_tests/pytorch_tests/test_instance_norm.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import pytest from pytorch_layer_test_class import PytorchLayerTest class TestInstanceNorm(PytorchLayerTest): def _prepare_input(self, ndim=4): shape5d = [3, 6, 10, 5, 2] shape = shape5d[:ndim] ...
69
2,938
openvino
tests/layer_tests/pytorch_tests/test_grouped_mm.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import openvino as ov from pytorch_layer_test_class import PytorchLayerTest class TestGroupedMMConstWeights(PytorchLayerTest): """`torch._grouped_mm` with weights baked into the module as a buffer. With the weig...
205
9,150
openvino
tests/layer_tests/pytorch_tests/test_to.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestAtenTo(PytorchLayerTest): def _prepare_input(self, input_shape=(3,)): return (self.random.uniform(low=0.0, high=...
234
8,585
openvino
tests/layer_tests/pytorch_tests/test_quantized_cat.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class aten_quantized_cat(torch.nn.Module): def __init__(self, scale, zero_point, dtype): super().__init__(...
150
5,460
openvino
tests/layer_tests/pytorch_tests/test_index_put_.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestIndexPut_SingleIndices(PytorchLayerTest): def _prepare_input(self): return (self.input_tensor, self.values) ...
279
10,461
openvino
tests/layer_tests/pytorch_tests/test_hardtanh.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestHardtanh(PytorchLayerTest): def _prepare_input(self, input_dtype="float32", input_shape=(1, 3, 10, 10)): return (self.random.unifor...
41
1,779
openvino
tests/layer_tests/pytorch_tests/test_bool.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestBool(PytorchLayerTest): def _prepare_input(self): import numpy as np return (self.random.randint(0, 10, 1, dtype=np.int32),) def cr...
36
1,072
openvino
tests/layer_tests/pytorch_tests/test_quantized_convnd.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import pytest import numpy as np import torch from pytorch_layer_test_class import PytorchLayerTest class TestQuantizedConv2D(PytorchLayerTest): def _prepare_input(self): return (np.round(self.random.rand...
89
3,464
openvino
tests/layer_tests/pytorch_tests/test_all.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest, skip_if_export class aten_all_noparam(torch.nn.Module): def __init__(self) -> None: torch.nn.Module.__ini...
128
4,798
openvino
tests/layer_tests/pytorch_tests/test_unbind.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from pytorch_layer_test_class import PytorchLayerTest class TestUnbind(PytorchLayerTest): def _prepare_input(self): return (self.random.uniform(0, 50, (3, 3, 3, 3), dtype=np.float32),) ...
36
1,026
openvino
tests/layer_tests/pytorch_tests/test_set_item.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestSetItem(PytorchLayerTest): def _prepare_input(self): return [self.random.randint(-10, 10, [10]).tolist()] def create_model(self, idx): ...
32
924
openvino
tests/layer_tests/pytorch_tests/test_hann_window.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestHannWindow(PytorchLayerTest): def _prepare_input(self, window_size, out=False, out_dtype="float32"): import numpy as np if not out: ...
84
3,110
openvino
tests/layer_tests/pytorch_tests/test_unique.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import numpy as np from packaging.version import parse as parse_version import torch import sys from pytorch_layer_test_class import PytorchLayerTest class TestUnique2(PytorchLayerTest): def _prepare_input(self): ...
84
3,227
openvino
tests/layer_tests/pytorch_tests/test_linear.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestMatMul(PytorchLayerTest): def _prepare_input(self, m1_shape=(2, 2), m2_shape=(2, 2), bias_shape=None): if bias_shape is None: return...
78
2,922
openvino
tests/layer_tests/pytorch_tests/test_divmod.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy.testing as npt import openvino as ov import pytest import torch from pytorch_layer_test_class import SeededRandom # do not test via PytorchLayerTest since PytorchLayerTest triggers own TorchScript tracing # this test vali...
83
3,668
openvino
tests/layer_tests/pytorch_tests/test_reflection_pad.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestReflectionPad(PytorchLayerTest): def _prepare_input(self, n): return (self.random.randn(*(2, 5, 6, 7, 8)[:n+2]),) def create_model(self, pa...
55
1,658
openvino
tests/layer_tests/pytorch_tests/test_compressed_mm.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest def pack_uint4(tensor): packed_tensor = tensor.contiguous() packed_tensor = packed_tensor.reshape(-1, 2) packed_tensor = t...
165
6,167