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/src/openvino/experimental/__init__.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""
Package: openvino
This module provides access to experimental functionality that is subject to change without prior notice.
"""
# flake8: noqa
from openvino._pyopenvino.experimental import evaluate_as_partial_shape
from openvino._p... | 15 | 496 |
openvino | src/bindings/python/src/openvino/opset16/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 opset16."""
from functools import partial
from typing import Optional, Literal
from openvino import Node
from openvino.utils.decorators import nameable_op
from openv... | 219 | 8,360 |
openvino | src/bindings/python/src/openvino/opset4/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
from... | 463 | 18,101 |
openvino | src/bindings/python/src/openvino/opset8/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.exceptions import UserInputError
from openvino.op import Constant, Paramete... | 788 | 33,167 |
openvino | src/bindings/python/src/openvino/preprocess/torchvision/torchvision_preprocessing.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# mypy: disable-error-code="no-redef"
import numbers
import logging
import copy
import numpy as np
from abc import ABCMeta, abstractmethod
from functools import singledispatch
from typing import Any, Union
from c... | 362 | 13,861 |
openvino | src/bindings/python/src/openvino/preprocess/torchvision/__init__.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""
Package: openvino
Torchvision to OpenVINO preprocess converter.
"""
# flake8: noqa
from openvino._pyopenvino import get_version as _get_version
__version__ = _get_version()
from .preprocess_converter import PreprocessConverter
| 16 | 318 |
openvino | src/bindings/python/src/openvino/preprocess/torchvision/preprocess_converter.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from typing import Any, Union
from collections.abc import Callable
import logging
from openvino import Model
class PreprocessConverter():
def __init__(self, model: Model):
self._model = model
@... | 49 | 1,796 |
openvino | src/bindings/python/src/openvino/opset7/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, Union
import numpy as np
from openvino import Node, Shape
from openvino.op import Constant, Parameter
from ... | 167 | 5,014 |
openvino | src/bindings/python/src/openvino/frontend/frontend.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from typing import Union
from openvino._pyopenvino import FrontEnd as FrontEndBase
from openvino._pyopenvino import FrontEndManager as FrontEndManagerBase
from openvino._pyopenvino import InputModel
from openvino... | 45 | 1,401 |
openvino | src/bindings/python/src/openvino/frontend/pytorch/ts_decoder.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# mypy: ignore-errors
import inspect
import logging
import typing
import torch
from openvino.frontend.pytorch.py_pytorch_frontend import (
_FrontEndPytorchDecoder as Decoder,
_Type as DecoderType
)
from ... | 665 | 29,637 |
openvino | src/bindings/python/src/openvino/frontend/pytorch/utils.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# mypy: ignore-errors
import inspect
import logging
import torch
import numpy as np
from contextlib import contextmanager
from openvino import op, Type as OVType, Shape, Tensor, OVAny
from openvino import opset1... | 413 | 15,497 |
openvino | src/bindings/python/src/openvino/frontend/pytorch/inlined_extension.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from typing import Any, Union, Optional
from collections.abc import Callable
import torch
import numpy as np
import openvino as ov
from openvino.frontend.pytorch.ts_decoder import InlineConversionExtension
from op... | 262 | 10,333 |
openvino | src/bindings/python/src/openvino/frontend/pytorch/patch_model.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# mypy: ignore-errors
import functools
import logging
import threading
import torch
from openvino.frontend.pytorch import ModuleExtension
log = logging.getLogger(__name__)
def has_been_patched(module, name, or... | 628 | 28,273 |
openvino | src/bindings/python/src/openvino/frontend/pytorch/__init__.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Package: openvino.
Low level wrappers for the FrontEnd C++ API.
"""
try:
from openvino.frontend.pytorch.py_pytorch_frontend import _FrontEndPytorchDecoder as Decoder
from openvino.frontend.pytorch.py_... | 19 | 869 |
openvino | src/bindings/python/src/openvino/frontend/pytorch/patch_functions.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import builtins
import torch
from typing import Any, Optional
originals_map = {
"divmod": builtins.divmod
}
def patched_divmod(lhs: Any, rhs: Any) -> tuple[Any, Any]:
# TorchScript tracing outputs torch... | 48 | 1,486 |
openvino | src/bindings/python/src/openvino/frontend/pytorch/fx_decoder.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# mypy: ignore-errors
import logging
import inspect
import torch
# Import HigherOrderOperator for detecting higher-order operations (while_loop, cond, etc.)
# This is the official PyTorch API used in torch.expor... | 742 | 30,315 |
openvino | src/bindings/python/src/openvino/frontend/pytorch/compressed_tensors.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import logging
from typing import Any
import torch
from openvino.frontend.pytorch import ModuleExtension
log = logging.getLogger(__name__)
def build_extensions(for_export: b... | 191 | 9,353 |
openvino | src/bindings/python/src/openvino/frontend/pytorch/ov_custom_ops.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Register OpenVINO custom ops via torch.library for use with torch.export.
When converting quantized PyTorch models, module forwards are replaced with
calls to these custom ops. During ``torch.export``, the op... | 238 | 10,967 |
openvino | src/bindings/python/src/openvino/frontend/pytorch/module_extension.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from typing import Optional, Union
from collections.abc import Callable
import torch
class ModuleExtension:
"""An extension that replaces a PyTorch module with a single operation.
A module can be identi... | 69 | 3,104 |
openvino | src/bindings/python/src/openvino/frontend/pytorch/quantized.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import functools
import logging
from collections.abc import Callable
from typing import Any
import torch
from openvino.frontend.pytorch import ModuleExtension, compressed_tens... | 223 | 8,811 |
openvino | src/bindings/python/src/openvino/frontend/pytorch/gptq.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# mypy: ignore-errors
from functools import partial
import logging
import torch
log = logging.getLogger(__name__)
# Wraps a single tensor to a module to prevent it from jit.freezing
# It depends on a tensor dt... | 186 | 7,637 |
openvino | src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/op_support.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# mypy: ignore-errors
import logging
from collections.abc import Mapping
from torch.nn import Module
from torch._ops import OpOverload
from torch.fx.node import Node, _get_qualified_name
from torch.fx.passes.op... | 315 | 15,459 |
openvino | src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/execute.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# mypy: ignore-errors
from copy import deepcopy
from dataclasses import dataclass
from functools import lru_cache
from types import MappingProxyType
from warnings import warn
import torch
import torch.overrides
... | 227 | 7,345 |
openvino | src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/compile.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# mypy: ignore-errors
import os
import logging
from hashlib import sha256
import torch
import torch.overrides
from torch.fx import GraphModule
from openvino.frontend import FrontEndManager
from openvino.fronten... | 149 | 4,642 |
openvino | src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/backend_utils.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# mypy: ignore-errors
from typing import Optional, Any
from openvino import Core
def _get_device(options) -> Optional[Any]:
core = Core()
device = "CPU"
if options is not None and "device" in optio... | 89 | 2,520 |
openvino | src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/partition.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# mypy: ignore-errors
import torch
from torch.nn import Module
from torch.fx import GraphModule, Node
from torch.fx.passes.infra.partitioner import CapabilityBasedPartitioner, Partition
from torch.fx.experiment... | 149 | 6,663 |
openvino | src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/decompositions.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# mypy: ignore-errors
import torch
from torch._decomp.decompositions import aten, pw_cast_for_opmath
from torch._decomp import register_decomposition, get_decompositions
@register_decomposition(aten.convolution... | 390 | 13,216 |
openvino | src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/export_decompositions.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Decomposition lists for the ``torch.export`` path.
Unlike ``decompositions.py``, this module does **not** register any global
decompositions (via ``@register_decomposition``). It is safe to import from
code p... | 273 | 10,015 |
openvino | src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/backend.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# flake8: noqa
# mypy: ignore-errors
import logging
import os
from functools import partial
from hashlib import sha256
import torch
from torch._dynamo.backends.common import fake_tensor_unsupported, aot_autograd
from torch._dynamo.back... | 141 | 6,331 |
openvino | src/bindings/python/src/openvino/frontend/paddle/__init__.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""
Package: openvino
Low level wrappers for the FrontEnd C++ API.
"""
# flake8: noqa
try:
from openvino.frontend.paddle.py_paddle_frontend import ConversionExtensionPaddle as ConversionExtension
from openvino.frontend.paddle.p... | 16 | 530 |
openvino | src/bindings/python/src/openvino/frontend/tensorflow/graph_iterator.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# flake8: noqa
# mypy: ignore-errors
import tensorflow as tf
from openvino.frontend.tensorflow.node_decoder import TFGraphNodeDecoder
from openvino.frontend.tensorflow.py_tensorflow_frontend import _FrontEndPyGraphIterator as GraphItera... | 117 | 4,961 |
openvino | src/bindings/python/src/openvino/frontend/tensorflow/utils.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# flake8: noqa
# mypy: ignore-errors
import logging as log
import numpy as np
import sys
from openvino import PartialShape, Dimension, Type
from packaging.version import parse, Version
from typing import Union
# TODO: reuse this meth... | 499 | 21,867 |
openvino | src/bindings/python/src/openvino/frontend/tensorflow/__init__.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""
Package: openvino
Low level wrappers for the FrontEnd C++ API.
"""
# flake8: noqa
try:
from openvino.frontend.tensorflow.py_tensorflow_frontend import _FrontEndPyGraphIterator as GraphIterator
from openvino.frontend.tensorf... | 17 | 669 |
openvino | src/bindings/python/src/openvino/frontend/tensorflow/node_decoder.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# flake8: noqa
# mypy: ignore-errors
import numpy as np
import tensorflow as tf
from openvino.frontend.tensorflow.py_tensorflow_frontend import _FrontEndDecoderBase as DecoderBase
from openvino import PartialShape, Type, OVAny, Tensor
... | 220 | 9,545 |
openvino | src/bindings/python/src/openvino/frontend/onnx/__init__.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""
Package: openvino
Low level wrappers for the FrontEnd C++ API.
"""
# flake8: noqa
try:
from openvino.frontend.onnx.py_onnx_frontend import ConversionExtensionONNX as ConversionExtension
from openvino.frontend.onnx.py_onnx_f... | 16 | 517 |
openvino | src/bindings/python/src/openvino/frontend/jax/utils.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# flake8: noqa
# mypy: ignore-errors
import jax
from packaging import version
if version.parse(jax.__version__) < version.parse("0.6.0"):
import jax as jex
import jax.core
else:
import jax.extend as jex
import jax.numpy as... | 196 | 6,400 |
openvino | src/bindings/python/src/openvino/frontend/jax/__init__.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""
Package: openvino
Low level wrappers for the FrontEnd C++ API.
"""
# flake8: noqa
try:
from openvino.frontend.jax.py_jax_frontend import _FrontEndJaxDecoder as Decoder
except ImportError as err:
raise ImportError("OpenVINO ... | 15 | 431 |
openvino | src/bindings/python/src/openvino/frontend/jax/passes.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# flake8: noqa
# mypy: ignore-errors
from enum import Enum
from jax.lax import ConvDimensionNumbers
def enum_values_pass(value):
if isinstance(value, Enum):
return value.value
return value
def conv_dimension_numbers_p... | 66 | 1,780 |
openvino | src/bindings/python/src/openvino/frontend/jax/jaxpr_decoder.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# flake8: noqa
# mypy: ignore-errors
import jax
from packaging import version
if version.parse(jax.__version__) < version.parse("0.6.0"):
import jax as jex
import jax.core
else:
import jax.extend as jex
from openvino.fron... | 304 | 11,798 |
openvino | src/bindings/python/src/openvino/opset13/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 opset13."""
from functools import partial, singledispatch
from typing import Literal, Optional, Union
import logging
import numpy as np
log = logging.getLogger(__na... | 429 | 17,254 |
openvino | src/bindings/python/src/openvino/utils/types.py | .py | # -*- coding: utf-8 -*- # noqa: A005
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Functions related to converting between Python and numpy types and openvino types."""
import logging
from typing import Union, Optional
import numpy as np
from openvino.exceptions import OVType... | 178 | 5,311 |
openvino | src/bindings/python/src/openvino/utils/broadcasting.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import logging
from typing import Optional
from openvino import AxisSet
from openvino.utils.types import (
TensorShape,
)
log = logging.getLogger(__name__)
def get_broadcast_axes(
output_shape: TensorS... | 42 | 1,290 |
openvino | src/bindings/python/src/openvino/utils/reduction.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from typing import Optional
from collections.abc import Iterable
from openvino import Node
def get_reduction_axes(node: Node, reduction_axes: Optional[Iterable[int]]) -> Iterable[int]:
"""Get reduction axes... | 27 | 854 |
openvino | src/bindings/python/src/openvino/utils/node_factory.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from functools import singledispatchmethod
from typing import Any, Optional, Union
from pathlib import Path
from openvino._pyopenvino import NodeFactory as _NodeFactory
from openvino import Node, Output, Extens... | 135 | 5,199 |
openvino | src/bindings/python/src/openvino/utils/input_validation.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Helper functions for validating user input."""
import logging
from typing import Any, Optional
from collections.abc import Callable, Iterable
import numpy as np
from openvino.exceptions import UserInputError... | 135 | 4,803 |
openvino | src/bindings/python/src/openvino/utils/decorators.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from functools import wraps
from inspect import signature
from typing import Any, Optional, Union, get_origin, get_args
from collections.abc import Callable
from openvino import Node, Output
from openvino.utils.t... | 162 | 6,341 |
openvino | src/bindings/python/src/openvino/utils/postponed_constant.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from typing import Optional
from collections.abc import Callable
from openvino import Op, Type, Shape, Tensor, PartialShape, TensorVector
class PostponedConstant(Op):
"""Postponed Constant is a way to mater... | 70 | 2,514 |
openvino | src/bindings/python/src/openvino/utils/data_helpers/data_dispatcher.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from functools import singledispatch
from typing import Any, Union, Optional
import numpy as np
from openvino._pyopenvino import ConstOutput, Tensor, Type, RemoteTensor
from openvino.utils.data_helpers.wrappers ... | 473 | 15,540 |
openvino | src/bindings/python/src/openvino/utils/data_helpers/wrappers.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from functools import singledispatchmethod
from collections.abc import Iterator, Mapping, KeysView, ItemsView, ValuesView
from typing import Union, Optional
from openvino._pyopenvino import Te... | 150 | 4,761 |
openvino | src/bindings/python/src/openvino/opset17/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 opset17."""
from functools import partial
from typing import Optional
from openvino import Node
from openvino.utils.decorators import nameable_op, unary_op
from open... | 66 | 2,443 |
openvino | src/bindings/python/src/openvino/opset12/ops.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Factory functions for all ngraph 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.decora... | 121 | 4,417 |
openvino | src/bindings/python/src/openvino/opset3/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
from... | 637 | 24,245 |
openvino | src/bindings/python/src/openvino/opset10/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... | 177 | 7,350 |
openvino | src/bindings/python/src/openvino/opset14/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 opset14."""
from functools import partial
from typing import Union, Optional
from openvino import Node, Type
from openvino.utils.node_factory import _get_node_facto... | 175 | 7,121 |
openvino | src/bindings/python/src/openvino/helpers/packing.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# flake8: noqa
import numpy as np
from typing import Union
from openvino import Type, Shape
def pack_data(array: np.ndarray, type: Type) -> np.ndarray:
"""Represent array values as u1, u2, u3, u4, u6 or i4 openvino element type an... | 255 | 9,718 |
openvino | src/bindings/python/src/openvino/opset6/ops.py | .py | # -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
"""Factory functions for all openvino ops."""
from typing import Optional, Union
from functools import partial, singledispatch
from openvino import Node, Type, PartialShape, Output, Shape
fro... | 223 | 7,775 |
openvino | src/tests/test_utils/functional_test_utils/layer_tests_summary/rename_conformance_ir.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import defusedxml.ElementTree as ET
from argparse import ArgumentParser
from dataclasses import dataclass
from pathlib import Path
from hashlib import sha256
from utils.conformance_utils import get_logger, set_env_variable
from utils.co... | 265 | 10,980 |
openvino | src/tests/test_utils/functional_test_utils/layer_tests_summary/run_parallel.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import csv
import datetime
import heapq
import os
import shlex
import sys
import threading
from argparse import ArgumentParser
from hashlib import sha256
from pathlib import Path
from shutil import rmtree, copyfile
from subprocess import ... | 1,090 | 46,443 |
openvino | src/tests/test_utils/functional_test_utils/layer_tests_summary/analyze_confomance_fails.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import re
import sys
import shutil
import zipfile
import argparse
import openpyxl
from utils.conformance_utils import get_logger
from utils import constants
LOGS_ZIP_NAME = 'logs.zip'
NEW_LOG_DIR = 'ie_logs'
SW_PLUGINS = {'H... | 306 | 13,701 |
openvino | src/tests/test_utils/functional_test_utils/layer_tests_summary/highlight_tables.py | .py | import os
import re
import sys
import argparse
from utils.conformance_utils import get_logger
from pathlib import Path
import xml.etree.ElementTree as ET
from jinja2 import Environment, FileSystemLoader
logger = get_logger('HighlightTable')
OPSET_REPORT_NAME_RE = r'.*report_opset_\w*.xml'
API_REPORT_NAME_RE = r'.*... | 347 | 17,764 |
openvino | src/tests/test_utils/functional_test_utils/layer_tests_summary/merge_xmls.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import argparse
import os
import glob
import defusedxml.ElementTree as ET
from defusedxml import defuse_stdlib
from utils.conformance_utils import get_logger
from utils import stat_update_utils
from utils.constants import OP_CONFORMANC... | 184 | 9,069 |
openvino | src/tests/test_utils/functional_test_utils/layer_tests_summary/run_conformance.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import csv
import os
import urllib.request as ur
from argparse import ArgumentParser
from pathlib import Path
from shutil import copytree, rmtree, copyfile
from subprocess import Popen
from urllib.parse import urlparse
import defusedxml... | 366 | 20,873 |
openvino | src/tests/test_utils/functional_test_utils/layer_tests_summary/summarize.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import argparse
import os
import csv
from pathlib import Path
import defusedxml.ElementTree as ET
from defusedxml import defuse_stdlib
from jinja2 import Environment, FileSystemLoader
from utils.conformance_utils import get_logger
from... | 422 | 20,862 |
openvino | src/tests/test_utils/functional_test_utils/layer_tests_summary/conformance_helper_tools/compare_subgraph_dir.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from argparse import ArgumentParser
from utils.file_utils import prepare_filelist
from utils.constants import XML_EXTENSION, META_EXTENSION
from openvino import Core
import defusedxml.ElementTree as ET
def parse_arguments():
parser ... | 96 | 3,824 |
openvino | src/tests/test_utils/functional_test_utils/layer_tests_summary/conformance_helper_tools/find_models_for_subgraphs_dumper.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
from argparse import ArgumentParser
from pathlib import Path
import sys
import re
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from utils.file_utils import prepare_filelist, find_latest_dir
from utils.confo... | 136 | 6,028 |
openvino | src/tests/test_utils/functional_test_utils/layer_tests_summary/conformance_helper_tools/conformance_vs_accuracy_comparator.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import re
import csv
import os
from argparse import ArgumentParser
def parse_arguments():
parser = ArgumentParser()
accuracy_help = "Path to csv file with accuracy results"
conformance_help = "Path to csv file with conforma... | 185 | 7,603 |
openvino | src/tests/test_utils/functional_test_utils/layer_tests_summary/utils/get_available_devices.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from utils.conformance_utils import get_logger
from utils.constants import FULL_DEVICE_PROPERTY, SUPPORTED_PROPERTIES, DEVICE_ARCHITECTURE_PROPERTY
logger = get_logger("get_available_device")
try:
from openvino import Core
except:
... | 55 | 2,781 |
openvino | src/tests/test_utils/functional_test_utils/layer_tests_summary/utils/constants.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from sys import platform
TEST_STATUS = {
'passed': ["[ OK ]"],
'failed': ["[ FAILED ]"],
'hanged': ["Test finished by timeout"],
'crashed': ["Unexpected application crash with code", "Segmentation fault", "Crash ... | 72 | 1,769 |
openvino | src/tests/test_utils/functional_test_utils/layer_tests_summary/utils/stat_update_utils.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import math
import xml.etree.ElementTree as ET
from . import conformance_utils
def update_rel_values(xml_node: ET.SubElement):
if xml_node is None or len(xml_node.attrib) == 0:
return
if not "relative_all" in xml_node.a... | 89 | 4,121 |
openvino | src/tests/test_utils/functional_test_utils/layer_tests_summary/utils/file_utils.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import tarfile
from pathlib import Path, PurePath
from shutil import copyfile
from zipfile import ZipFile, is_zipfile
from urllib.parse import urlparse
from . import constants
from . import conformance_utils
# generates file... | 92 | 3,476 |
openvino | src/tests/test_utils/functional_test_utils/layer_tests_summary/utils/conformance_utils.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import logging
from sys import stdout
from os import environ
from . import constants
def get_logger(app_name: str):
logging.basicConfig()
logger = logging.getLogger(app_name)
logger.setLevel(logging.INFO)
return logger... | 41 | 1,120 |
openvino | src/common/conditional_compilation/scripts/ccheader.py | .py | #!/usr/bin/env python3
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# The main purpose of this script is code generation for conditional compilation.
# After collecting statistics using IntelSEAPI, several CSV files are generated.
# This script can read these files and can pro... | 192 | 6,425 |
openvino | src/plugins/intel_cpu/tools/dump_jit_disassm/__main__.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import re
import argparse
import platform
import subprocess
import sys
from colorama import Fore
def addr2line(exefile, addrs, addr2line_path):
proc = subprocess.Popen([addr2line_path, "-C", "-e", exefile, "-f", "-s", "-p"... | 106 | 3,991 |
openvino | src/plugins/intel_cpu/tools/dump_check/dump_check.py | .py | #!/usr/bin/python3
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openvino import Core, Model, Tensor, PartialShape, Type
from openvino import opset8 as opset
from openvino.op import Constant, Parameter, tensor_iterator
from openvino.passes import Manager, Serialize
from openvi... | 423 | 15,339 |
openvino | src/plugins/intel_cpu/tools/aggregate-average-counters/aggregate-average-counters.py | .py | #!/usr/bin/env python3
import pandas as pd
import argparse
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('--format', '-f', choices=['no', 'csv', 'md'], default='no', required=False, help="print data using format")
parser.add_argument('--group_by', '-g', choices=['layerName', 'la... | 53 | 1,835 |
openvino | src/plugins/intel_gpu/src/kernel_selector/primitive_db_gen.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
# To add new kernel please add a .cl file to kernels directory
# the database name will be the part of the file name up to first '.' character
# the trailing characters are a tag to allow multiple primitive implementations
from __future... | 301 | 12,711 |
openvino | src/plugins/intel_gpu/src/graph/common_utils/test_kernels_db_gen.py | .py | #!/usr/bin/python3
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import unittest
import os, sys
import argparse
from kernels_db_gen import Code2CHeaders
class TestOpenCLCodePreprocessing(unittest.TestCase):
def setUp(self):
self.kernels_folder = 'test_kernels'
s... | 197 | 6,453 |
openvino | src/plugins/intel_gpu/src/graph/common_utils/kernels_db_gen.py | .py | # Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import argparse
import glob
import ntpath
import re
def detect_guard_patterns(content):
# Detect include guard macros (#ifndef X paired with bodyless #define X for the
# same name) to avoid adding #undef for them. With... | 286 | 12,385 |
coremltools | setup.py | .py | #!/usr/bin/env python
#
# Copyright (c) 2017, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
import importlib.util
import os
from sys import platform
from setuptools import... | 116 | 3,744 |
coremltools | docs-guides/conf.py | .py | # 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 -----------------------------------------------------
# https://www.sphinx-doc.org/en/master... | 57 | 1,593 |
coremltools | mlmodel/docs/preprocess.py | .py | import os
import re
from itertools import izip
import inflection
def preprocess():
"splits _sources/reference.rst into separate files"
text = open("./_sources/reference.rst", "r").read()
os.remove("./_sources/reference.rst")
if not os.path.exists("./_sources/reference"):
os.makedirs("./_sour... | 35 | 959 |
coremltools | mlmodel/docs/conf.py | .py | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | 61 | 2,093 |
coremltools | mlmodel/docs/readme_session.py | .py | import json
import os
from requests.auth import HTTPBasicAuth
import requests
_readme_api_url = "https://dash.readme.io/api/v1/"
class ReadMeSession:
# Passed for every API call
__headers = {"Accept": "application/json", "content-type": "application/json"}
# Map: <version string -> version info>
__v... | 321 | 12,026 |
coremltools | docs/conf.py | .py | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | 96 | 2,989 |
coremltools | docs/examples/optimize/torch/palettization/dkm_palettization.py | .py | # -*- coding: utf-8 -*-
"""
.. _palettization_tutorial:
Palettization Using Differentiable K-Means
==========================================
"""
########################################################################
# In this tutorial, you learn how to palettize a
# network trained on `MNIST <http://yann.lecun.co... | 226 | 8,142 |
coremltools | docs/examples/optimize/torch/quantization/linear_quantization.py | .py | # -*- coding: utf-8 -*-
"""
.. _linear_quantization_tutorial:
Linear Quantization
===================
"""
########################################################################
# In this tutorial, you learn how to train a simple convolutional neural network on
# `MNIST <http://yann.lecun.com/exdb/mnist/>`_ using :... | 245 | 8,655 |
coremltools | docs/examples/optimize/torch/pruning/magnitude_pruning.py | .py | # -*- coding: utf-8 -*-
"""
.. _magnitude_pruning_tutorial:
Magnitude Pruning
=================
"""
########################################################################
# In this tutorial, you learn how to train a simple convolutional neural network on
# `MNIST <http://yann.lecun.com/exdb/mnist/>`_ using :py:cla... | 258 | 9,911 |
coremltools | scripts/build_tag.py | .py | #!/usr/bin/env python
#
# Copyright (c) 2021, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
# Construct a valid wheel build tag with ``git describe``.
#
# We do this with p... | 30 | 891 |
coremltools | coremltools/__init__.py | .py | # Copyright (c) 2017, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
"""
Core ML is an Apple framework which allows developers to simply and easily integrate machine
learnin... | 155 | 5,720 |
coremltools | coremltools/_deps/__init__.py | .py | # Copyright (c) 2017, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
"""
List of all external dependencies for this package. Imported as
optional includes
"""
import platfor... | 253 | 7,268 |
coremltools | coremltools/optimize/_utils.py | .py | # Copyright (c) 2024, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
import math
from collections import namedtuple
from typing import Collection, Dict, List, Optional, Tupl... | 962 | 39,878 |
coremltools | coremltools/optimize/coreml/_config.py | .py | # Copyright (c) 2020, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
from __future__ import annotations
import sys
from abc import ABC, abstractmethod
from collections i... | 1,199 | 51,115 |
coremltools | coremltools/optimize/coreml/__init__.py | .py | # Copyright (c) 2023, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
from ._config import (
OpLinearQuantizerConfig,
OpMagnitudePrunerConfig,
OpPalettizerConf... | 26 | 739 |
coremltools | coremltools/optimize/coreml/_post_training_quantization.py | .py | # Copyright (c) 2023, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
from collections import OrderedDict
from typing import Dict, List, Optional
import numpy as np
from att... | 759 | 29,982 |
coremltools | coremltools/optimize/coreml/_quantization_passes.py | .py | # Copyright (c) 2023, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
import atexit
from itertools import repeat
from multiprocessing import Pool
from typing import Callable,... | 1,747 | 73,588 |
coremltools | coremltools/optimize/coreml/experimental/_model_debugger.py | .py | # Copyright (c) 2024, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
from typing import List
import numpy as np
from tqdm import tqdm
import coremltools as ct
from coremlt... | 328 | 13,572 |
coremltools | coremltools/optimize/coreml/experimental/_post_training_quantization.py | .py | # Copyright (c) 2024, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
# TODO: coreml.experimental.linear_quantize_activations has been deprecated and related code will be rem... | 266 | 10,778 |
coremltools | coremltools/optimize/coreml/experimental/test_post_training_quantization.py | .py | # Copyright (c) 2025, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
import numpy as np
import torch
from io import StringIO
import sys
import coremltools as ct
from coreml... | 203 | 7,785 |
coremltools | coremltools/optimize/torch/base_model_optimizer.py | .py | # Copyright (c) 2024, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
import copy as _copy
import logging as _logging
from abc import ABC as _ABC
from abc import abstractm... | 145 | 5,272 |
coremltools | coremltools/optimize/torch/__init__.py | .py | # Copyright (c) 2024, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
from coremltools.optimize.torch import (
base_model_optimizer,
layerwise_compression,
opt... | 18 | 482 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.