forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master' into ci/gha/linux-arm-u22
- Loading branch information
Showing
34 changed files
with
404 additions
and
505 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Send workflows to OpenTelemetry (BETA) | ||
|
||
on: | ||
workflow_run: | ||
workflows: | ||
- Android ARM64 with vcpkg | ||
- Documentation | ||
- Cleanup PIP caches | ||
- Code snippets | ||
- Code Style | ||
- Code coverage | ||
- Coverity (Ubuntu 20.04, Python 3.11) | ||
- Fedora (RHEL), Python 3.9 | ||
- Linux (Ubuntu 20.04, Python 3.11) | ||
- Linux ARM64 (Ubuntu 20.04, Python 3.11) | ||
- Linux Static CC (Ubuntu 22.04, Python 3.11, Clang) | ||
- Linux RISC-V with Conan (Ubuntu 22.04, Python 3.10) | ||
- macOS (Python 3.11) | ||
- macOS ARM64 (Python 3.11) | ||
- MO | ||
- Python API Checks | ||
- Webassembly | ||
- Windows (VS 2019, Python 3.11) | ||
- Windows Conditional Compilation (VS 2022, Python 3.11) | ||
types: | ||
- completed | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
otel-export-trace: | ||
name: OpenTelemetry Export Trace | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Export Workflow Trace | ||
uses: inception-health/otel-export-trace-action@7eabc7de1f4753f0b45051b44bb0ba46d05a21ef | ||
with: | ||
otlpEndpoint: grpc://api.honeycomb.io:443/ | ||
otlpHeaders: ${{ secrets.OTLP_HEADERS }} | ||
githubToken: ${{ secrets.GITHUB_TOKEN }} | ||
runId: ${{ github.event.workflow_run.id }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"p": "OpenVINO 2022.1 has introduced OpenVINO API 2.0. For more information on transition steps from the previous API, see the <a href=\"https://docs.openvino.ai/latest/openvino_2_0_transition_guide.html\">transition guide</a>", | ||
"p": "", | ||
"version": "1", | ||
"style": "info" | ||
"style": "warning" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
src/frontends/onnx/frontend/src/op/layer_normalization.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
// Copyright (C) 2018-2024 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#include "op/layer_normalization.hpp" | ||
|
||
#include "exceptions.hpp" | ||
#include "openvino/op/add.hpp" | ||
#include "openvino/op/broadcast.hpp" | ||
#include "openvino/op/concat.hpp" | ||
#include "openvino/op/constant.hpp" | ||
#include "openvino/op/convert.hpp" | ||
#include "openvino/op/convert_like.hpp" | ||
#include "openvino/op/divide.hpp" | ||
#include "openvino/op/multiply.hpp" | ||
#include "openvino/op/negative.hpp" | ||
#include "openvino/op/reduce_mean.hpp" | ||
#include "openvino/op/reshape.hpp" | ||
#include "openvino/op/shape_of.hpp" | ||
#include "openvino/op/slice.hpp" | ||
#include "openvino/op/sqrt.hpp" | ||
#include "openvino/op/subtract.hpp" | ||
#include "ov_models/ov_builders/reshape.hpp" | ||
#include "utils/common.hpp" | ||
|
||
using namespace ov::op; | ||
using namespace ov::op::v0; | ||
using namespace ov::op::v1; | ||
using namespace ov::op::v8; | ||
|
||
OPENVINO_SUPPRESS_DEPRECATED_START | ||
namespace ngraph { | ||
namespace onnx_import { | ||
namespace op { | ||
namespace set_1 { | ||
|
||
ov::OutputVector layer_normalization(const Node& node) { | ||
const auto inputs = node.get_ng_inputs(); | ||
const auto num_inputs = inputs.size(); | ||
CHECK_VALID_NODE(node, | ||
num_inputs == 2 || num_inputs == 3, | ||
"LayerNormalization expects 2 or 3 input tensors. Got: ", | ||
num_inputs); | ||
|
||
const auto& X = inputs.at(0); | ||
const auto& Scale = inputs.at(1); | ||
|
||
auto axis = node.get_attribute_value<std::int64_t>("axis", -1); | ||
double epsilon = node.get_attribute_value<double>("epsilon", 1e-5); | ||
int64_t stash_type_i = | ||
node.get_attribute_value<int64_t>("stash_type", | ||
static_cast<int64_t>(ONNX_NAMESPACE::TensorProto_DataType_FLOAT)); | ||
element::Type stash_type = common::get_ov_element_type(stash_type_i); | ||
|
||
// following calculations are kept as close to the onnx\defs.cc description as possible | ||
auto FloatEpsilon = Constant::create(ov::element::f32, Shape{}, {epsilon}); | ||
auto Epsilon = std::make_shared<Convert>(FloatEpsilon, stash_type); | ||
auto XShape = std::make_shared<ShapeOf>(X); | ||
auto Rank = std::make_shared<v3::ShapeOf>(XShape); | ||
auto Zero1D = Constant::create(ov::element::i64, {1}, {0}); | ||
auto One1D = Constant::create(ov::element::i64, {1}, {1}); | ||
auto Axis1D = Constant::create(ov::element::i64, {1}, {axis}); | ||
auto PrefixShape = std::make_shared<Slice>(XShape, Zero1D, Axis1D, One1D); | ||
ov::Output<ov::Node> NumReducedAxes = (axis >= 0 ? std::make_shared<Subtract>(Rank, Axis1D)->output(0) | ||
: std::make_shared<Negative>(Axis1D)->output(0)); | ||
auto SuffixShape = std::make_shared<v3::Broadcast>(One1D, NumReducedAxes); | ||
auto ReducedShape = std::make_shared<Concat>(ov::OutputVector{PrefixShape, SuffixShape}, 0); | ||
|
||
auto X2D = util::flatten(X, static_cast<int>(axis)); | ||
auto XU = std::make_shared<Convert>(X2D, stash_type); | ||
|
||
auto Mean2D = std::make_shared<ReduceMean>(XU, One1D, true); | ||
auto Square = std::make_shared<Multiply>(XU, XU); | ||
auto MeanOfSquare = std::make_shared<ReduceMean>(Square, One1D, true); | ||
auto SquareOfMean = std::make_shared<Multiply>(Mean2D, Mean2D); | ||
|
||
auto Var = std::make_shared<Subtract>(MeanOfSquare, SquareOfMean); | ||
auto VarPlusEpsilon = std::make_shared<Add>(Var, Epsilon); | ||
auto StdDev = std::make_shared<Sqrt>(VarPlusEpsilon); | ||
auto Deviation = std::make_shared<Subtract>(XU, Mean2D); | ||
auto Normalized = std::make_shared<Divide>(Deviation, StdDev); | ||
auto NormalizedT = std::make_shared<ConvertLike>(Normalized, X); | ||
|
||
auto Scale2D = util::flatten(Scale, 0); | ||
auto Scaled = std::make_shared<Multiply>(NormalizedT, Scale2D); | ||
ov::Output<ov::Node> Biased = | ||
(num_inputs == 3 ? std::make_shared<Add>(Scaled, util::flatten(inputs.at(2), 0))->output(0) | ||
: Scaled->output(0)); | ||
|
||
auto Y = std::make_shared<Reshape>(Biased, XShape, false); | ||
auto InvStdDev2D = std::make_shared<Divide>(Constant::create(stash_type, {1}, {1}), StdDev); | ||
auto Mean = std::make_shared<Reshape>(Mean2D, ReducedShape, false); | ||
auto InvStdDev = std::make_shared<Reshape>(InvStdDev2D, ReducedShape, false); | ||
|
||
return ov::OutputVector{Y, Mean, InvStdDev}; | ||
} | ||
|
||
} // namespace set_1 | ||
} // namespace op | ||
} // namespace onnx_import | ||
} // namespace ngraph | ||
OPENVINO_SUPPRESS_DEPRECATED_END |
20 changes: 20 additions & 0 deletions
20
src/frontends/onnx/frontend/src/op/layer_normalization.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (C) 2018-2024 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
#pragma once | ||
|
||
#include "openvino/core/deprecated.hpp" | ||
OPENVINO_SUPPRESS_DEPRECATED_START | ||
|
||
#include "onnx_import/core/node.hpp" | ||
|
||
namespace ngraph { | ||
namespace onnx_import { | ||
namespace op { | ||
namespace set_1 { | ||
ov::OutputVector layer_normalization(const Node& node); | ||
} // namespace set_1 | ||
} // namespace op | ||
} // namespace onnx_import | ||
} // namespace ngraph | ||
OPENVINO_SUPPRESS_DEPRECATED_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.