Skip to content

Commit

Permalink
Merge branch 'master' into valid_device_name
Browse files Browse the repository at this point in the history
  • Loading branch information
awayzjj authored Mar 7, 2024
2 parents 9ac0d48 + 4f8f573 commit ed0f496
Show file tree
Hide file tree
Showing 317 changed files with 17,585 additions and 2,256 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
lfs: 'true'

- name: Install apt-get dependencies
uses: awalsh128/[email protected].1
uses: awalsh128/[email protected].2
with:
packages: graphviz texlive liblua5.2-0 libclang1-9 libclang-cpp9
version: 3.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/code_snippets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
submodules: 'true'

- name: Install OpenCL
uses: awalsh128/[email protected].1
uses: awalsh128/[email protected].2
if: runner.os == 'Linux'
with:
packages: ocl-icd-opencl-dev opencl-headers
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/job_samples_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ jobs:
source ${INSTALL_DIR}/setupvars.sh
PYTHONCOERCECLOCALE=warn python3 -bb -W error -X dev -X warn_default_encoding -m pytest $INSTALL_TEST_DIR/smoke_tests \
PYTHONCOERCECLOCALE=warn python3 -bb -W error -X dev -m pytest $INSTALL_TEST_DIR/smoke_tests \
--junitxml=$INSTALL_TEST_DIR/TEST-SamplesSmokeTests.xml
- name: Upload Test Results
Expand Down
21 changes: 13 additions & 8 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ jobs:

Conformance:
needs: [ Build, Smart_CI ]
timeout-minutes: ${{ matrix.TEST_TYPE == 'API' && 5 || 30 }}
timeout-minutes: ${{ matrix.TEST_TYPE == 'API' && 5 || 20 }}
defaults:
run:
shell: bash
Expand Down Expand Up @@ -511,18 +511,23 @@ jobs:
runner: 'ubuntu-20.04-8-cores'
model_scope: 'precommit'

TensorFlow_Models_Tests_Nightly:
name: TensorFlow Models tests
TensorFlow_Models_Tests_Nightly_TF_HUB:
name: TensorFlow TF Hub Models tests
if: ${{ github.event_name == 'schedule' }}
needs: [ Build, Smart_CI, Openvino_tokenizers ]
uses: ./.github/workflows/job_tensorflow_models_tests.yml
with:
runner: 'ubuntu-20.04-16-cores'
model_scope: 'nightly_tf_hub'

TensorFlow_Models_Tests_Nightly_HF:
name: TensorFlow Hugging Face Models tests
if: ${{ github.event_name == 'schedule' }}
needs: [ Build, Smart_CI, Openvino_tokenizers ]
strategy:
max-parallel: 2
matrix:
MODEL_SCOPE: ['nightly_hf', 'nightly_tf_hub']
uses: ./.github/workflows/job_tensorflow_models_tests.yml
with:
runner: 'ubuntu-20.04-16-cores'
model_scope: ${{ matrix.MODEL_SCOPE }}
model_scope: 'nightly_hf'

# TODO: Switch back to self-hosted runners
# container:
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/linux_arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,13 @@ jobs:
- name: Install build dependencies
run: |
bash ${OPENVINO_REPO}/install_build_dependencies.sh
# default-jdk - Java API
apt install --assume-yes --no-install-recommends default-jdk
apt install --assume-yes --no-install-recommends default-jdk gcc-10 g++-10
# Set gcc-10 as a default one
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 30
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 30
- name: Install sccache
uses: mozilla-actions/[email protected]
Expand Down
13 changes: 4 additions & 9 deletions samples/cpp/classification_sample_async/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,9 @@
#include "classification_sample_async.h"
// clang-format on

constexpr auto N_TOP_RESULTS = 10;

using namespace ov::preprocess;

/**
* @brief Checks input args
* @param argc number of args
* @param argv list of input arguments
* @return bool status true(Success) or false(Fail)
*/
namespace {
bool parse_and_check_command_line(int argc, char* argv[]) {
gflags::ParseCommandLineNonHelpFlags(&argc, &argv, true);
if (FLAGS_h) {
Expand All @@ -61,6 +54,7 @@ bool parse_and_check_command_line(int argc, char* argv[]) {

return true;
}
} // namespace

int main(int argc, char* argv[]) {
try {
Expand Down Expand Up @@ -100,7 +94,7 @@ int main(int argc, char* argv[]) {
// - precision of tensor is supposed to be 'u8'
// - layout of data is 'NHWC'
input_info.tensor().set_element_type(ov::element::u8).set_layout(tensor_layout);
// 3) Here we suppose model has 'NCHW' layout for input
// 3) Suppose model has 'NCHW' layout for input
input_info.model().set_layout("NCHW");
// 4) output() with no args assumes a model has a single result
// - output() with no args assumes a model has a single result
Expand Down Expand Up @@ -222,6 +216,7 @@ int main(int argc, char* argv[]) {
}

// Prints formatted classification results
constexpr size_t N_TOP_RESULTS = 10;
ClassificationResult classificationResult(output, valid_image_names, batchSize, N_TOP_RESULTS, labels);
classificationResult.show();
} catch (const std::exception& ex) {
Expand Down
2 changes: 1 addition & 1 deletion samples/cpp/hello_classification/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ int tmain(int argc, tchar* argv[]) {
// - convert layout to 'NCHW' (from 'NHWC' specified above at tensor layout)
// - apply linear resize from tensor spatial dims to model spatial dims
ppp.input().preprocess().resize(ov::preprocess::ResizeAlgorithm::RESIZE_LINEAR);
// 4) Here we suppose model has 'NCHW' layout for input
// 4) Suppose model has 'NCHW' layout for input
ppp.input().model().set_layout("NCHW");
// 5) Set output tensor information:
// - precision of tensor is supposed to be 'f32'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,7 @@ def main() -> int:
log.error('Sample supports only single output topologies')
return -1

# --------------------------- Step 3. Set up input --------------------------------------------------------------------
# Read input images
images = [cv2.imread(image_path) for image_path in args.input]

# Resize images to model input dims
_, _, h, w = model.input().shape
resized_images = [cv2.resize(image, (w, h)) for image in images]

# Add N dimension
input_tensors = [np.expand_dims(image, 0) for image in resized_images]

# --------------------------- Step 4. Apply preprocessing -------------------------------------------------------------
# --------------------------- Step 3. Apply preprocessing -------------------------------------------------------------
ppp = ov.preprocess.PrePostProcessor(model)

# 1) Set input tensor information:
Expand All @@ -97,7 +86,7 @@ def main() -> int:
.set_element_type(ov.Type.u8) \
.set_layout(ov.Layout('NHWC')) # noqa: N400

# 2) Here we suppose model has 'NCHW' layout for input
# 2) Suppose model has 'NCHW' layout for input
ppp.input().model().set_layout(ov.Layout('NCHW'))

# 3) Set output tensor information:
Expand All @@ -107,6 +96,17 @@ def main() -> int:
# 4) Apply preprocessing modifing the original 'model'
model = ppp.build()

# --------------------------- Step 4. Set up input --------------------------------------------------------------------
# Read input images
images = (cv2.imread(image_path) for image_path in args.input)

# Resize images to model input dims
_, h, w, _ = model.input().shape
resized_images = (cv2.resize(image, (w, h)) for image in images)

# Add N dimension
input_tensors = (np.expand_dims(image, 0) for image in resized_images)

# --------------------------- Step 5. Loading model to the device -----------------------------------------------------
log.info('Loading the model to the plugin')
compiled_model = core.compile_model(model, args.device)
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/js/node/lib/addon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ interface Core {
modelBuffer: Uint8Array, weightsBuffer?: Uint8Array): Promise<Model>;
readModelSync(modelPath: string, weightsPath?: string): Model;
readModelSync(modelBuffer: Uint8Array, weightsBuffer?: Uint8Array): Model;
getAvailableDevices(): string[];
}
interface CoreConstructor {
new(): Core;
Expand Down Expand Up @@ -81,7 +82,6 @@ interface InferRequest {
inferAsync(inputData: { [inputName: string]: Tensor}
| Tensor[] ): Promise<{ [outputName: string] : Tensor}>;
getCompiledModel(): CompiledModel;
getAvailableDevices(): string[];
}

type Dimension = number | [number, number];
Expand Down
2 changes: 2 additions & 0 deletions src/bindings/python/src/pyopenvino/utils/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,8 @@ ov::Any py_object_to_any(const py::object& py_obj) {
return py::cast<ov::intel_auto::SchedulePolicy>(py_obj);
} else if (py::isinstance<ov::hint::SchedulingCoreType>(py_obj)) {
return py::cast<ov::hint::SchedulingCoreType>(py_obj);
} else if (py::isinstance<ov::hint::ExecutionMode>(py_obj)) {
return py::cast<ov::hint::ExecutionMode>(py_obj);
} else if (py::isinstance<ov::log::Level>(py_obj)) {
return py::cast<ov::log::Level>(py_obj);
} else if (py::isinstance<ov::device::Type>(py_obj)) {
Expand Down
1 change: 1 addition & 0 deletions src/bindings/python/tests/test_runtime/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ def get_model_path(request, tmp_path):
@pytest.mark.parametrize("config", [
None,
{hints.performance_mode(): hints.PerformanceMode.THROUGHPUT},
{hints.execution_mode: hints.ExecutionMode.PERFORMANCE},
])
def test_compact_api(model_type, device_name, config, request):
compiled_model = None
Expand Down
12 changes: 12 additions & 0 deletions src/common/transformations/include/transformations/utils/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@
#include "transformations/rt_info/attributes.hpp"
#include "transformations_visibility.hpp"

/* This macro is intended to fix C++20 [=] lambda
warning. Although C++20 identifier is 202002L,
some compilers supporting C++20, or their drafts like
C++2a, producing the warning, are using 201402L value.
Also, MSVC requires a special check due to the
__cplusplus value compatibility issues.*/
#if (defined(_MSVC_LANG) && (_MSVC_LANG >= 202002L)) || (__cplusplus >= 201402L)
# define OV_CAPTURE_CPY_AND_THIS =, this
#else
# define OV_CAPTURE_CPY_AND_THIS =
#endif /* C++20 */

namespace ov {
namespace op {
namespace util {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ov::pass::AddFakeQuantizeFusion::AddFakeQuantizeFusion() {
pass::pattern::any_input(),
pass::pattern::any_input(),
pass::pattern::any_input()});
matcher_pass_callback callback = [=](pattern::Matcher& m) {
matcher_pass_callback callback = [OV_CAPTURE_CPY_AND_THIS](pattern::Matcher& m) {
const auto& pattern_value_map = m.get_pattern_value_map();
const auto& input = pattern_value_map.at(input_pattern);
const auto& type = input.get_element_type();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ ov::pass::BatchToSpaceFusion::BatchToSpaceFusion() {
auto reshape_or_transpose_after_pattern =
std::make_shared<pattern::op::Or>(OutputVector{reshape_after_pattern, trans_after_pattern});

ov::matcher_pass_callback callback = [=](pattern::Matcher& m) {
ov::matcher_pass_callback callback = [OV_CAPTURE_CPY_AND_THIS](pattern::Matcher& m) {
const auto& pattern_map = m.get_pattern_value_map();

auto get_reshape_or_transpose = [&pattern_map](
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ov::pass::ClampFusion::ClampFusion() {
pattern::consumers_count(1));
auto root = std::make_shared<ov::pass::pattern::op::Or>(ov::OutputVector{min_pattern1, max_pattern2});

ov::matcher_pass_callback callback = [=](pattern::Matcher& m) {
ov::matcher_pass_callback callback = [OV_CAPTURE_CPY_AND_THIS](pattern::Matcher& m) {
auto pattern_map = m.get_pattern_value_map();
auto data = pattern_map.at(data_pattern);
auto min_const =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ ov::pass::PullSqueezeThroughEltwise::PullSqueezeThroughEltwise() {
auto squeeze_axes_pattern = pattern::wrap_type<ov::op::v0::Constant>();
auto squeeze_pattern = pattern::wrap_type<ov::op::v0::Squeeze>({eltwise_pattern, squeeze_axes_pattern});

matcher_pass_callback callback = [=](pattern::Matcher& m) {
matcher_pass_callback callback = [OV_CAPTURE_CPY_AND_THIS](pattern::Matcher& m) {
const auto& pattern_map = m.get_pattern_map();
const auto& eltwise = pattern_map.at(eltwise_pattern);
const auto& squeeze = pattern_map.at(squeeze_pattern);
Expand Down Expand Up @@ -91,7 +91,7 @@ ov::pass::ReplaceConcatReduceByMinOrMax::ReplaceConcatReduceByMinOrMax() {
auto reduce_pattern = ov::pass::pattern::wrap_type<ov::op::v1::ReduceMin, ov::op::v1::ReduceMax>(
{concat_pattern, reduce_axes_pattern});

ov::matcher_pass_callback callback = [=](pattern::Matcher& m) {
ov::matcher_pass_callback callback = [OV_CAPTURE_CPY_AND_THIS](pattern::Matcher& m) {
const auto& pattern_map = m.get_pattern_value_map();

auto concat = as_type_ptr<ov::op::v0::Concat>(pattern_map.at(concat_pattern).get_node_shared_ptr());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ ov::pass::ConvertQuantizeDequantize::ConvertQuantizeDequantize() {
auto scale_pattern = pass::pattern::any_input();
auto mul_pattern = ov::pass::pattern::wrap_type<ov::op::v1::Multiply>({sub_pattern, scale_pattern});

ov::matcher_pass_callback callback = [=](pattern::Matcher& m) {
ov::matcher_pass_callback callback = [OV_CAPTURE_CPY_AND_THIS](pattern::Matcher& m) {
auto pattern_map = m.get_pattern_value_map();

if (transformation_callback(m.get_match_root())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "openvino/op/variadic_split.hpp"
#include "openvino/pass/pattern/op/wrap_type.hpp"
#include "transformations/common_optimizations/convolution_to_group_convolution_fusion.hpp"
#include "transformations/utils/utils.hpp"

static bool compare_convolutions(const ov::op::v1::Convolution* conv1, ov::Node* node) {
const auto conv2 = ov::as_type<ov::op::v1::Convolution>(node);
Expand Down Expand Up @@ -104,7 +105,7 @@ ov::pass::ConvolutionToGroupConvolutionFusion::ConvolutionToGroupConvolutionFusi
};
auto concat_label = pattern::wrap_type<ov::op::v0::Concat>(has_conv_inputs);

matcher_pass_callback callback = [=](pattern::Matcher& m) {
matcher_pass_callback callback = [OV_CAPTURE_CPY_AND_THIS](pattern::Matcher& m) {
const auto& pattern_value_map = m.get_pattern_value_map();
const auto& concat = pattern_value_map.at(concat_label).get_node_shared_ptr();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ ov::pass::DilatedConvolutionConverter::DilatedConvolutionConverter() {
auto batch_to_space_pattern = pattern::wrap_type<ov::op::v1::BatchToSpace>(
{conv_pattern, pattern::any_input(), crops_begin_pattern, crops_end_pattern});

matcher_pass_callback callback = [=](pattern::Matcher& m) {
matcher_pass_callback callback = [OV_CAPTURE_CPY_AND_THIS](pattern::Matcher& m) {
const auto& pattern_map = m.get_pattern_value_map();
auto block_shape =
std::dynamic_pointer_cast<ov::op::v0::Constant>(pattern_map.at(block_shape_pattern).get_node_shared_ptr());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ov::pass::DivideFusion::DivideFusion() {
auto p_mul_input = pattern::any_input();
auto p_mul = ov::pass::pattern::wrap_type<ov::op::v1::Multiply>({p_mul_input, p_pow});

matcher_pass_callback callback = [=](pattern::Matcher& m) {
matcher_pass_callback callback = [OV_CAPTURE_CPY_AND_THIS](pattern::Matcher& m) {
const auto& pattern_to_output = m.get_pattern_value_map();
const auto& minuend_input = pattern_to_output.at(p_mul_input);
const auto& subtrahend_input = pattern_to_output.at(p_pow_input);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ ov::pass::EliminateGatherUnsqueeze::EliminateGatherUnsqueeze() {
const auto or_label = std::make_shared<pattern::op::Or>(OutputVector{gather_label, be_label});
const auto unsqueeze_label = wrap_type<v0::Unsqueeze, v1::Reshape>({or_label, any_input()}, rank_equals(1));

ov::matcher_pass_callback callback = [=](Matcher& m) {
ov::matcher_pass_callback callback = [OV_CAPTURE_CPY_AND_THIS](Matcher& m) {
auto pattern_nodes = m.get_pattern_map();
auto& gather = pattern_nodes.at(gather_label);
auto& unsqueeze = pattern_nodes.at(unsqueeze_label);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ ov::pass::FakeQuantizeMulFusion::FakeQuantizeMulFusion() {
const auto mul_node_p =
ov::pass::pattern::wrap_type<ov::op::v1::Multiply>({fq_node_p, mul_constant_p}, pattern::consumers_count(1));

ov::matcher_pass_callback callback = [=](pattern::Matcher& m) {
ov::matcher_pass_callback callback = [OV_CAPTURE_CPY_AND_THIS](pattern::Matcher& m) {
const auto& pattern_map = m.get_pattern_value_map();

const auto& data = pattern_map.at(data_p);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ ov::pass::HSigmoidFusionWithReluDiv::HSigmoidFusionWithReluDiv() {
auto div_constant = ov::pass::pattern::wrap_type<ov::op::v0::Constant>();
auto div = ov::pass::pattern::wrap_type<ov::op::v1::Divide>({min, div_constant});

ov::matcher_pass_callback callback = [=](ov::pass::pattern::Matcher& m) {
ov::matcher_pass_callback callback = [OV_CAPTURE_CPY_AND_THIS](ov::pass::pattern::Matcher& m) {
auto& pattern_to_output = m.get_pattern_value_map();
auto x_output = pattern_to_output.at(input);

Expand Down Expand Up @@ -82,7 +82,7 @@ ov::pass::HSigmoidFusionWithReluMul::HSigmoidFusionWithReluMul() {
auto mul_constant = ov::pass::pattern::wrap_type<ov::op::v0::Constant>();
auto mul_second = ov::pass::pattern::wrap_type<ov::op::v1::Multiply>({min, mul_constant});

ov::matcher_pass_callback callback = [=](ov::pass::pattern::Matcher& m) {
ov::matcher_pass_callback callback = [OV_CAPTURE_CPY_AND_THIS](ov::pass::pattern::Matcher& m) {
auto& pattern_to_output = m.get_pattern_value_map();
auto x_output = pattern_to_output.at(input);

Expand Down Expand Up @@ -131,7 +131,7 @@ ov::pass::HSigmoidFusionWithoutRelu::HSigmoidFusionWithoutRelu() {
auto div = ov::pass::pattern::wrap_type<ov::op::v1::Divide>({min, div_constant});
auto mul = ov::pass::pattern::wrap_type<ov::op::v1::Multiply>({input, div});

ov::matcher_pass_callback callback = [=](ov::pass::pattern::Matcher& m) {
ov::matcher_pass_callback callback = [OV_CAPTURE_CPY_AND_THIS](ov::pass::pattern::Matcher& m) {
auto& pattern_to_output = m.get_pattern_value_map();
auto x_output = pattern_to_output.at(input);

Expand Down Expand Up @@ -179,7 +179,7 @@ ov::pass::HSigmoidFusionWithClampMul::HSigmoidFusionWithClampMul() {
auto mul_constant = ov::pass::pattern::wrap_type<ov::op::v0::Constant>();
auto mul_first = ov::pass::pattern::wrap_type<ov::op::v1::Multiply>({clamp, mul_constant});

ov::matcher_pass_callback callback = [=](ov::pass::pattern::Matcher& m) {
ov::matcher_pass_callback callback = [OV_CAPTURE_CPY_AND_THIS](ov::pass::pattern::Matcher& m) {
auto& pattern_to_output = m.get_pattern_value_map();
auto x_output = pattern_to_output.at(input);

Expand Down Expand Up @@ -225,7 +225,7 @@ ov::pass::HSigmoidFusionWithClampDiv::HSigmoidFusionWithClampDiv() {
auto div_constant = ov::pass::pattern::wrap_type<ov::op::v0::Constant>();
auto div = ov::pass::pattern::wrap_type<ov::op::v1::Divide>({clamp, div_constant});

ov::matcher_pass_callback callback = [=](ov::pass::pattern::Matcher& m) {
ov::matcher_pass_callback callback = [OV_CAPTURE_CPY_AND_THIS](ov::pass::pattern::Matcher& m) {
auto& pattern_to_output = m.get_pattern_value_map();
auto x_output = pattern_to_output.at(input);

Expand Down
Loading

0 comments on commit ed0f496

Please sign in to comment.