Skip to content

Commit

Permalink
Merge branch 'master' into tj/plugin/template/remove-include-opset
Browse files Browse the repository at this point in the history
  • Loading branch information
t-jankowski authored Oct 11, 2023
2 parents b772cef + a3d6d0b commit 94face0
Show file tree
Hide file tree
Showing 84 changed files with 2,234 additions and 1,743 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -896,8 +896,7 @@ jobs:
run: |
python3 -m pytest -s ${INSTALL_TEST_DIR}/pyngraph \
--junitxml=${INSTALL_TEST_DIR}/TEST-Pyngraph.xml \
--ignore=${INSTALL_TEST_DIR}/pyngraph/tests_compatibility/test_onnx/test_zoo_models.py \
--ignore=${INSTALL_TEST_DIR}/pyngraph/tests_compatibility/test_onnx/test_backend.py
--ignore=${INSTALL_TEST_DIR}/pyngraph/tests_compatibility/test_onnx/test_zoo_models.py
- name: Python API 2.0 Tests
run: |
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -485,12 +485,11 @@ jobs:
python3 -m pip install $ov_dev_wheel_name[mxnet,caffe,kaldi,onnx,tensorflow2]
popd
- name: nGraph and IE Python Bindings Tests
- name: Python API 1.0 Tests
run: |
python3 -m pytest -s ${{ env.INSTALL_TEST_DIR }}/pyngraph \
--junitxml=${{ env.INSTALL_TEST_DIR }}/TEST-Pyngraph.xml \
--ignore=${{ env.INSTALL_TEST_DIR }}/pyngraph/tests/test_onnx/test_zoo_models.py \
--ignore=${{ env.INSTALL_TEST_DIR }}/pyngraph/tests/test_onnx/test_backend.py
--ignore=${{ env.INSTALL_TEST_DIR }}/pyngraph/tests/test_onnx/test_zoo_models.py
- name: Python API 2.0 Tests
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ jobs:
shell: cmd
run: |
set PYTHONPATH=${{ env.OPENVINO_REPO }}\tools\mo;${{ env.LAYER_TESTS_INSTALL_DIR }};%PYTHONPATH%
call "${{ env.INSTALL_DIR }}\\setupvars.bat" && python3 -m pytest -s ${{ env.INSTALL_TEST_DIR }}/pyngraph ${{ env.PYTHON_STATIC_ARGS }} --junitxml=${{ env.INSTALL_TEST_DIR }}/TEST-Pyngraph.xml --ignore=${{ env.INSTALL_TEST_DIR }}/pyngraph/tests_compatibility/test_onnx/test_zoo_models.py --ignore=${{ env.INSTALL_TEST_DIR }}/pyngraph/tests_compatibility/test_onnx/test_backend.py
call "${{ env.INSTALL_DIR }}\\setupvars.bat" && python3 -m pytest -s ${{ env.INSTALL_TEST_DIR }}/pyngraph ${{ env.PYTHON_STATIC_ARGS }} --junitxml=${{ env.INSTALL_TEST_DIR }}/TEST-Pyngraph.xml --ignore=${{ env.INSTALL_TEST_DIR }}/pyngraph/tests_compatibility/test_onnx/test_zoo_models.py
- name: Python API 2.0 Tests
shell: cmd
Expand Down
2 changes: 1 addition & 1 deletion docs/articles_en/openvino_workflow/openvino_intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ OpenVINO Runtime is a set of C++ libraries with C and Python bindings providing
Note that TensorFlow models can be run using the
:doc:`torch.compile feature <pytorch_2_0_torch_compile>`, as well as the standard ways of
:doc:`converting TensorFlow <openvino_docs_OV_Converter_UG_prepare_model_convert_model_Convert_Model_From_PyTorch>`
or reading them directly.
or reading them directly.

OpenVINO Runtime uses a plugin architecture. Its plugins are software components that contain complete implementation for inference on a particular Intel® hardware device: CPU, GPU, GNA, etc. Each plugin implements the unified API and provides additional hardware-specific APIs for configuring devices or API interoperability between OpenVINO Runtime and underlying plugin backend.

Expand Down
21 changes: 9 additions & 12 deletions src/bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,8 @@ ov_check_python_build_conditions()

# check __init__.py files alignment

function(ov_check_init_files_alignment)
function(ov_check_init_files_alignment init_files)
# check the files in pairs
list(APPEND init_files
"${OpenVINOPython_SOURCE_DIR}/src/openvino/__init__.py"
"${OpenVINOPython_SOURCE_DIR}/src/compatibility/openvino/__init__.py"
"${OpenVINO_SOURCE_DIR}/tools/mo/openvino/__init__.py"
"${OpenVINO_SOURCE_DIR}/tools/pot/openvino/__init__.py"
"${OpenVINO_SOURCE_DIR}/tools/ovc/openvino/__init__.py"
"${OpenVINO_SOURCE_DIR}/tools/benchmark_tool/openvino/__init__.py"
"${OpenVINO_SOURCE_DIR}/tools/openvino_dev/src/openvino/__init__.py")

list(LENGTH init_files init_files_count)
math(EXPR file_loop_range "${init_files_count}-2")
foreach(init_file_idx RANGE 0 ${file_loop_range})
Expand All @@ -145,12 +136,18 @@ function(ov_check_init_files_alignment)
RESULT_VARIABLE compare_result
)
if(compare_result EQUAL 1)
message(FATAL_ERROR "The __init__.py files are misaligned: ${file1} and ${file2}")
message(FATAL_ERROR "The runtime __init__.py files are misaligned: ${file1} and ${file2}")
endif()
endforeach()
endfunction()

ov_check_init_files_alignment()
set(INIT_FILES_RUNTIME
"${OpenVINOPython_SOURCE_DIR}/src/openvino/__init__.py"
"${OpenVINOPython_SOURCE_DIR}/src/compatibility/openvino/__init__.py"
"${OpenVINO_SOURCE_DIR}/tools/ovc/openvino/__init__.py"
"${OpenVINO_SOURCE_DIR}/tools/benchmark_tool/openvino/__init__.py")

ov_check_init_files_alignment("${INIT_FILES_RUNTIME}")

ov_option(ENABLE_PYTHON "Enables OpenVINO Python API build" ${ENABLE_PYTHON_DEFAULT})

Expand Down
82 changes: 41 additions & 41 deletions src/bindings/python/src/compatibility/openvino/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,47 +12,47 @@
except ImportError:
pass

# API 2.0
try:
# Import all public modules
from openvino import runtime as runtime
from openvino import frontend as frontend
from openvino import helpers as helpers
from openvino import preprocess as preprocess
from openvino import utils as utils
from openvino.runtime import properties as properties

# Import most important classes and functions from openvino.runtime
from openvino.runtime import Model
from openvino.runtime import Core
from openvino.runtime import CompiledModel
from openvino.runtime import InferRequest
from openvino.runtime import AsyncInferQueue

from openvino.runtime import Dimension
from openvino.runtime import Strides
from openvino.runtime import PartialShape
from openvino.runtime import Shape
from openvino.runtime import Layout
from openvino.runtime import Type
from openvino.runtime import Tensor
from openvino.runtime import OVAny

from openvino.runtime import compile_model
from openvino.runtime import get_batch
from openvino.runtime import set_batch
from openvino.runtime import serialize
from openvino.runtime import shutdown
from openvino.runtime import tensor_from_file
from openvino.runtime import save_model
from openvino.runtime import layout_helpers

# Set version for openvino package
from openvino.runtime import get_version
__version__ = get_version()
except ImportError:
import warnings
warnings.warn("openvino package has problems with imports!", ImportWarning, stacklevel=2)
# #
# # API 2.0
# # This __init__.py forces checking of runtime modules to propagate errors.
# # It is not compared with init files from openvino-dev package.
# #
# Import all public modules
from openvino import runtime as runtime
from openvino import frontend as frontend
from openvino import helpers as helpers
from openvino import preprocess as preprocess
from openvino import utils as utils
from openvino.runtime import properties as properties

# Import most important classes and functions from openvino.runtime
from openvino.runtime import Model
from openvino.runtime import Core
from openvino.runtime import CompiledModel
from openvino.runtime import InferRequest
from openvino.runtime import AsyncInferQueue

from openvino.runtime import Dimension
from openvino.runtime import Strides
from openvino.runtime import PartialShape
from openvino.runtime import Shape
from openvino.runtime import Layout
from openvino.runtime import Type
from openvino.runtime import Tensor
from openvino.runtime import OVAny

from openvino.runtime import compile_model
from openvino.runtime import get_batch
from openvino.runtime import set_batch
from openvino.runtime import serialize
from openvino.runtime import shutdown
from openvino.runtime import tensor_from_file
from openvino.runtime import save_model
from openvino.runtime import layout_helpers

# Set version for openvino package
from openvino.runtime import get_version
__version__ = get_version()

# Tools
try:
Expand Down
82 changes: 41 additions & 41 deletions src/bindings/python/src/openvino/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,47 +12,47 @@
except ImportError:
pass

# API 2.0
try:
# Import all public modules
from openvino import runtime as runtime
from openvino import frontend as frontend
from openvino import helpers as helpers
from openvino import preprocess as preprocess
from openvino import utils as utils
from openvino.runtime import properties as properties

# Import most important classes and functions from openvino.runtime
from openvino.runtime import Model
from openvino.runtime import Core
from openvino.runtime import CompiledModel
from openvino.runtime import InferRequest
from openvino.runtime import AsyncInferQueue

from openvino.runtime import Dimension
from openvino.runtime import Strides
from openvino.runtime import PartialShape
from openvino.runtime import Shape
from openvino.runtime import Layout
from openvino.runtime import Type
from openvino.runtime import Tensor
from openvino.runtime import OVAny

from openvino.runtime import compile_model
from openvino.runtime import get_batch
from openvino.runtime import set_batch
from openvino.runtime import serialize
from openvino.runtime import shutdown
from openvino.runtime import tensor_from_file
from openvino.runtime import save_model
from openvino.runtime import layout_helpers

# Set version for openvino package
from openvino.runtime import get_version
__version__ = get_version()
except ImportError:
import warnings
warnings.warn("openvino package has problems with imports!", ImportWarning, stacklevel=2)
# #
# # API 2.0
# # This __init__.py forces checking of runtime modules to propagate errors.
# # It is not compared with init files from openvino-dev package.
# #
# Import all public modules
from openvino import runtime as runtime
from openvino import frontend as frontend
from openvino import helpers as helpers
from openvino import preprocess as preprocess
from openvino import utils as utils
from openvino.runtime import properties as properties

# Import most important classes and functions from openvino.runtime
from openvino.runtime import Model
from openvino.runtime import Core
from openvino.runtime import CompiledModel
from openvino.runtime import InferRequest
from openvino.runtime import AsyncInferQueue

from openvino.runtime import Dimension
from openvino.runtime import Strides
from openvino.runtime import PartialShape
from openvino.runtime import Shape
from openvino.runtime import Layout
from openvino.runtime import Type
from openvino.runtime import Tensor
from openvino.runtime import OVAny

from openvino.runtime import compile_model
from openvino.runtime import get_batch
from openvino.runtime import set_batch
from openvino.runtime import serialize
from openvino.runtime import shutdown
from openvino.runtime import tensor_from_file
from openvino.runtime import save_model
from openvino.runtime import layout_helpers

# Set version for openvino package
from openvino.runtime import get_version
__version__ = get_version()

# Tools
try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

import logging

from sys import platform

import onnx.backend.test
from tests_compatibility import (
BACKEND_NAME,
Expand Down Expand Up @@ -32,6 +34,7 @@
xfail_issue_48052,
xfail_issue_52463,
xfail_issue_58033,
xfail_issue_58676,
xfail_issue_63033,
xfail_issue_63036,
xfail_issue_63043,
Expand Down Expand Up @@ -809,6 +812,12 @@ def expect_fail(test_case_path, xfail): # type: (str) -> None
),
]

if platform == 'darwin':
tests_expected_to_fail.append((
xfail_issue_58676,
"OnnxBackendNodeModelTest.test_div_uint8_cpu"
))

for test_group in tests_expected_to_fail:
for test_case in test_group[1:]:
expect_fail("{}".format(test_case), test_group[0])
2 changes: 2 additions & 0 deletions src/core/include/ngraph/opsets/opset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ const NGRAPH_API OpSet& get_opset8();
const NGRAPH_API OpSet& get_opset9();
const NGRAPH_API OpSet& get_opset10();
const NGRAPH_API OpSet& get_opset11();
const NGRAPH_API OpSet& get_opset12();
const NGRAPH_API OpSet& get_opset13();
const NGRAPH_API std::map<std::string, std::function<const ngraph::OpSet&()>>& get_available_opsets();
} // namespace ngraph
NGRAPH_SUPPRESS_DEPRECATED_END
4 changes: 1 addition & 3 deletions src/core/include/openvino/op/eye.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ class OPENVINO_API Eye : public Op {
m_output_type = output_type;
}

OPENVINO_SUPPRESS_DEPRECATED_START
bool evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const override;
OPENVINO_SUPPRESS_DEPRECATED_END
bool evaluate(TensorVector& outputs, const TensorVector& inputs) const override;
bool has_evaluate() const override;

protected:
Expand Down
23 changes: 23 additions & 0 deletions src/core/include/openvino/op/util/evaluate_helpers.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (C) 2018-2023 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//

#pragma once

#include "openvino/core/partial_shape.hpp"
#include "openvino/runtime/tensor.hpp"

namespace ov {
namespace op {
namespace util {

/**
* @brief Get the tensors shapes as ov::PartialShape.
*
* @param tensors Input tensors vector to get its shapes.
* @return Vector of partial shapes sam size as input tensor vector.
*/
std::vector<PartialShape> get_tensors_partial_shapes(const TensorVector& tensors);
} // namespace util
} // namespace op
} // namespace ov
32 changes: 21 additions & 11 deletions src/core/reference/include/openvino/reference/eye.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,41 @@
#include <cmath>

#include "openvino/core/shape.hpp"
#include "utils/span.hpp"

namespace ov {
namespace reference {

/**
* @brief Reference implementation of Eye operator
*
* @param data Pointer to output data.
* @param out_shape Output data size.
* @param diagonal_index Eye diagonal index to populate matrix with ones
*/
template <typename T>
void eye(T* data, const Shape& out_shape, const int64_t diagonal_index) {
const int64_t num_matrices = shape_size(span(out_shape).subspan(0, out_shape.size() - 2));
const int64_t num_rows = out_shape[out_shape.size() - 2];
const int64_t num_columns = out_shape[out_shape.size() - 1];
const auto spatial_dims_offset = out_shape.size() - 2;
const int64_t num_columns = out_shape.back();
const int64_t num_rows = out_shape[spatial_dims_offset];
const int64_t matrix_size = num_rows * num_columns;
const int64_t out_size = shape_size(out_shape);

// fill tensor by zero
std::fill(data, data + num_matrices * matrix_size, T(0));
std::fill(data, std::next(data, out_size), T(0));

// set ones on diagonal
const int64_t shift_by_columns = std::max(diagonal_index, int64_t(0));
const int64_t count_by_columns = std::max(num_columns - std::abs(diagonal_index), int64_t(0));
const int64_t count_by_rows = std::max(num_rows - std::abs(diagonal_index), int64_t(0));
constexpr int64_t zero{0};
const auto abs_diag_idx = static_cast<int64_t>(std::abs(diagonal_index));
const int64_t shift_by_columns = std::max(diagonal_index, zero);
const int64_t count_by_columns = std::max(num_columns - abs_diag_idx, zero);
const int64_t count_by_rows = std::max(num_rows - abs_diag_idx, zero);
const int64_t count =
diagonal_index > 0 ? std::min(count_by_columns, num_rows) : std::min(count_by_rows, num_columns);

for (auto i = 0; i < num_matrices; i++) {
for (auto j = 0; j < count; j++) {
for (auto matrix_offset = zero; matrix_offset < out_size; matrix_offset += matrix_size) {
for (auto j = 0; j < count; ++j) {
const int64_t index = (j + shift_by_columns - diagonal_index) * num_columns + j + shift_by_columns;
data[index + i * matrix_size] = static_cast<T>(1);
data[matrix_offset + index] = T{1};
}
}
}
Expand Down
Loading

0 comments on commit 94face0

Please sign in to comment.