Remove ngraph/type API (#22297)
This commit is contained in:
parent
20abadab2f
commit
e1fcafc165
|
|
@ -71,20 +71,16 @@ if (useLpt) {
|
|||
// Low precision transformations plugin specific configuration: restrictions definition
|
||||
auto supportedPrecisions = std::vector<PrecisionsRestriction>({
|
||||
PrecisionsRestriction::create<ov::opset1::Convolution>({
|
||||
{{0}, {ngraph::element::u8}},
|
||||
{{1}, {ngraph::element::i8}},
|
||||
}),
|
||||
PrecisionsRestriction::create<ov::opset1::ConvolutionBackpropData>({
|
||||
{{0}, {ngraph::element::u8, ngraph::element::i8}},
|
||||
{{1}, {ngraph::element::i8}}
|
||||
}),
|
||||
PrecisionsRestriction::create<ov::opset1::GroupConvolution>({
|
||||
{{0}, {ngraph::element::u8}},
|
||||
{{1}, {ngraph::element::i8}}
|
||||
{{0}, {ov::element::u8}},
|
||||
{{1}, {ov::element::i8}},
|
||||
}),
|
||||
PrecisionsRestriction::create<ov::opset1::ConvolutionBackpropData>(
|
||||
{{{0}, {ov::element::u8, ov::element::i8}}, {{1}, {ov::element::i8}}}),
|
||||
PrecisionsRestriction::create<ov::opset1::GroupConvolution>(
|
||||
{{{0}, {ov::element::u8}}, {{1}, {ov::element::i8}}}),
|
||||
PrecisionsRestriction::create<ov::opset1::Multiply>({
|
||||
{{0}, {ngraph::element::u8}},
|
||||
{{1}, {ngraph::element::i8}},
|
||||
{{0}, {ov::element::u8}},
|
||||
{{1}, {ov::element::i8}},
|
||||
}),
|
||||
});
|
||||
|
||||
|
|
@ -134,8 +130,8 @@ using namespace ov::pass::low_precision;
|
|||
//! [lpt_supported_precisions]
|
||||
auto supportedPrecisions = std::vector<PrecisionsRestriction>({
|
||||
PrecisionsRestriction::create<ov::opset1::Convolution>({
|
||||
{{0}, {ngraph::element::u8}},
|
||||
{{1}, {ngraph::element::i8}},
|
||||
{{0}, {ov::element::u8}},
|
||||
{{1}, {ov::element::i8}},
|
||||
}),
|
||||
});
|
||||
|
||||
|
|
@ -170,7 +166,7 @@ lptManager.run_passes(nGraphFunc);
|
|||
return 0;
|
||||
}
|
||||
|
||||
int asymmetric_quantization(const std::vector<ngraph::element::Type>& defaultPrecisions) {
|
||||
int asymmetric_quantization(const std::vector<ov::element::Type>& defaultPrecisions) {
|
||||
std::shared_ptr<ov::Model> nGraphFunc;
|
||||
ov::pass::Manager manager;
|
||||
auto pass_config = manager.get_pass_config();
|
||||
|
|
@ -198,8 +194,8 @@ using namespace ov::pass::low_precision;
|
|||
//! [lpt_markup_pipeline]
|
||||
auto supportedPrecisions = std::vector<PrecisionsRestriction>({
|
||||
PrecisionsRestriction::create<ov::opset1::Convolution>({
|
||||
{{0}, {ngraph::element::u8}},
|
||||
{{1}, {ngraph::element::i8}},
|
||||
{{0}, {ov::element::u8}},
|
||||
{{1}, {ov::element::i8}},
|
||||
}),
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#include "ngraph/deprecated.hpp"
|
||||
#include "ngraph/node.hpp"
|
||||
#include "ngraph/shape.hpp"
|
||||
#include "ngraph/type/element_type_traits.hpp"
|
||||
#include "openvino/core/type/element_type_traits.hpp"
|
||||
|
||||
namespace ngraph {
|
||||
/// \brief Execute handlers on a subgraph to compute values
|
||||
|
|
|
|||
|
|
@ -53,15 +53,14 @@
|
|||
#include "ngraph/factory.hpp"
|
||||
#include "ngraph/function.hpp"
|
||||
#include "ngraph/node.hpp"
|
||||
#include "ngraph/ops.hpp"
|
||||
#include "ngraph/partial_shape.hpp"
|
||||
#include "ngraph/rt_info.hpp"
|
||||
#include "ngraph/shape.hpp"
|
||||
#include "ngraph/specialize_function.hpp"
|
||||
#include "ngraph/type/element_type.hpp"
|
||||
#include "openvino/core/descriptor/input.hpp"
|
||||
#include "openvino/core/descriptor/output.hpp"
|
||||
#include "openvino/core/descriptor/tensor.hpp"
|
||||
#include "openvino/core/type/element_type.hpp"
|
||||
|
||||
// nGraph opsets
|
||||
#include "ngraph/opsets/opset.hpp"
|
||||
#include "ngraph/opsets/opset.hpp"
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(IN_OV_COMPONENT) && !defined(NGRAPH_LEGACY_HEADER_INCLUDED)
|
||||
# define NGRAPH_LEGACY_HEADER_INCLUDED
|
||||
# ifdef _MSC_VER
|
||||
# pragma message( \
|
||||
"The nGraph API is deprecated and will be removed in the 2024.0 release. For instructions on transitioning to the new API, please refer to https://docs.openvino.ai/latest/openvino_2_0_transition_guide.html")
|
||||
# else
|
||||
# warning("The nGraph API is deprecated and will be removed in the 2024.0 release. For instructions on transitioning to the new API, please refer to https://docs.openvino.ai/latest/openvino_2_0_transition_guide.html")
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "openvino/core/type/bfloat16.hpp"
|
||||
|
||||
namespace ngraph {
|
||||
using ov::bfloat16;
|
||||
} // namespace ngraph
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
//================================================================================================
|
||||
// ElementType
|
||||
//================================================================================================
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(IN_OV_COMPONENT) && !defined(NGRAPH_LEGACY_HEADER_INCLUDED)
|
||||
# define NGRAPH_LEGACY_HEADER_INCLUDED
|
||||
# ifdef _MSC_VER
|
||||
# pragma message( \
|
||||
"The nGraph API is deprecated and will be removed in the 2024.0 release. For instructions on transitioning to the new API, please refer to https://docs.openvino.ai/latest/openvino_2_0_transition_guide.html")
|
||||
# else
|
||||
# warning("The nGraph API is deprecated and will be removed in the 2024.0 release. For instructions on transitioning to the new API, please refer to https://docs.openvino.ai/latest/openvino_2_0_transition_guide.html")
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "ngraph/deprecated.hpp"
|
||||
#include "ngraph/type/bfloat16.hpp"
|
||||
#include "ngraph/type/float16.hpp"
|
||||
#include "openvino/core/type/element_type.hpp"
|
||||
|
||||
namespace ngraph {
|
||||
namespace element {
|
||||
using ov::element::Type;
|
||||
using ov::element::Type_t;
|
||||
using TypeVector = std::vector<Type>;
|
||||
|
||||
using ov::element::bf16;
|
||||
using ov::element::boolean;
|
||||
using ov::element::dynamic;
|
||||
using ov::element::f16;
|
||||
using ov::element::f32;
|
||||
using ov::element::f64;
|
||||
using ov::element::f8e4m3;
|
||||
using ov::element::f8e5m2;
|
||||
using ov::element::i16;
|
||||
using ov::element::i32;
|
||||
using ov::element::i4;
|
||||
using ov::element::i64;
|
||||
using ov::element::i8;
|
||||
using ov::element::nf4;
|
||||
using ov::element::string;
|
||||
using ov::element::u1;
|
||||
using ov::element::u16;
|
||||
using ov::element::u32;
|
||||
using ov::element::u4;
|
||||
using ov::element::u64;
|
||||
using ov::element::u8;
|
||||
using ov::element::undefined;
|
||||
|
||||
template <typename T>
|
||||
NGRAPH_API_DEPRECATED Type from() {
|
||||
return ov::element::from<T>();
|
||||
}
|
||||
} // namespace element
|
||||
|
||||
/// \brief Return the number of bytes in the compile-time representation of the element type.
|
||||
NGRAPH_API_DEPRECATED
|
||||
size_t compiler_byte_size(element::Type_t et);
|
||||
} // namespace ngraph
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(IN_OV_COMPONENT) && !defined(NGRAPH_LEGACY_HEADER_INCLUDED)
|
||||
# define NGRAPH_LEGACY_HEADER_INCLUDED
|
||||
# ifdef _MSC_VER
|
||||
# pragma message( \
|
||||
"The nGraph API is deprecated and will be removed in the 2024.0 release. For instructions on transitioning to the new API, please refer to https://docs.openvino.ai/latest/openvino_2_0_transition_guide.html")
|
||||
# else
|
||||
# warning("The nGraph API is deprecated and will be removed in the 2024.0 release. For instructions on transitioning to the new API, please refer to https://docs.openvino.ai/latest/openvino_2_0_transition_guide.html")
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "openvino/core/type/element_type_traits.hpp"
|
||||
|
||||
namespace ngraph {
|
||||
using ov::element_type_traits;
|
||||
|
||||
using ov::fundamental_type_for;
|
||||
|
||||
} // namespace ngraph
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(IN_OV_COMPONENT) && !defined(NGRAPH_LEGACY_HEADER_INCLUDED)
|
||||
# define NGRAPH_LEGACY_HEADER_INCLUDED
|
||||
# ifdef _MSC_VER
|
||||
# pragma message( \
|
||||
"The nGraph API is deprecated and will be removed in the 2024.0 release. For instructions on transitioning to the new API, please refer to https://docs.openvino.ai/latest/openvino_2_0_transition_guide.html")
|
||||
# else
|
||||
# warning("The nGraph API is deprecated and will be removed in the 2024.0 release. For instructions on transitioning to the new API, please refer to https://docs.openvino.ai/latest/openvino_2_0_transition_guide.html")
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "openvino/core/type/float16.hpp"
|
||||
|
||||
namespace ngraph {
|
||||
using ov::float16;
|
||||
} // namespace ngraph
|
||||
|
|
@ -33,9 +33,9 @@
|
|||
#include "ngraph/graph_util.hpp"
|
||||
#include "ngraph/node.hpp"
|
||||
#include "ngraph/shape.hpp"
|
||||
#include "ngraph/type/element_type.hpp"
|
||||
#include "ngraph/type/element_type_traits.hpp"
|
||||
#include "openvino/core/enum_mask.hpp"
|
||||
#include "openvino/core/type/element_type.hpp"
|
||||
#include "openvino/core/type/element_type_traits.hpp"
|
||||
#include "openvino/runtime/tensor.hpp"
|
||||
|
||||
namespace ov {
|
||||
|
|
@ -255,7 +255,7 @@ NGRAPH_API_DEPRECATED T double_to_int(double x, double float_to_int_converter(do
|
|||
|
||||
template <typename T>
|
||||
NGRAPH_API_DEPRECATED std::vector<T> read_vector(std::shared_ptr<ov::Tensor> tv) {
|
||||
if (ngraph::element::from<T>() != tv->get_element_type()) {
|
||||
if (ov::element::from<T>() != tv->get_element_type()) {
|
||||
OPENVINO_THROW("read_vector type must match Tensor type");
|
||||
}
|
||||
size_t element_count = ngraph::shape_size(tv->get_shape());
|
||||
|
|
@ -265,8 +265,8 @@ NGRAPH_API_DEPRECATED std::vector<T> read_vector(std::shared_ptr<ov::Tensor> tv)
|
|||
return rc;
|
||||
}
|
||||
|
||||
template <class T, ngraph::element::Type_t ET>
|
||||
NGRAPH_API_DEPRECATED std::vector<T> array_2_vector(typename ngraph::element_type_traits<ET>::value_type* data,
|
||||
template <class T, ov::element::Type_t ET>
|
||||
NGRAPH_API_DEPRECATED std::vector<T> array_2_vector(typename ov::element_type_traits<ET>::value_type* data,
|
||||
size_t size) {
|
||||
std::vector<T> result(size);
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,11 @@ using ov::normalize_axes;
|
|||
using ov::normalize_axis;
|
||||
using ov::op::v0::Constant;
|
||||
|
||||
namespace element {
|
||||
using ov::element::Type;
|
||||
using ov::element::Type_t;
|
||||
} // namespace element
|
||||
|
||||
NGRAPH_API_DEPRECATED
|
||||
NGRAPH_API
|
||||
Strides conv_default_strides(const Node* node,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "ngraph/graph_util.hpp"
|
||||
#include "openvino/core/graph_util.hpp"
|
||||
|
||||
#include <numeric>
|
||||
#include <unordered_map>
|
||||
|
|
@ -609,18 +609,18 @@ void insert_new_node_between(const std::shared_ptr<Node>& src_node,
|
|||
dst_input.replace_source_output(new_node->output(0)); // Remove [0] (again), add [8], remove [1], add [9]
|
||||
}
|
||||
|
||||
std::shared_ptr<ov::Node> make_zero(const element::Type& element_type, const Shape& shape) {
|
||||
std::shared_ptr<ov::Node> make_zero(const ov::element::Type& element_type, const Shape& shape) {
|
||||
auto zero = ov::op::v0::Constant::create(element_type, Shape{}, {0.0});
|
||||
if (shape.size() > 0) {
|
||||
return std::make_shared<ov::op::v1::Broadcast>(
|
||||
zero,
|
||||
ov::op::v0::Constant::create(element::u64, Shape{shape.size()}, shape));
|
||||
ov::op::v0::Constant::create(ov::element::u64, Shape{shape.size()}, shape));
|
||||
}
|
||||
return zero;
|
||||
}
|
||||
|
||||
std::shared_ptr<ov::Node> make_constant_from_string(std::string val,
|
||||
const element::Type& element_type,
|
||||
const ov::element::Type& element_type,
|
||||
const Shape& shape) {
|
||||
auto cvals = std::vector<std::string>(shape_size(shape), val);
|
||||
return std::make_shared<ov::op::v0::Constant>(element_type, shape, cvals);
|
||||
|
|
|
|||
|
|
@ -819,31 +819,32 @@ std::shared_ptr<op::v0::Constant> get_constant_min_of_type(element::Type_t t) {
|
|||
}
|
||||
|
||||
std::shared_ptr<op::v0::Constant> get_constant_lowest_of_type(element::Type_t t) {
|
||||
#define OPENVINO_TYPE_TO_LOWEST_CONST(t) \
|
||||
case t: \
|
||||
return op::v0::Constant::create(t, \
|
||||
{}, \
|
||||
{std::numeric_limits<typename element_type_traits<t>::value_type>::lowest()}); \
|
||||
#define OPENVINO_TYPE_TO_LOWEST_CONST(t) \
|
||||
case t: \
|
||||
return op::v0::Constant::create( \
|
||||
t, \
|
||||
{}, \
|
||||
{std::numeric_limits<typename ov::element_type_traits<t>::value_type>::lowest()}); \
|
||||
break
|
||||
|
||||
switch (t) {
|
||||
OPENVINO_TYPE_TO_LOWEST_CONST(element::boolean);
|
||||
OPENVINO_TYPE_TO_LOWEST_CONST(element::bf16);
|
||||
OPENVINO_TYPE_TO_LOWEST_CONST(element::f16);
|
||||
OPENVINO_TYPE_TO_LOWEST_CONST(element::f32);
|
||||
OPENVINO_TYPE_TO_LOWEST_CONST(element::f64);
|
||||
OPENVINO_TYPE_TO_LOWEST_CONST(element::i8);
|
||||
OPENVINO_TYPE_TO_LOWEST_CONST(element::i16);
|
||||
OPENVINO_TYPE_TO_LOWEST_CONST(element::i32);
|
||||
OPENVINO_TYPE_TO_LOWEST_CONST(element::i64);
|
||||
OPENVINO_TYPE_TO_LOWEST_CONST(element::u1);
|
||||
OPENVINO_TYPE_TO_LOWEST_CONST(element::u8);
|
||||
OPENVINO_TYPE_TO_LOWEST_CONST(element::u16);
|
||||
OPENVINO_TYPE_TO_LOWEST_CONST(element::u32);
|
||||
OPENVINO_TYPE_TO_LOWEST_CONST(element::u64);
|
||||
OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::boolean);
|
||||
OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::bf16);
|
||||
OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::f16);
|
||||
OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::f32);
|
||||
OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::f64);
|
||||
OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::i8);
|
||||
OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::i16);
|
||||
OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::i32);
|
||||
OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::i64);
|
||||
OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::u1);
|
||||
OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::u8);
|
||||
OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::u16);
|
||||
OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::u32);
|
||||
OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::u64);
|
||||
|
||||
case element::undefined:
|
||||
case element::dynamic:
|
||||
case ov::element::undefined:
|
||||
case ov::element::dynamic:
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include "openvino/op/convert.hpp"
|
||||
|
||||
using namespace ngraph;
|
||||
using namespace ov;
|
||||
NGRAPH_SUPPRESS_DEPRECATED_START;
|
||||
|
||||
using ov::op::v0::Constant;
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ OutputVector custom_add(const Node& node) {
|
|||
const auto in2 = node.get_ng_inputs().at(1);
|
||||
const auto alpha = node.get_attribute_value<float>("alpha", 1);
|
||||
const auto alpha_node =
|
||||
std::make_shared<default_opset::Convert>(default_opset::Constant::create(element::f32, {}, {alpha}),
|
||||
std::make_shared<default_opset::Convert>(default_opset::Constant::create( ov::element::f32, {}, {alpha}),
|
||||
in1.get_element_type());
|
||||
|
||||
const auto add = std::make_shared<default_opset::Add>(in1, in2);
|
||||
|
|
@ -104,4 +104,4 @@ fe.add_extension(OpExtension("opset9.Add", "CustomAdd", "org.openvinotoolkit", {
|
|||
## See also
|
||||
* [OpenVINO ONNX Frontend README](../README.md)
|
||||
* [OpenVINO™ README](../../../../README.md)
|
||||
* [Developer documentation](../../../../docs/dev/index.md)
|
||||
* [Developer documentation](../../../../docs/dev/index.md)
|
||||
|
|
|
|||
|
|
@ -29,6 +29,9 @@ class NodeProto;
|
|||
} // namespace ONNX_NAMESPACE
|
||||
|
||||
namespace ngraph {
|
||||
namespace element {
|
||||
using ov::element::Type;
|
||||
}
|
||||
namespace onnx_import {
|
||||
namespace error {
|
||||
namespace node {
|
||||
|
|
@ -96,7 +99,8 @@ public:
|
|||
std::shared_ptr<ov::op::v0::Constant> get_attribute_as_constant(const std::string& name) const;
|
||||
|
||||
template <typename T>
|
||||
std::shared_ptr<ov::op::v0::Constant> get_attribute_as_constant(const std::string& name, element::Type type) const;
|
||||
std::shared_ptr<ov::op::v0::Constant> get_attribute_as_constant(const std::string& name,
|
||||
ov::element::Type type) const;
|
||||
|
||||
template <typename T>
|
||||
std::shared_ptr<ov::op::v0::Constant> get_attribute_as_constant(const std::string& name, T default_value) const;
|
||||
|
|
@ -104,7 +108,7 @@ public:
|
|||
template <typename T>
|
||||
std::shared_ptr<ov::op::v0::Constant> get_attribute_as_constant(const std::string& name,
|
||||
T default_value,
|
||||
element::Type type) const;
|
||||
ov::element::Type type) const;
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
|
|
@ -223,7 +227,7 @@ ONNX_IMPORTER_API std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_c
|
|||
template <>
|
||||
ONNX_IMPORTER_API std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_constant<std::vector<int64_t>>(
|
||||
const std::string& name,
|
||||
element::Type type) const;
|
||||
ov::element::Type type) const;
|
||||
|
||||
template <>
|
||||
ONNX_IMPORTER_API std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_constant(
|
||||
|
|
@ -231,8 +235,10 @@ ONNX_IMPORTER_API std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_c
|
|||
std::vector<int64_t> default_value) const;
|
||||
|
||||
template <>
|
||||
ONNX_IMPORTER_API std::shared_ptr<ov::op::v0::Constant>
|
||||
Node::get_attribute_as_constant(const std::string& name, std::vector<int64_t> default_value, element::Type type) const;
|
||||
ONNX_IMPORTER_API std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_constant(
|
||||
const std::string& name,
|
||||
std::vector<int64_t> default_value,
|
||||
ov::element::Type type) const;
|
||||
|
||||
template <>
|
||||
ONNX_IMPORTER_API std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_constant<float>(
|
||||
|
|
@ -245,12 +251,12 @@ ONNX_IMPORTER_API std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_c
|
|||
template <>
|
||||
ONNX_IMPORTER_API std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_constant(const std::string& name,
|
||||
float default_value,
|
||||
element::Type type) const;
|
||||
ov::element::Type type) const;
|
||||
|
||||
template <>
|
||||
ONNX_IMPORTER_API std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_constant<float>(
|
||||
const std::string& name,
|
||||
element::Type type) const;
|
||||
ov::element::Type type) const;
|
||||
|
||||
template <>
|
||||
ONNX_IMPORTER_API std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_constant<double>(
|
||||
|
|
@ -263,12 +269,12 @@ ONNX_IMPORTER_API std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_c
|
|||
template <>
|
||||
ONNX_IMPORTER_API std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_constant<double>(
|
||||
const std::string& name,
|
||||
element::Type type) const;
|
||||
ov::element::Type type) const;
|
||||
|
||||
template <>
|
||||
ONNX_IMPORTER_API std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_constant(const std::string& name,
|
||||
double default_value,
|
||||
element::Type type) const;
|
||||
ov::element::Type type) const;
|
||||
|
||||
template <>
|
||||
ONNX_IMPORTER_API std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_constant<int64_t>(
|
||||
|
|
@ -277,7 +283,7 @@ ONNX_IMPORTER_API std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_c
|
|||
template <>
|
||||
ONNX_IMPORTER_API std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_constant<int64_t>(
|
||||
const std::string& name,
|
||||
element::Type type) const;
|
||||
ov::element::Type type) const;
|
||||
|
||||
template <>
|
||||
ONNX_IMPORTER_API std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_constant(const std::string& name,
|
||||
|
|
@ -286,12 +292,12 @@ ONNX_IMPORTER_API std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_c
|
|||
template <>
|
||||
ONNX_IMPORTER_API std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_constant<int64_t>(
|
||||
const std::string& name,
|
||||
element::Type type) const;
|
||||
ov::element::Type type) const;
|
||||
|
||||
template <>
|
||||
ONNX_IMPORTER_API std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_constant(const std::string& name,
|
||||
int64_t default_value,
|
||||
element::Type type) const;
|
||||
ov::element::Type type) const;
|
||||
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
inline std::ostream& operator<<(std::ostream& outs, const Node& node) {
|
||||
|
|
|
|||
|
|
@ -76,7 +76,8 @@ public:
|
|||
std::shared_ptr<ov::op::v0::Constant> get_attribute_as_constant(const std::string& name) const;
|
||||
|
||||
template <typename T>
|
||||
std::shared_ptr<ov::op::v0::Constant> get_attribute_as_constant(const std::string& name, element::Type type) const;
|
||||
std::shared_ptr<ov::op::v0::Constant> get_attribute_as_constant(const std::string& name,
|
||||
ov::element::Type type) const;
|
||||
|
||||
template <typename T>
|
||||
std::shared_ptr<ov::op::v0::Constant> get_attribute_as_constant(const std::string& name, T default_value) const;
|
||||
|
|
@ -84,7 +85,7 @@ public:
|
|||
template <typename T>
|
||||
std::shared_ptr<ov::op::v0::Constant> get_attribute_as_constant(const std::string& name,
|
||||
T default_value,
|
||||
element::Type type) const;
|
||||
ov::element::Type type) const;
|
||||
|
||||
const ONNX_NAMESPACE::NodeProto& node_proto() const;
|
||||
Graph* graph() const;
|
||||
|
|
@ -229,7 +230,7 @@ const std::string& Node::Impl::description() const {
|
|||
template <typename T>
|
||||
std::shared_ptr<ov::op::v0::Constant> Node::Impl::get_attribute_as_constant(const std::string& name) const {
|
||||
const auto value = get_attribute_value<T>(name);
|
||||
const element::Type type = ov::element::from<T>();
|
||||
const ov::element::Type type = ov::element::from<T>();
|
||||
return std::make_shared<ov::op::v0::Constant>(type, Shape{}, value);
|
||||
}
|
||||
|
||||
|
|
@ -237,25 +238,25 @@ template <typename T>
|
|||
std::shared_ptr<ov::op::v0::Constant> Node::Impl::get_attribute_as_constant(const std::string& name,
|
||||
T default_value) const {
|
||||
const auto value = get_attribute_value<T>(name, default_value);
|
||||
const element::Type type = ov::element::from<T>();
|
||||
const ov::element::Type type = ov::element::from<T>();
|
||||
return std::make_shared<ov::op::v0::Constant>(type, Shape{}, value);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::shared_ptr<ov::op::v0::Constant> Node::Impl::get_attribute_as_constant(const std::string& name,
|
||||
T default_value,
|
||||
element::Type type) const {
|
||||
ov::element::Type type) const {
|
||||
const auto value = get_attribute_value<T>(name, default_value);
|
||||
return std::make_shared<ov::op::v0::Constant>(type == element::undefined ? ov::element::from<T>() : type,
|
||||
return std::make_shared<ov::op::v0::Constant>(type == ov::element::undefined ? ov::element::from<T>() : type,
|
||||
Shape{},
|
||||
value);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::shared_ptr<ov::op::v0::Constant> Node::Impl::get_attribute_as_constant(const std::string& name,
|
||||
element::Type type) const {
|
||||
ov::element::Type type) const {
|
||||
const auto value = get_attribute_value<T>(name);
|
||||
return std::make_shared<ov::op::v0::Constant>(type == element::undefined ? ov::element::from<T>() : type,
|
||||
return std::make_shared<ov::op::v0::Constant>(type == ov::element::undefined ? ov::element::from<T>() : type,
|
||||
Shape{},
|
||||
value);
|
||||
}
|
||||
|
|
@ -264,30 +265,34 @@ template <>
|
|||
std::shared_ptr<ov::op::v0::Constant> Node::Impl::get_attribute_as_constant<std::vector<int64_t>>(
|
||||
const std::string& name) const {
|
||||
const auto value = get_attribute_value<std::vector<int64_t>>(name);
|
||||
return ov::op::v0::Constant::create(element::i64, {value.size()}, value);
|
||||
return ov::op::v0::Constant::create(ov::element::i64, {value.size()}, value);
|
||||
}
|
||||
|
||||
template <>
|
||||
std::shared_ptr<ov::op::v0::Constant> Node::Impl::get_attribute_as_constant<std::vector<int64_t>>(
|
||||
const std::string& name,
|
||||
element::Type type) const {
|
||||
ov::element::Type type) const {
|
||||
const auto value = get_attribute_value<std::vector<int64_t>>(name);
|
||||
return ov::op::v0::Constant::create(type == element::undefined ? element::i64 : type, {value.size()}, value);
|
||||
return ov::op::v0::Constant::create(type == ov::element::undefined ? ov::element::i64 : type,
|
||||
{value.size()},
|
||||
value);
|
||||
}
|
||||
|
||||
template <>
|
||||
std::shared_ptr<ov::op::v0::Constant> Node::Impl::get_attribute_as_constant(const std::string& name,
|
||||
std::vector<int64_t> default_value) const {
|
||||
const auto value = get_attribute_value<std::vector<int64_t>>(name, default_value);
|
||||
return ov::op::v0::Constant::create(element::i64, {value.size()}, value);
|
||||
return ov::op::v0::Constant::create(ov::element::i64, {value.size()}, value);
|
||||
}
|
||||
|
||||
template <>
|
||||
std::shared_ptr<ov::op::v0::Constant> Node::Impl::get_attribute_as_constant(const std::string& name,
|
||||
std::vector<int64_t> default_value,
|
||||
element::Type type) const {
|
||||
ov::element::Type type) const {
|
||||
const auto value = get_attribute_value<std::vector<int64_t>>(name, default_value);
|
||||
return ov::op::v0::Constant::create(type != element::undefined ? type : element::i64, {value.size()}, value);
|
||||
return ov::op::v0::Constant::create(type != ov::element::undefined ? type : ov::element::i64,
|
||||
{value.size()},
|
||||
value);
|
||||
}
|
||||
|
||||
Node::Node(const ONNX_NAMESPACE::NodeProto& node_proto, Graph* graph)
|
||||
|
|
@ -547,13 +552,13 @@ std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_constant(const std:
|
|||
template <>
|
||||
std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_constant(const std::string& name,
|
||||
float default_value,
|
||||
element::Type type) const {
|
||||
ov::element::Type type) const {
|
||||
return m_pimpl->template get_attribute_as_constant<float>(name, default_value, std::move(type));
|
||||
}
|
||||
|
||||
template <>
|
||||
std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_constant<float>(const std::string& name,
|
||||
element::Type type) const {
|
||||
ov::element::Type type) const {
|
||||
return m_pimpl->template get_attribute_as_constant<float>(name, std::move(type));
|
||||
}
|
||||
|
||||
|
|
@ -571,13 +576,13 @@ std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_constant(const std:
|
|||
template <>
|
||||
std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_constant(const std::string& name,
|
||||
double default_value,
|
||||
element::Type type) const {
|
||||
ov::element::Type type) const {
|
||||
return m_pimpl->template get_attribute_as_constant<double>(name, default_value, std::move(type));
|
||||
}
|
||||
|
||||
template <>
|
||||
std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_constant<double>(const std::string& name,
|
||||
element::Type type) const {
|
||||
ov::element::Type type) const {
|
||||
return m_pimpl->template get_attribute_as_constant<double>(name, std::move(type));
|
||||
}
|
||||
|
||||
|
|
@ -595,13 +600,13 @@ std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_constant(const std:
|
|||
template <>
|
||||
std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_constant(const std::string& name,
|
||||
int64_t default_value,
|
||||
element::Type type) const {
|
||||
ov::element::Type type) const {
|
||||
return m_pimpl->template get_attribute_as_constant<int64_t>(name, default_value, std::move(type));
|
||||
}
|
||||
|
||||
template <>
|
||||
std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_constant<int64_t>(const std::string& name,
|
||||
element::Type type) const {
|
||||
ov::element::Type type) const {
|
||||
return m_pimpl->template get_attribute_as_constant<int64_t>(name, std::move(type));
|
||||
}
|
||||
|
||||
|
|
@ -612,8 +617,9 @@ std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_constant<std::vecto
|
|||
}
|
||||
|
||||
template <>
|
||||
std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_constant<std::vector<int64_t>>(const std::string& name,
|
||||
element::Type type) const {
|
||||
std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_constant<std::vector<int64_t>>(
|
||||
const std::string& name,
|
||||
ov::element::Type type) const {
|
||||
return m_pimpl->template get_attribute_as_constant<std::vector<int64_t>>(name, std::move(type));
|
||||
}
|
||||
|
||||
|
|
@ -626,7 +632,7 @@ std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_constant(const std:
|
|||
template <>
|
||||
std::shared_ptr<ov::op::v0::Constant> Node::get_attribute_as_constant(const std::string& name,
|
||||
std::vector<int64_t> default_value,
|
||||
element::Type type) const {
|
||||
ov::element::Type type) const {
|
||||
return m_pimpl->template get_attribute_as_constant<std::vector<int64_t>>(name,
|
||||
std::move(default_value),
|
||||
std::move(type));
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public:
|
|||
return m_indices;
|
||||
}
|
||||
|
||||
const element::Type& get_ov_type() const {
|
||||
const ov::element::Type& get_ov_type() const {
|
||||
return m_values.get_ov_type();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ std::vector<float> Tensor::get_data() const {
|
|||
template <>
|
||||
std::vector<ov::float16> Tensor::get_data() const {
|
||||
if (has_external_data()) {
|
||||
return get_external_data<float16>();
|
||||
return get_external_data<ov::float16>();
|
||||
}
|
||||
if (m_tensor_proto->has_raw_data()) {
|
||||
return detail::__get_raw_data<ov::float16>(m_tensor_proto->raw_data(), m_tensor_proto->data_type());
|
||||
|
|
@ -62,7 +62,7 @@ std::vector<ov::float16> Tensor::get_data() const {
|
|||
template <>
|
||||
std::vector<ov::bfloat16> Tensor::get_data() const {
|
||||
if (has_external_data()) {
|
||||
return get_external_data<bfloat16>();
|
||||
return get_external_data<ov::bfloat16>();
|
||||
}
|
||||
if (m_tensor_proto->has_raw_data()) {
|
||||
return detail::__get_raw_data<ov::bfloat16>(m_tensor_proto->raw_data(), m_tensor_proto->data_type());
|
||||
|
|
|
|||
|
|
@ -131,37 +131,37 @@ public:
|
|||
return static_cast<Type>(m_tensor_proto->data_type());
|
||||
}
|
||||
|
||||
const element::Type& get_ov_type() const {
|
||||
const ov::element::Type& get_ov_type() const {
|
||||
if (!m_tensor_proto->has_data_type()) {
|
||||
FRONT_END_THROW("Tensor has no specified data type");
|
||||
}
|
||||
switch (m_tensor_proto->data_type()) {
|
||||
case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_BOOL:
|
||||
return element::boolean;
|
||||
return ov::element::boolean;
|
||||
case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_FLOAT:
|
||||
return element::f32;
|
||||
return ov::element::f32;
|
||||
case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_FLOAT16:
|
||||
return element::f16;
|
||||
return ov::element::f16;
|
||||
case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_DOUBLE:
|
||||
return element::f64;
|
||||
return ov::element::f64;
|
||||
case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_INT8:
|
||||
return element::i8;
|
||||
return ov::element::i8;
|
||||
case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_INT16:
|
||||
return element::i16;
|
||||
return ov::element::i16;
|
||||
case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_INT32:
|
||||
return element::i32;
|
||||
return ov::element::i32;
|
||||
case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_INT64:
|
||||
return element::i64;
|
||||
return ov::element::i64;
|
||||
case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_UINT8:
|
||||
return element::u8;
|
||||
return ov::element::u8;
|
||||
case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_UINT16:
|
||||
return element::u16;
|
||||
return ov::element::u16;
|
||||
case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_UINT32:
|
||||
return element::u32;
|
||||
return ov::element::u32;
|
||||
case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_UINT64:
|
||||
return element::u64;
|
||||
return ov::element::u64;
|
||||
case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_BFLOAT16:
|
||||
return element::bf16;
|
||||
return ov::element::bf16;
|
||||
case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_UNDEFINED:
|
||||
FRONT_END_THROW("Data type is Undefined");
|
||||
default:
|
||||
|
|
@ -181,31 +181,31 @@ public:
|
|||
}
|
||||
switch (m_tensor_proto->data_type()) {
|
||||
case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_BOOL:
|
||||
return make_ov_constant<char>(element::boolean);
|
||||
return make_ov_constant<char>(ov::element::boolean);
|
||||
case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_FLOAT:
|
||||
return make_ov_constant<float>(element::f32);
|
||||
return make_ov_constant<float>(ov::element::f32);
|
||||
case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_FLOAT16:
|
||||
return make_ov_constant<ov::float16>(element::f16);
|
||||
return make_ov_constant<ov::float16>(ov::element::f16);
|
||||
case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_DOUBLE:
|
||||
return make_ov_constant<double>(element::f64);
|
||||
return make_ov_constant<double>(ov::element::f64);
|
||||
case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_INT8:
|
||||
return make_ov_constant<int8_t>(element::i8);
|
||||
return make_ov_constant<int8_t>(ov::element::i8);
|
||||
case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_INT16:
|
||||
return make_ov_constant<int16_t>(element::i16);
|
||||
return make_ov_constant<int16_t>(ov::element::i16);
|
||||
case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_INT32:
|
||||
return make_ov_constant<int32_t>(element::i32);
|
||||
return make_ov_constant<int32_t>(ov::element::i32);
|
||||
case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_INT64:
|
||||
return make_ov_constant<int64_t>(element::i64);
|
||||
return make_ov_constant<int64_t>(ov::element::i64);
|
||||
case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_UINT8:
|
||||
return make_ov_constant<uint8_t>(element::u8);
|
||||
return make_ov_constant<uint8_t>(ov::element::u8);
|
||||
case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_UINT16:
|
||||
return make_ov_constant<uint16_t>(element::u16);
|
||||
return make_ov_constant<uint16_t>(ov::element::u16);
|
||||
case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_UINT32:
|
||||
return make_ov_constant<uint32_t>(element::u32);
|
||||
return make_ov_constant<uint32_t>(ov::element::u32);
|
||||
case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_UINT64:
|
||||
return make_ov_constant<uint64_t>(element::u64);
|
||||
return make_ov_constant<uint64_t>(ov::element::u64);
|
||||
case ONNX_NAMESPACE::TensorProto_DataType::TensorProto_DataType_BFLOAT16:
|
||||
return make_ov_constant<ov::bfloat16>(element::bf16);
|
||||
return make_ov_constant<ov::bfloat16>(ov::element::bf16);
|
||||
default:
|
||||
ONNX_UNSUPPORTED_DATA_TYPE(
|
||||
m_tensor_proto->data_type(),
|
||||
|
|
@ -219,7 +219,7 @@ private:
|
|||
std::is_same<T, int32_t>::value || std::is_same<T, int64_t>::value ||
|
||||
std::is_same<T, uint64_t>::value,
|
||||
bool>::type = true>
|
||||
std::shared_ptr<ov::op::v0::Constant> make_ov_constant(const element::Type& type) const {
|
||||
std::shared_ptr<ov::op::v0::Constant> make_ov_constant(const ov::element::Type& type) const {
|
||||
std::shared_ptr<ov::op::v0::Constant> constant{nullptr};
|
||||
size_t data_size = get_data_size();
|
||||
if (has_external_data()) {
|
||||
|
|
@ -257,7 +257,7 @@ private:
|
|||
!std::is_same<T, int32_t>::value && !std::is_same<T, int64_t>::value &&
|
||||
!std::is_same<T, uint64_t>::value,
|
||||
bool>::type = true>
|
||||
std::shared_ptr<ov::op::v0::Constant> make_ov_constant(const element::Type& type) const {
|
||||
std::shared_ptr<ov::op::v0::Constant> make_ov_constant(const ov::element::Type& type) const {
|
||||
std::shared_ptr<ov::op::v0::Constant> constant{nullptr};
|
||||
auto data = get_data<T>();
|
||||
auto data_size = data.size();
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public:
|
|||
const ov::PartialShape& get_shape() const {
|
||||
return m_partial_shape;
|
||||
}
|
||||
const element::Type& get_element_type() const {
|
||||
const ov::element::Type& get_element_type() const {
|
||||
if (m_value_info_proto->type().tensor_type().has_elem_type()) {
|
||||
return common::get_ov_element_type(m_value_info_proto->type().tensor_type().elem_type());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ ValueInfoProto* find_graph_value_info(GraphProto& graph, const std::string& name
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void modify_input_type(ValueInfoProto& onnx_input, const element::Type_t elem_type) {
|
||||
void modify_input_type(ValueInfoProto& onnx_input, const ov::element::Type_t elem_type) {
|
||||
OPENVINO_ASSERT(onnx_input.has_type(),
|
||||
"The input is malformed - it doesn't contain the 'type' field. Cannot change the "
|
||||
"data type. Input name: ",
|
||||
|
|
@ -87,7 +87,7 @@ void modify_input_type(ValueInfoProto& onnx_input, const element::Type_t elem_ty
|
|||
"The input type for input '",
|
||||
onnx_input.name(),
|
||||
"' cannot be set to: ",
|
||||
element::Type(elem_type).get_type_name(),
|
||||
ov::element::Type(elem_type).get_type_name(),
|
||||
". This type is not allowed in ONNX.");
|
||||
tensor_type->set_elem_type(ov_to_onnx_data_type(elem_type));
|
||||
}
|
||||
|
|
@ -147,7 +147,7 @@ void modify_initializer(TensorProto& initializer,
|
|||
"Initializer '",
|
||||
name,
|
||||
"' type cannot be set to: ",
|
||||
element::Type(elem_type).get_type_name(),
|
||||
ov::element::Type(elem_type).get_type_name(),
|
||||
". This type is not allowed in ONNX.");
|
||||
|
||||
initializer.Clear();
|
||||
|
|
@ -364,7 +364,7 @@ void onnx_editor::ONNXModelEditor::serialize(const std::string& out_file_path) c
|
|||
out_file.close();
|
||||
}
|
||||
|
||||
void onnx_editor::ONNXModelEditor::set_input_types(const std::map<std::string, element::Type_t>& input_types) {
|
||||
void onnx_editor::ONNXModelEditor::set_input_types(const std::map<std::string, ov::element::Type_t>& input_types) {
|
||||
auto* onnx_graph = m_pimpl->m_model_proto->mutable_graph();
|
||||
|
||||
for (const auto& input_desc : input_types) {
|
||||
|
|
@ -377,7 +377,7 @@ void onnx_editor::ONNXModelEditor::set_input_types(const std::map<std::string, e
|
|||
}
|
||||
}
|
||||
|
||||
element::Type_t onnx_editor::ONNXModelEditor::get_input_type(const std::string& tensor_name) const {
|
||||
ov::element::Type_t onnx_editor::ONNXModelEditor::get_input_type(const std::string& tensor_name) const {
|
||||
auto* onnx_graph = m_pimpl->m_model_proto->mutable_graph();
|
||||
auto* onnx_input = find_graph_input(*onnx_graph, tensor_name);
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public:
|
|||
/// used to modified the ONNX model loaded from a file. This method
|
||||
/// throws an exception if the model doesn't contain any of
|
||||
/// the inputs specified in its parameter.
|
||||
void set_input_types(const std::map<std::string, element::Type_t>& input_types);
|
||||
void set_input_types(const std::map<std::string, ov::element::Type_t>& input_types);
|
||||
|
||||
/// \brief Modifies the in-memory representation of the model by setting
|
||||
/// custom input shapes for all inputs specified in the provided map.
|
||||
|
|
@ -300,7 +300,7 @@ public:
|
|||
///
|
||||
/// \param output_edge Name of tensor for which element type will be returned.
|
||||
///
|
||||
element::Type_t get_input_type(const std::string& tensor_name) const;
|
||||
ov::element::Type_t get_input_type(const std::string& tensor_name) const;
|
||||
|
||||
private:
|
||||
void update_mapper_if_needed() const;
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ ov::element::Type InputModel::get_element_type(const ov::frontend::Place::Ptr& p
|
|||
return m_editor->get_input_type(tensor_name);
|
||||
}
|
||||
// now we can return the concrete element type only for model inputs
|
||||
return element::undefined;
|
||||
return ov::element::undefined;
|
||||
}
|
||||
|
||||
std::shared_ptr<Model> InputModel::decode() {
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ OutputVector aten(const Node& node) {
|
|||
// Shape aligned node, filled with zeros
|
||||
const auto zero_of_data_type_const = std::make_shared<v0::Constant>(data_type, Shape{1}, 0);
|
||||
const auto weights_shape_node = std::make_shared<v3::ShapeOf>(emb_tbl_in, ind_type);
|
||||
const auto weights_last_dim_idx = std::make_shared<v0::Constant>(element::i32, Shape{1}, -1);
|
||||
const auto weights_last_dim_idx = std::make_shared<v0::Constant>(ov::element::i32, Shape{1}, -1);
|
||||
const auto weights_last_dim =
|
||||
std::make_shared<v8::Gather>(weights_shape_node, weights_last_dim_idx, zero_const);
|
||||
const auto zero_col_node = std::make_shared<v3::Broadcast>(zero_of_data_type_const, weights_last_dim);
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ OutputVector blackmanwindow(const Node& node) {
|
|||
const auto scaled_cos_2 = std::make_shared<v1::Multiply>(cos_2, a_2);
|
||||
const auto y_values = std::make_shared<v1::Add>(std::make_shared<v1::Add>(a_0, scaled_cos_1), scaled_cos_2);
|
||||
|
||||
if (output_datatype == element::f32) {
|
||||
if (output_datatype == ov::element::f32) {
|
||||
return {y_values};
|
||||
} else {
|
||||
return {std::make_shared<v0::Convert>(y_values, output_datatype)};
|
||||
|
|
@ -80,4 +80,4 @@ OutputVector blackmanwindow(const Node& node) {
|
|||
} // namespace op
|
||||
} // namespace onnx_import
|
||||
} // namespace ngraph
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ namespace set_1 {
|
|||
OutputVector cast(const Node& node) {
|
||||
auto data = node.get_ng_inputs().at(0);
|
||||
int64_t target_type = node.get_attribute_value<int64_t>("to");
|
||||
element::Type elem_type = common::get_ov_element_type(target_type);
|
||||
ov::element::Type elem_type = common::get_ov_element_type(target_type);
|
||||
|
||||
return {std::make_shared<v0::Convert>(data, elem_type)};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ std::shared_ptr<ov::op::v0::Constant> get_constant_max_of_type(ov::element::Type
|
|||
OutputVector clip(const Node& node) {
|
||||
const OutputVector inputs{node.get_ng_inputs()};
|
||||
const ov::Output<ov::Node> data = inputs.at(0);
|
||||
const element::Type data_type = data.get_element_type();
|
||||
const ov::element::Type data_type = data.get_element_type();
|
||||
ov::Output<ov::Node> min;
|
||||
ov::Output<ov::Node> max;
|
||||
|
||||
|
|
|
|||
|
|
@ -119,8 +119,8 @@ namespace detail {
|
|||
namespace {
|
||||
|
||||
std::shared_ptr<ov::Node> get_dimensions(const std::shared_ptr<v3::ShapeOf>& shape, const std::vector<int>& dims) {
|
||||
static const auto zero = v0::Constant::create(element::i32, Shape{}, {0});
|
||||
const auto dims_const = v0::Constant::create(element::i32, Shape{dims.size()}, dims);
|
||||
static const auto zero = v0::Constant::create(ov::element::i32, Shape{}, {0});
|
||||
const auto dims_const = v0::Constant::create(ov::element::i32, Shape{dims.size()}, dims);
|
||||
return std::make_shared<v8::Gather>(shape, dims_const, zero);
|
||||
}
|
||||
|
||||
|
|
@ -130,9 +130,9 @@ std::shared_ptr<ov::Node> get_dimensions(const std::shared_ptr<ov::Node>& node,
|
|||
|
||||
std::shared_ptr<ov::Node> get_hidden_size(const std::shared_ptr<v3::ShapeOf>& node_shape) {
|
||||
// node has shape (batch_size, sequence_length, 3 * hidden_size)
|
||||
const auto zero = v0::Constant::create(element::i32, Shape{}, {0});
|
||||
const auto zero = v0::Constant::create(ov::element::i32, Shape{}, {0});
|
||||
const auto hidden_size_x3 = get_dimensions(node_shape, {2});
|
||||
const auto three = v0::Constant::create(element::i64, Shape{}, {3});
|
||||
const auto three = v0::Constant::create(ov::element::i64, Shape{}, {3});
|
||||
const auto hidden_size = std::make_shared<v1::Divide>(hidden_size_x3, three);
|
||||
return hidden_size;
|
||||
}
|
||||
|
|
@ -147,7 +147,7 @@ NodeVector split_to_QKV(const std::shared_ptr<v1::Add>& node,
|
|||
// node has shape (batch_size, sequence_length, 3 * hidden_size)
|
||||
// fetch the first two dimensions
|
||||
const auto batch_size_seq_len = get_dimensions(node_shape, {0, 1});
|
||||
const auto num_heads_node = v0::Constant::create(element::i64, Shape{1}, {num_heads});
|
||||
const auto num_heads_node = v0::Constant::create(ov::element::i64, Shape{1}, {num_heads});
|
||||
if (qkv_hidden_sizes.size() == 0) {
|
||||
const auto hidden_size = get_hidden_size(node_shape);
|
||||
// head_size = hidden_size / num_heads
|
||||
|
|
@ -177,7 +177,7 @@ NodeVector split_to_QKV(const std::shared_ptr<v1::Add>& node,
|
|||
auto new_shape = std::make_shared<v0::Concat>(
|
||||
NodeVector{batch_size_seq_len,
|
||||
num_heads_node,
|
||||
v0::Constant::create(element::i64, Shape{1}, {qkv_hidden_sizes[i] / num_heads})},
|
||||
v0::Constant::create(ov::element::i64, Shape{1}, {qkv_hidden_sizes[i] / num_heads})},
|
||||
0);
|
||||
split[i] = std::make_shared<v1::Reshape>(split[i], new_shape, false);
|
||||
}
|
||||
|
|
@ -187,7 +187,7 @@ NodeVector split_to_QKV(const std::shared_ptr<v1::Add>& node,
|
|||
}
|
||||
|
||||
// transpose Q, K and V to (batch_size, num_heads, sequence_len, head_size)
|
||||
auto perm = v0::Constant::create(element::i64, Shape{4}, {0, 2, 1, 3});
|
||||
auto perm = v0::Constant::create(ov::element::i64, Shape{4}, {0, 2, 1, 3});
|
||||
auto Q = std::make_shared<v1::Transpose>(split[0], perm);
|
||||
auto K = std::make_shared<v1::Transpose>(split[1], perm);
|
||||
auto V = std::make_shared<v1::Transpose>(split[2], perm);
|
||||
|
|
@ -266,42 +266,44 @@ NodeVector split_to_QKV(const std::shared_ptr<v1::Add>& node,
|
|||
// know its dimensions upfront. So we compute both variants and use Select operator to select
|
||||
// the right one in the runtime (unless it gets constantfolded before).
|
||||
std::shared_ptr<ov::Node> attention_mask_from_indices(const ov::Output<ov::Node>& mask_index,
|
||||
const element::Type_t& type,
|
||||
const ov::element::Type_t& type,
|
||||
const std::shared_ptr<ov::Node>& batch_size,
|
||||
const std::shared_ptr<ov::Node>& all_seq_len) {
|
||||
const auto zero = v0::Constant::create(element::i64, Shape{}, {0});
|
||||
const auto one = v0::Constant::create(element::i64, Shape{}, {1});
|
||||
const auto zero = v0::Constant::create(ov::element::i64, Shape{}, {0});
|
||||
const auto one = v0::Constant::create(ov::element::i64, Shape{}, {1});
|
||||
const auto stop = std::make_shared<v0::Squeeze>(all_seq_len, zero);
|
||||
std::shared_ptr<ov::Node> base = std::make_shared<v4::Range>(zero, stop, one, mask_index.get_element_type());
|
||||
const auto target_shape = std::make_shared<v0::Concat>(NodeVector{batch_size, all_seq_len}, 0);
|
||||
// broadcast 'base' to (batch_size, all_seq_len)
|
||||
base = std::make_shared<v3::Broadcast>(base, target_shape);
|
||||
const auto indices_shape =
|
||||
std::make_shared<v0::Concat>(NodeVector{v0::Constant::create(element::i64, Shape{1}, {-1}), batch_size}, 0);
|
||||
std::make_shared<v0::Concat>(NodeVector{v0::Constant::create(ov::element::i64, Shape{1}, {-1}), batch_size}, 0);
|
||||
std::shared_ptr<ov::Node> indices = std::make_shared<v1::Reshape>(mask_index, indices_shape, false);
|
||||
// fetch first row from indices
|
||||
std::shared_ptr<ov::Node> tail_range_indices = std::make_shared<v8::Gather>(indices, zero, zero);
|
||||
tail_range_indices =
|
||||
std::make_shared<v1::Reshape>(tail_range_indices, v0::Constant::create(element::i32, Shape{2}, {-1, 1}), false);
|
||||
tail_range_indices = std::make_shared<v1::Reshape>(tail_range_indices,
|
||||
v0::Constant::create(ov::element::i32, Shape{2}, {-1, 1}),
|
||||
false);
|
||||
const auto greater_eq = std::make_shared<v1::GreaterEqual>(base, tail_range_indices);
|
||||
std::shared_ptr<ov::Node> tail_range_mask =
|
||||
std::make_shared<v1::Multiply>(std::make_shared<v0::Convert>(greater_eq, type),
|
||||
v0::Constant::create(type, Shape{}, {-10000}));
|
||||
tail_range_mask =
|
||||
std::make_shared<v0::Unsqueeze>(tail_range_mask, v0::Constant::create(element::i64, Shape{2}, {1, 2}));
|
||||
std::make_shared<v0::Unsqueeze>(tail_range_mask, v0::Constant::create(ov::element::i64, Shape{2}, {1, 2}));
|
||||
|
||||
const auto gather_index =
|
||||
std::make_shared<v1::FloorMod>(v0::Constant::create(element::i64, Shape{}, {1}), get_dimensions(indices, {0}));
|
||||
const auto gather_index = std::make_shared<v1::FloorMod>(v0::Constant::create(ov::element::i64, Shape{}, {1}),
|
||||
get_dimensions(indices, {0}));
|
||||
// fetch indices from the second row (or first if not available)
|
||||
std::shared_ptr<ov::Node> head_range_indices = std::make_shared<v8::Gather>(indices, gather_index, zero);
|
||||
head_range_indices =
|
||||
std::make_shared<v1::Reshape>(head_range_indices, v0::Constant::create(element::i32, Shape{2}, {-1, 1}), false);
|
||||
head_range_indices = std::make_shared<v1::Reshape>(head_range_indices,
|
||||
v0::Constant::create(ov::element::i32, Shape{2}, {-1, 1}),
|
||||
false);
|
||||
const auto less = std::make_shared<v1::Less>(base, head_range_indices);
|
||||
std::shared_ptr<ov::Node> mask = std::make_shared<v1::LogicalOr>(less, greater_eq);
|
||||
mask = std::make_shared<v1::Multiply>(std::make_shared<v0::Convert>(mask, type),
|
||||
v0::Constant::create(type, Shape{}, {-10000}));
|
||||
// reshape from (batch_size, all_seq_len) to (batch_size, 1, 1, all_seq_len)
|
||||
mask = std::make_shared<v0::Unsqueeze>(mask, v0::Constant::create(element::i64, Shape{2}, {1, 2}));
|
||||
mask = std::make_shared<v0::Unsqueeze>(mask, v0::Constant::create(ov::element::i64, Shape{2}, {1, 2}));
|
||||
|
||||
const auto mask_index_first_dim = get_dimensions(mask_index.get_node_shared_ptr(), {0});
|
||||
// compare mask_index.shape[0] with batch_size value
|
||||
|
|
@ -338,20 +340,20 @@ std::shared_ptr<ov::Node> attention_mask_from_indices(const ov::Output<ov::Node>
|
|||
//
|
||||
// The approach used to generate those masks is similar to one from attention_mask_from_indices function (see comments
|
||||
// there).
|
||||
NodeTuple unidirectional_mask(const element::Type_t& type,
|
||||
NodeTuple unidirectional_mask(const ov::element::Type_t& type,
|
||||
const std::shared_ptr<ov::Node>& seq_len,
|
||||
const std::shared_ptr<ov::Node>& all_seq_len,
|
||||
const std::shared_ptr<ov::Node>& past_seq_len) {
|
||||
const auto zero = v0::Constant::create(element::i64, Shape{}, {0});
|
||||
const auto one = v0::Constant::create(element::i64, Shape{}, {1});
|
||||
const auto zero = v0::Constant::create(ov::element::i64, Shape{}, {0});
|
||||
const auto one = v0::Constant::create(ov::element::i64, Shape{}, {1});
|
||||
const auto stop = std::make_shared<v0::Squeeze>(all_seq_len, zero);
|
||||
std::shared_ptr<ov::Node> bin_mask = std::make_shared<v4::Range>(zero, stop, one, element::i32);
|
||||
std::shared_ptr<ov::Node> bin_mask = std::make_shared<v4::Range>(zero, stop, one, ov::element::i32);
|
||||
auto target_shape = std::make_shared<v0::Concat>(NodeVector{seq_len, all_seq_len}, 0);
|
||||
bin_mask = std::make_shared<v3::Broadcast>(bin_mask, target_shape);
|
||||
auto start = std::make_shared<v0::Squeeze>(std::make_shared<v1::Add>(past_seq_len, one), zero);
|
||||
auto end = std::make_shared<v0::Squeeze>(std::make_shared<v1::Add>(all_seq_len, one), zero);
|
||||
auto indices = std::make_shared<v0::Unsqueeze>(std::make_shared<v4::Range>(start, end, one, element::i32),
|
||||
v0::Constant::create(element::i32, Shape{1}, {1}));
|
||||
auto indices = std::make_shared<v0::Unsqueeze>(std::make_shared<v4::Range>(start, end, one, ov::element::i32),
|
||||
v0::Constant::create(ov::element::i32, Shape{1}, {1}));
|
||||
bin_mask = std::make_shared<v1::GreaterEqual>(bin_mask, indices);
|
||||
std::shared_ptr<ov::Node> attention_mask =
|
||||
std::make_shared<v1::Multiply>(std::make_shared<v0::Convert>(bin_mask, type),
|
||||
|
|
@ -373,7 +375,7 @@ NodeTuple unidirectional_mask(const element::Type_t& type,
|
|||
// https://github.com/microsoft/onnxruntime/blob/851554536ca8185b3413ee57449ea5ac93370193/onnxruntime/contrib_ops/cpu/bert/attention_helper.h#L78
|
||||
std::shared_ptr<ov::Node> raw_mask(const ov::Output<ov::Node>& mask_index,
|
||||
ov::Dimension::value_type mask_rank,
|
||||
const element::Type_t& type) {
|
||||
const ov::element::Type_t& type) {
|
||||
std::shared_ptr<ov::Node> mask = std::make_shared<v0::Convert>(mask_index, type);
|
||||
mask = std::make_shared<v0::Convert>(mask, type);
|
||||
mask = std::make_shared<v1::Subtract>(v0::Constant::create(type, Shape{}, {1}), mask);
|
||||
|
|
@ -382,12 +384,14 @@ std::shared_ptr<ov::Node> raw_mask(const ov::Output<ov::Node>& mask_index,
|
|||
// Handle mask_index with (batch_size, past_sequence_length + sequence_length) shape
|
||||
// Reshape it to (batch_size, 1, 1, past_sequence_length + sequence_length)
|
||||
case 2:
|
||||
mask = std::make_shared<v1::Reshape>(mask, v0::Constant::create(element::i64, Shape{4}, {0, 1, 1, -1}), true);
|
||||
mask =
|
||||
std::make_shared<v1::Reshape>(mask, v0::Constant::create(ov::element::i64, Shape{4}, {0, 1, 1, -1}), true);
|
||||
break;
|
||||
// Handle mask_index with (batch_size, sequence_length, past_sequence_length + sequence_length) shape
|
||||
// Reshape it to (batch_size, 1, sequence_length, past_sequence_length + sequence_length)
|
||||
case 3:
|
||||
mask = std::make_shared<v1::Reshape>(mask, v0::Constant::create(element::i64, Shape{4}, {0, 1, 0, -1}), true);
|
||||
mask =
|
||||
std::make_shared<v1::Reshape>(mask, v0::Constant::create(ov::element::i64, Shape{4}, {0, 1, 0, -1}), true);
|
||||
break;
|
||||
}
|
||||
return mask;
|
||||
|
|
@ -398,8 +402,8 @@ bool is_past_input_available(const OutputVector& op_inputs) {
|
|||
}
|
||||
|
||||
NodeTuple get_attention_mask(const OutputVector& op_inputs, bool unidirectional) {
|
||||
const auto zero = v0::Constant::create(element::i64, Shape{1}, {0});
|
||||
const auto one = v0::Constant::create(element::i64, Shape{1}, {1});
|
||||
const auto zero = v0::Constant::create(ov::element::i64, Shape{1}, {0});
|
||||
const auto one = v0::Constant::create(ov::element::i64, Shape{1}, {1});
|
||||
|
||||
std::shared_ptr<ov::Node> past_seq_len;
|
||||
// get the value of past_sequence_length
|
||||
|
|
@ -423,7 +427,7 @@ NodeTuple get_attention_mask(const OutputVector& op_inputs, bool unidirectional)
|
|||
}
|
||||
if (op_inputs.size() > 3 && !ov::op::util::is_null(op_inputs[3])) {
|
||||
const auto& mask_index = op_inputs[3];
|
||||
FRONT_END_GENERAL_CHECK(mask_index.get_element_type() == element::i32, "'mask_index' type must be int32");
|
||||
FRONT_END_GENERAL_CHECK(mask_index.get_element_type() == ov::element::i32, "'mask_index' type must be int32");
|
||||
auto batch_size = get_dimensions(input_shape, {0});
|
||||
const auto mask_rank = mask_index.get_partial_shape().rank();
|
||||
FRONT_END_GENERAL_CHECK(mask_rank.is_static(), "'mask_index' rank must be static");
|
||||
|
|
@ -458,7 +462,7 @@ std::shared_ptr<ov::Node> attention_softmax(const OutputVector& op_inputs,
|
|||
const std::shared_ptr<ov::Node>& bin_mask,
|
||||
const std::shared_ptr<ov::Node>& head_size,
|
||||
bool unidirectional) {
|
||||
auto zero = v0::Constant::create(element::i64, Shape{}, {0});
|
||||
auto zero = v0::Constant::create(ov::element::i64, Shape{}, {0});
|
||||
if (is_past_input_available(op_inputs)) {
|
||||
// concat past K and V with present ones
|
||||
const auto& past = op_inputs[4];
|
||||
|
|
@ -502,9 +506,9 @@ std::shared_ptr<ov::Node> attention_softmax(const OutputVector& op_inputs,
|
|||
std::shared_ptr<ov::Node> output = std::make_shared<v0::MatMul>(softmax, V);
|
||||
// transpose the result from (batch_size, num_heads, sequence_length, head_size)
|
||||
// to (batch_size, sequence_length, num_heads, head_size)
|
||||
const auto perm = v0::Constant::create(element::i64, Shape{4}, {0, 2, 1, 3});
|
||||
const auto perm = v0::Constant::create(ov::element::i64, Shape{4}, {0, 2, 1, 3});
|
||||
output = std::make_shared<v1::Transpose>(output, perm);
|
||||
auto new_shape = v0::Constant::create(element::i32, Shape{3}, {0, 0, -1});
|
||||
auto new_shape = v0::Constant::create(ov::element::i32, Shape{3}, {0, 0, -1});
|
||||
// reshape the result from (batch_size, sequence_length, num_heads, head_size) to (batch_size, sequence_length,
|
||||
// num_heads * head_size)
|
||||
output = std::make_shared<v1::Reshape>(output, new_shape, true);
|
||||
|
|
@ -519,7 +523,7 @@ std::shared_ptr<ov::Node> attention_softmax(const OutputVector& op_inputs,
|
|||
std::shared_ptr<ov::Node> get_present_state(const std::shared_ptr<ov::Node>& K,
|
||||
const std::shared_ptr<ov::Node>& V,
|
||||
const OutputVector& op_inputs) {
|
||||
auto zero = v0::Constant::create(element::i64, Shape{1}, {0});
|
||||
auto zero = v0::Constant::create(ov::element::i64, Shape{1}, {0});
|
||||
// expand K shape (batch_size, num_heads, sequence_length, head_size) to
|
||||
// (1, batch_size, num_heads, sequence_length, head_size)
|
||||
auto K_unsqueezed = std::make_shared<v0::Unsqueeze>(K, zero);
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ OutputVector embed_layer_normalization(const Node& node) {
|
|||
|
||||
FRONT_END_GENERAL_CHECK(num_nodes >= 7 && num_nodes <= 9,
|
||||
"EmbedLayerNormalization takes 7 or 9 inputs. Provided " + std::to_string(num_nodes));
|
||||
FRONT_END_GENERAL_CHECK(nodes[0].get_element_type() == element::i32, "input_ids must have int32 type");
|
||||
FRONT_END_GENERAL_CHECK(nodes[0].get_element_type() == ov::element::i32, "input_ids must have int32 type");
|
||||
|
||||
const auto& input_ids = nodes[0];
|
||||
const auto& segment_ids = nodes[1];
|
||||
|
|
@ -38,7 +38,7 @@ OutputVector embed_layer_normalization(const Node& node) {
|
|||
const auto& gamma = nodes[5];
|
||||
const auto& beta = nodes[6];
|
||||
|
||||
const auto zero = v0::Constant::create(element::i32, Shape{1}, {0});
|
||||
const auto zero = v0::Constant::create(ov::element::i32, Shape{1}, {0});
|
||||
std::shared_ptr<ov::Node> input = std::make_shared<v8::Gather>(word_embeddings, input_ids, zero, 0);
|
||||
// add position embeddings
|
||||
if (num_nodes > 8 && !ov::op::util::is_null(nodes[8])) {
|
||||
|
|
@ -54,8 +54,8 @@ OutputVector embed_layer_normalization(const Node& node) {
|
|||
// therefore input and position_embeddings cannot be added together
|
||||
// so we need slice the position_embeddings to [sequence_length, hidden_size] first
|
||||
// then add it with input.
|
||||
const auto one = v0::Constant::create(element::i32, Shape{1}, {1});
|
||||
const auto input_ids_shape = std::make_shared<v3::ShapeOf>(input_ids, element::i32);
|
||||
const auto one = v0::Constant::create(ov::element::i32, Shape{1}, {1});
|
||||
const auto input_ids_shape = std::make_shared<v3::ShapeOf>(input_ids, ov::element::i32);
|
||||
const auto seqlen = std::make_shared<v8::Gather>(input_ids_shape, one, zero, 0);
|
||||
const auto gathered_position_embeddings =
|
||||
std::make_shared<v8::Slice>(position_embeddings, zero, seqlen, one, zero);
|
||||
|
|
@ -65,7 +65,7 @@ OutputVector embed_layer_normalization(const Node& node) {
|
|||
if (!ov::op::util::is_null(segment_ids)) {
|
||||
FRONT_END_GENERAL_CHECK(!ov::op::util::is_null(segment_embeddings),
|
||||
"segment_ids provided, but segment_embedding input is missing");
|
||||
FRONT_END_GENERAL_CHECK(nodes[1].get_element_type() == element::i32, "segment_ids must have int32 type");
|
||||
FRONT_END_GENERAL_CHECK(nodes[1].get_element_type() == ov::element::i32, "segment_ids must have int32 type");
|
||||
auto gathered_segment_embeddings = std::make_shared<v8::Gather>(segment_embeddings, segment_ids, zero, 0);
|
||||
input = std::make_shared<v1::Add>(input, gathered_segment_embeddings);
|
||||
}
|
||||
|
|
@ -75,7 +75,7 @@ OutputVector embed_layer_normalization(const Node& node) {
|
|||
// hidden_size dimension is 2 here, because the shape after Gather(word_embedding, input_ids)
|
||||
// is (batch_size, seq_len, hidden_size)
|
||||
int hidden_size_dim = 2;
|
||||
const auto reduction_axes = v0::Constant::create(element::i32, Shape{1}, {hidden_size_dim});
|
||||
const auto reduction_axes = v0::Constant::create(ov::element::i32, Shape{1}, {hidden_size_dim});
|
||||
std::shared_ptr<ov::Node> result =
|
||||
std::make_shared<v6::MVN>(input, reduction_axes, true, eps, ov::op::MVNEpsMode::INSIDE_SQRT);
|
||||
|
||||
|
|
@ -86,8 +86,8 @@ OutputVector embed_layer_normalization(const Node& node) {
|
|||
// compute mask_index output
|
||||
std::shared_ptr<ov::Node> mask_index;
|
||||
if (num_nodes > 7 && !ov::op::util::is_null(nodes[7])) {
|
||||
FRONT_END_GENERAL_CHECK(nodes[7].get_element_type() == element::i32, "mask must have int32 type");
|
||||
auto axis = v0::Constant::create(element::i32, Shape{}, {1});
|
||||
FRONT_END_GENERAL_CHECK(nodes[7].get_element_type() == ov::element::i32, "mask must have int32 type");
|
||||
auto axis = v0::Constant::create(ov::element::i32, Shape{}, {1});
|
||||
mask_index = std::make_shared<v1::ReduceSum>(nodes[7], axis, false);
|
||||
} else {
|
||||
auto batch_size = std::make_shared<v8::Gather>(std::make_shared<v3::ShapeOf>(nodes[0]),
|
||||
|
|
|
|||
|
|
@ -50,14 +50,14 @@ OutputVector fused_conv(const Node& node) {
|
|||
CHECK_VALID_NODE(node,
|
||||
activation_params.size() == 1,
|
||||
"activation_alpha attribute of LeakyRelu activation function was not provided");
|
||||
const auto activation_alpha_node = v0::Constant::create(element::f32, Shape{}, activation_params);
|
||||
const auto activation_alpha_node = v0::Constant::create(ov::element::f32, Shape{}, activation_params);
|
||||
return {std::make_shared<v0::PRelu>(conv_res, activation_alpha_node)};
|
||||
} else if (activation_type == "HardSigmoid") {
|
||||
CHECK_VALID_NODE(node,
|
||||
activation_params.size() == 2,
|
||||
"alpha and beta attributes of HardSigmoid activation function were not provided");
|
||||
const auto alpha = v0::Constant::create<float>(element::f32, Shape{}, {activation_params[0]});
|
||||
const auto beta = v0::Constant::create<float>(element::f32, Shape{}, {activation_params[1]});
|
||||
const auto alpha = v0::Constant::create<float>(ov::element::f32, Shape{}, {activation_params[0]});
|
||||
const auto beta = v0::Constant::create<float>(ov::element::f32, Shape{}, {activation_params[1]});
|
||||
return {std::make_shared<v0::HardSigmoid>(conv_res, alpha, beta)};
|
||||
}
|
||||
CHECK_VALID_NODE(node,
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ OutputVector skip_layer_normalization(const Node& node) {
|
|||
float eps = node.get_attribute_value<float>("epsilon");
|
||||
// reduce over hidden_size
|
||||
int hidden_size_dim = 2;
|
||||
const auto reduction_axes = v0::Constant::create(element::i32, Shape{1}, {hidden_size_dim});
|
||||
const auto reduction_axes = v0::Constant::create(ov::element::i32, Shape{1}, {hidden_size_dim});
|
||||
std::shared_ptr<ov::Node> result =
|
||||
std::make_shared<v6::MVN>(input, reduction_axes, true, eps, ov::op::MVNEpsMode::INSIDE_SQRT);
|
||||
// multiply by gamma
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ OutputVector compress(const Node& node) {
|
|||
data = std::make_shared<v0::Squeeze>(ov::op::util::flatten(data, static_cast<int>(axis)));
|
||||
data = std::make_shared<v0::Squeeze>(ov::op::util::flatten(data, static_cast<int>(axis)));
|
||||
}
|
||||
auto axis_node = v0::Constant::create(element::i64, Shape{}, {axis});
|
||||
auto zero_node = v0::Constant::create(element::i64, Shape{}, {0});
|
||||
auto axis_node = v0::Constant::create(ov::element::i64, Shape{}, {axis});
|
||||
auto zero_node = v0::Constant::create(ov::element::i64, Shape{}, {0});
|
||||
auto result =
|
||||
std::make_shared<v8::Gather>(data,
|
||||
std::make_shared<v0::Squeeze>(std::make_shared<v3::NonZero>(condition), zero_node),
|
||||
|
|
|
|||
|
|
@ -49,31 +49,31 @@ std::shared_ptr<v0::Constant> get_dense_tensor_as_constant(const std::vector<int
|
|||
const Tensor& values_tensor,
|
||||
const Shape& shape) {
|
||||
switch (values_tensor.get_ov_type()) {
|
||||
case element::boolean:
|
||||
case ov::element::boolean:
|
||||
return make_dense_tensor_as_constant<char>(absolute_indices, values_tensor, shape);
|
||||
case element::f32:
|
||||
case ov::element::f32:
|
||||
return make_dense_tensor_as_constant<float>(absolute_indices, values_tensor, shape);
|
||||
case element::f16:
|
||||
case ov::element::f16:
|
||||
return make_dense_tensor_as_constant<ov::float16>(absolute_indices, values_tensor, shape);
|
||||
case element::f64:
|
||||
case ov::element::f64:
|
||||
return make_dense_tensor_as_constant<double>(absolute_indices, values_tensor, shape);
|
||||
case element::i8:
|
||||
case ov::element::i8:
|
||||
return make_dense_tensor_as_constant<int8_t>(absolute_indices, values_tensor, shape);
|
||||
case element::i16:
|
||||
case ov::element::i16:
|
||||
return make_dense_tensor_as_constant<int16_t>(absolute_indices, values_tensor, shape);
|
||||
case element::i32:
|
||||
case ov::element::i32:
|
||||
return make_dense_tensor_as_constant<int32_t>(absolute_indices, values_tensor, shape);
|
||||
case element::i64:
|
||||
case ov::element::i64:
|
||||
return make_dense_tensor_as_constant<int64_t>(absolute_indices, values_tensor, shape);
|
||||
case element::u8:
|
||||
case ov::element::u8:
|
||||
return make_dense_tensor_as_constant<uint8_t>(absolute_indices, values_tensor, shape);
|
||||
case element::u16:
|
||||
case ov::element::u16:
|
||||
return make_dense_tensor_as_constant<uint16_t>(absolute_indices, values_tensor, shape);
|
||||
case element::u32:
|
||||
case ov::element::u32:
|
||||
return make_dense_tensor_as_constant<uint32_t>(absolute_indices, values_tensor, shape);
|
||||
case element::u64:
|
||||
case ov::element::u64:
|
||||
return make_dense_tensor_as_constant<uint64_t>(absolute_indices, values_tensor, shape);
|
||||
case element::bf16:
|
||||
case ov::element::bf16:
|
||||
return make_dense_tensor_as_constant<ov::bfloat16>(absolute_indices, values_tensor, shape);
|
||||
default:
|
||||
FRONT_END_THROW("Tensor has an unsupported data type");
|
||||
|
|
@ -125,15 +125,15 @@ OutputVector constant(const onnx_import::Node& node) {
|
|||
auto& attribute = node.get_attribute(attributes_names[0]);
|
||||
|
||||
if (attribute.is_float()) {
|
||||
return {v0::Constant::create(element::f32, ov::Shape{}, {attribute.get_float()})};
|
||||
return {v0::Constant::create(ov::element::f32, ov::Shape{}, {attribute.get_float()})};
|
||||
} else if (attribute.is_float_array()) {
|
||||
auto values = attribute.get_float_array();
|
||||
return {v0::Constant::create(element::f32, ov::Shape{values.size()}, values)};
|
||||
return {v0::Constant::create(ov::element::f32, ov::Shape{values.size()}, values)};
|
||||
} else if (attribute.is_integer()) {
|
||||
return {v0::Constant::create(element::i64, ov::Shape{}, {attribute.get_integer()})};
|
||||
return {v0::Constant::create(ov::element::i64, ov::Shape{}, {attribute.get_integer()})};
|
||||
} else if (attribute.is_integer_array()) {
|
||||
auto values = attribute.get_integer_array();
|
||||
return {v0::Constant::create(element::i64, ov::Shape{values.size()}, values)};
|
||||
return {v0::Constant::create(ov::element::i64, ov::Shape{values.size()}, values)};
|
||||
} else if (attribute.is_sparse_tensor()) {
|
||||
auto sparse_tensor = attribute.get_sparse_tensor();
|
||||
const Tensor& values_tensor = sparse_tensor.get_values();
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ OutputVector constant_of_shape(const onnx_import::Node& node) {
|
|||
constant_value = value_tensor.get_ov_constant();
|
||||
constant_value = reshape::interpret_as_scalar(constant_value);
|
||||
} else {
|
||||
constant_value = v0::Constant::create(element::f32, {}, {0});
|
||||
constant_value = v0::Constant::create(ov::element::f32, {}, {0});
|
||||
}
|
||||
const auto& inputs = node.get_ng_inputs();
|
||||
if (inputs.size() == 0 || common::is_failsafe_node(inputs[0].get_node_shared_ptr()) ||
|
||||
|
|
|
|||
|
|
@ -26,17 +26,17 @@ std::shared_ptr<ov::Node> get_filter_zero_point(const OutputVector& inputs) {
|
|||
|
||||
const auto filter_zero_point_rank = original_zero_point.get_partial_shape().rank();
|
||||
if (filter_zero_point_rank.is_static() && filter_zero_point_rank.get_length() == 0) {
|
||||
return std::make_shared<v0::Convert>(original_zero_point, element::i32);
|
||||
return std::make_shared<v0::Convert>(original_zero_point, ov::element::i32);
|
||||
} else {
|
||||
// in case of 1D zero point filter, it has to be unsqueezed to match the data input's rank
|
||||
const auto& converted_filter_zero_point = std::make_shared<v0::Convert>(original_zero_point, element::i32);
|
||||
const auto& input_shape = std::make_shared<v3::ShapeOf>(inputs.at(0), element::i32);
|
||||
const auto& input_rank = std::make_shared<v3::ShapeOf>(input_shape, element::i32);
|
||||
const auto& converted_filter_zero_point = std::make_shared<v0::Convert>(original_zero_point, ov::element::i32);
|
||||
const auto& input_shape = std::make_shared<v3::ShapeOf>(inputs.at(0), ov::element::i32);
|
||||
const auto& input_rank = std::make_shared<v3::ShapeOf>(input_shape, ov::element::i32);
|
||||
const auto& input_rank_scalar = reshape::interpret_as_scalar(input_rank);
|
||||
|
||||
const auto& one_node = v0::Constant::create(ov::element::i32, {}, {1});
|
||||
const auto& missing_dimensions =
|
||||
std::make_shared<v4::Range>(one_node, input_rank_scalar, one_node, element::i32);
|
||||
std::make_shared<v4::Range>(one_node, input_rank_scalar, one_node, ov::element::i32);
|
||||
|
||||
return std::make_shared<v0::Unsqueeze>(converted_filter_zero_point, missing_dimensions);
|
||||
}
|
||||
|
|
@ -52,10 +52,10 @@ OutputVector conv_integer(const Node& node) {
|
|||
const auto& filter = inputs.at(1);
|
||||
const auto& input_zero_point = (inputs.size() > 2) ? inputs.at(2) : v0::Constant::create(ov::element::i32, {}, {0});
|
||||
|
||||
const auto& converted_input = std::make_shared<v0::Convert>(input, element::i32);
|
||||
const auto& converted_filter = std::make_shared<v0::Convert>(filter, element::i32);
|
||||
const auto& converted_input = std::make_shared<v0::Convert>(input, ov::element::i32);
|
||||
const auto& converted_filter = std::make_shared<v0::Convert>(filter, ov::element::i32);
|
||||
|
||||
const auto& converted_input_zero_point = std::make_shared<v0::Convert>(input_zero_point, element::i32);
|
||||
const auto& converted_input_zero_point = std::make_shared<v0::Convert>(input_zero_point, ov::element::i32);
|
||||
const auto& filter_zero_point = get_filter_zero_point(inputs);
|
||||
|
||||
const auto& shifted_input = std::make_shared<v1::Subtract>(converted_input, converted_input_zero_point);
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ ov::Output<ov::Node> make_group_conv_backprop(const ov::Output<ov::Node>& data,
|
|||
return std::make_shared<v1::GroupConvolutionBackpropData>(
|
||||
data,
|
||||
filters,
|
||||
v0::Constant::create(element::i64, Shape{output_shape.size()}, output_shape),
|
||||
v0::Constant::create(ov::element::i64, Shape{output_shape.size()}, output_shape),
|
||||
strides,
|
||||
dilations,
|
||||
auto_pad_type,
|
||||
|
|
@ -80,7 +80,7 @@ ov::Output<ov::Node> make_conv_backprop(const ov::Output<ov::Node>& data,
|
|||
return std::make_shared<v1::ConvolutionBackpropData>(
|
||||
data,
|
||||
filters,
|
||||
v0::Constant::create(element::i64, Shape{output_shape.size()}, output_shape),
|
||||
v0::Constant::create(ov::element::i64, Shape{output_shape.size()}, output_shape),
|
||||
strides,
|
||||
pads_begin,
|
||||
pads_end,
|
||||
|
|
@ -99,14 +99,14 @@ ov::Output<ov::Node> get_prepared_bias(const ov::Output<ov::Node>& bias, const o
|
|||
Shape new_bias_shape(conv_pshape.rank().get_length(), 1);
|
||||
new_bias_shape[1] = conv_pshape[1].get_length();
|
||||
|
||||
bias_shape_node = v0::Constant::create(element::i64, Shape{new_bias_shape.size()}, new_bias_shape);
|
||||
bias_shape_node = v0::Constant::create(ov::element::i64, Shape{new_bias_shape.size()}, new_bias_shape);
|
||||
} else {
|
||||
const auto conv_shape = std::make_shared<v3::ShapeOf>(conv);
|
||||
const auto conv_rank = std::make_shared<v3::ShapeOf>(conv_shape);
|
||||
|
||||
// Prepare new bias shape base: [1, 1, 1, 1, ... ]
|
||||
const auto one_node = v0::Constant::create(element::i64, Shape{1}, {1});
|
||||
const auto two_node = v0::Constant::create(element::i64, Shape{1}, {2});
|
||||
const auto one_node = v0::Constant::create(ov::element::i64, Shape{1}, {1});
|
||||
const auto two_node = v0::Constant::create(ov::element::i64, Shape{1}, {2});
|
||||
const auto remaining_shape_length = std::make_shared<v1::Subtract>(conv_rank, two_node);
|
||||
const auto remaining_bias_shape_ones = std::make_shared<v3::Broadcast>(one_node, remaining_shape_length);
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ OutputVector cum_sum(const Node& node) {
|
|||
const auto& axis_shape = inputs.at(1).get_partial_shape();
|
||||
axis = axis_shape.is_dynamic() ? inputs.at(1) : ngraph::onnx_import::reshape::interpret_as_scalar(inputs.at(1));
|
||||
} else {
|
||||
axis = v0::Constant::create(element::i64, Shape{}, {0}); // default
|
||||
axis = v0::Constant::create(ov::element::i64, Shape{}, {0}); // default
|
||||
}
|
||||
return OutputVector{std::make_shared<v0::CumSum>(data, axis, exclusive, reverse)};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ std::shared_ptr<ov::Node> get_zero_point(const OutputVector& inputs) {
|
|||
if (inputs.size() == 3 && !ov::op::util::is_null(inputs[2])) {
|
||||
const auto& zero_point = inputs[2];
|
||||
|
||||
if (zero_point.get_element_type() != element::f32) {
|
||||
return std::make_shared<v0::Convert>(zero_point, element::f32);
|
||||
if (zero_point.get_element_type() != ov::element::f32) {
|
||||
return std::make_shared<v0::Convert>(zero_point, ov::element::f32);
|
||||
}
|
||||
|
||||
return zero_point.get_node_shared_ptr();
|
||||
|
|
@ -49,9 +49,9 @@ OutputVector dequantize_linear(const Node& node) {
|
|||
const auto& scale = inputs[1];
|
||||
const auto zero_point = detail::get_zero_point(inputs);
|
||||
|
||||
common::validate_scalar_input("Dequantization scale", scale.get_node_shared_ptr(), {element::f32});
|
||||
common::validate_scalar_input("Dequantization scale", scale.get_node_shared_ptr(), {ov::element::f32});
|
||||
|
||||
const auto converted_x = std::make_shared<v0::Convert>(x, element::f32);
|
||||
const auto converted_x = std::make_shared<v0::Convert>(x, ov::element::f32);
|
||||
|
||||
if (zero_point) {
|
||||
common::validate_scalar_input("Zero point", zero_point);
|
||||
|
|
@ -131,7 +131,7 @@ std::shared_ptr<ov::Node> reshape_input(const ov::Output<ov::Node>& input,
|
|||
target_dims.push_back(1);
|
||||
}
|
||||
|
||||
const auto target_shape = v0::Constant::create(element::i64, Shape{target_dims.size()}, target_dims);
|
||||
const auto target_shape = v0::Constant::create(ov::element::i64, Shape{target_dims.size()}, target_dims);
|
||||
|
||||
return std::make_shared<v1::Reshape>(input, target_shape, true);
|
||||
}
|
||||
|
|
@ -149,7 +149,7 @@ OutputVector dequantize_linear(const ov::Output<ov::Node>& x,
|
|||
|
||||
validate_scale(scale, x, axis);
|
||||
const auto scale_reshaped = reshape_input(scale, axis, x_shape);
|
||||
const auto converted_x = std::make_shared<v0::Convert>(x, element::f32);
|
||||
const auto converted_x = std::make_shared<v0::Convert>(x, ov::element::f32);
|
||||
|
||||
if (zero_point) {
|
||||
validate_zero_point(zero_point, x, axis);
|
||||
|
|
|
|||
|
|
@ -29,34 +29,34 @@ namespace ngraph {
|
|||
namespace onnx_import {
|
||||
namespace {
|
||||
std::shared_ptr<ov::Node> find_min_value(const ov::Output<ov::Node>& input) {
|
||||
const auto& zero_node = v0::Constant::create(element::i64, Shape{}, {0});
|
||||
const auto& one_node = v0::Constant::create(element::i64, Shape{}, {1});
|
||||
const auto& zero_node = v0::Constant::create(ov::element::i64, Shape{}, {0});
|
||||
const auto& one_node = v0::Constant::create(ov::element::i64, Shape{}, {1});
|
||||
|
||||
const auto& input_shape = std::make_shared<v3::ShapeOf>(input);
|
||||
const auto& input_rank = std::make_shared<v3::ShapeOf>(input_shape);
|
||||
const auto& input_rank_as_scalar = std::make_shared<v0::Squeeze>(input_rank);
|
||||
|
||||
const auto& reduce_axes = std::make_shared<v4::Range>(zero_node, input_rank_as_scalar, one_node, element::i64);
|
||||
const auto& reduce_axes = std::make_shared<v4::Range>(zero_node, input_rank_as_scalar, one_node, ov::element::i64);
|
||||
|
||||
const auto& input_min = std::make_shared<v1::ReduceMin>(input, reduce_axes);
|
||||
|
||||
const auto& zero_node_u8 = v0::Constant::create(element::f32, Shape{}, {0});
|
||||
const auto& zero_node_u8 = v0::Constant::create(ov::element::f32, Shape{}, {0});
|
||||
return std::make_shared<v1::Minimum>(zero_node_u8, input_min);
|
||||
}
|
||||
|
||||
std::shared_ptr<ov::Node> find_max_value(const ov::Output<ov::Node>& input) {
|
||||
const auto& zero_node = v0::Constant::create(element::i64, Shape{}, {0});
|
||||
const auto& one_node = v0::Constant::create(element::i64, Shape{}, {1});
|
||||
const auto& zero_node = v0::Constant::create(ov::element::i64, Shape{}, {0});
|
||||
const auto& one_node = v0::Constant::create(ov::element::i64, Shape{}, {1});
|
||||
|
||||
const auto& input_shape = std::make_shared<v3::ShapeOf>(input);
|
||||
const auto& input_rank = std::make_shared<v3::ShapeOf>(input_shape);
|
||||
const auto& input_rank_as_scalar = std::make_shared<v0::Squeeze>(input_rank);
|
||||
|
||||
const auto& reduce_axes = std::make_shared<v4::Range>(zero_node, input_rank_as_scalar, one_node, element::i64);
|
||||
const auto& reduce_axes = std::make_shared<v4::Range>(zero_node, input_rank_as_scalar, one_node, ov::element::i64);
|
||||
|
||||
const auto& input_max = std::make_shared<v1::ReduceMax>(input, reduce_axes);
|
||||
|
||||
const auto& zero_node_u8 = v0::Constant::create(element::f32, Shape{}, {0});
|
||||
const auto& zero_node_u8 = v0::Constant::create(ov::element::f32, Shape{}, {0});
|
||||
return std::make_shared<v1::Maximum>(zero_node_u8, input_max);
|
||||
}
|
||||
|
||||
|
|
@ -83,8 +83,8 @@ OutputVector dynamic_quantize_linear(const Node& node) {
|
|||
const auto& x = inputs.at(0);
|
||||
|
||||
// quantization range in case of uint8 is [0, 255]
|
||||
const auto& quant_range_min = v0::Constant::create(element::f32, Shape{}, {0});
|
||||
const auto& quant_range_max = v0::Constant::create(element::f32, Shape{}, {255});
|
||||
const auto& quant_range_min = v0::Constant::create(ov::element::f32, Shape{}, {0});
|
||||
const auto& quant_range_max = v0::Constant::create(ov::element::f32, Shape{}, {255});
|
||||
const auto& quant_range_span = std::make_shared<v1::Subtract>(quant_range_max, quant_range_min);
|
||||
|
||||
const auto& x_max = find_max_value(x);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ OutputVector expand(const Node& node) {
|
|||
// in case the "shape" input is connected to a failsafe node created in place of an invalid initializer
|
||||
// the target shape should be ignored and this Expand operation should not modify its input tensor
|
||||
// the Broadcast created below should be eliminated later on by an appropriate optimization pass
|
||||
const auto identity_broadcast = v0::Constant::create(element::i64, Shape{1}, {1});
|
||||
const auto identity_broadcast = v0::Constant::create(ov::element::i64, Shape{1}, {1});
|
||||
return {std::make_shared<v3::Broadcast>(data, identity_broadcast, ov::op::BroadcastType::BIDIRECTIONAL)};
|
||||
} else {
|
||||
return {std::make_shared<v3::Broadcast>(data, shape, ov::op::BroadcastType::BIDIRECTIONAL)};
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ OutputVector eye_like(const Node& node) {
|
|||
input_rank.get_length(),
|
||||
" is unsupported, only 2D shapes are supported");
|
||||
|
||||
element::Type target_type;
|
||||
ov::element::Type target_type;
|
||||
if (node.has_attribute("dtype")) {
|
||||
std::int64_t dtype = node.get_attribute_value<std::int64_t>("dtype");
|
||||
target_type = common::get_ov_element_type(dtype);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ inline OutputVector gather(const Node& node) {
|
|||
|
||||
return {std::make_shared<ov::op::v8::Gather>(data,
|
||||
indices,
|
||||
ov::op::v0::Constant::create(element::i64, Shape{}, {axis}))};
|
||||
ov::op::v0::Constant::create(ov::element::i64, Shape{}, {axis}))};
|
||||
}
|
||||
|
||||
} // namespace set_1
|
||||
|
|
|
|||
|
|
@ -29,15 +29,15 @@ OutputVector global_average_pool(const Node& node) {
|
|||
// Expected spatial dims indexes: [2, 3, 4]
|
||||
auto data = node.get_ng_inputs()[0];
|
||||
|
||||
const auto zero_node = v0::Constant::create(element::i64, Shape{}, {0});
|
||||
const auto one_node = v0::Constant::create(element::i64, Shape{}, {1});
|
||||
const auto two_node = v0::Constant::create(element::i64, Shape{}, {2});
|
||||
const auto zero_node = v0::Constant::create(ov::element::i64, Shape{}, {0});
|
||||
const auto one_node = v0::Constant::create(ov::element::i64, Shape{}, {1});
|
||||
const auto two_node = v0::Constant::create(ov::element::i64, Shape{}, {2});
|
||||
|
||||
const auto data_shape = std::make_shared<v3::ShapeOf>(data);
|
||||
const auto data_rank = std::make_shared<v3::ShapeOf>(data_shape);
|
||||
const auto data_rank_as_scalar = std::make_shared<v0::Squeeze>(data_rank);
|
||||
|
||||
const auto reduce_axes = std::make_shared<v4::Range>(two_node, data_rank_as_scalar, one_node, element::i64);
|
||||
const auto reduce_axes = std::make_shared<v4::Range>(two_node, data_rank_as_scalar, one_node, ov::element::i64);
|
||||
|
||||
return {std::make_shared<v1::ReduceMean>(data, reduce_axes, true)};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,15 +29,15 @@ OutputVector global_max_pool(const Node& node) {
|
|||
// Expected spatial dims indexes: [2, 3, 4]
|
||||
auto data = node.get_ng_inputs()[0];
|
||||
|
||||
const auto zero_node = v0::Constant::create(element::i64, Shape{}, {0});
|
||||
const auto one_node = v0::Constant::create(element::i64, Shape{}, {1});
|
||||
const auto two_node = v0::Constant::create(element::i64, Shape{}, {2});
|
||||
const auto zero_node = v0::Constant::create(ov::element::i64, Shape{}, {0});
|
||||
const auto one_node = v0::Constant::create(ov::element::i64, Shape{}, {1});
|
||||
const auto two_node = v0::Constant::create(ov::element::i64, Shape{}, {2});
|
||||
|
||||
const auto data_shape = std::make_shared<v3::ShapeOf>(data);
|
||||
const auto data_rank = std::make_shared<v3::ShapeOf>(data_shape);
|
||||
const auto data_rank_as_scalar = std::make_shared<v0::Squeeze>(data_rank);
|
||||
|
||||
const auto reduce_axes = std::make_shared<v4::Range>(two_node, data_rank_as_scalar, one_node, element::i64);
|
||||
const auto reduce_axes = std::make_shared<v4::Range>(two_node, data_rank_as_scalar, one_node, ov::element::i64);
|
||||
|
||||
return {std::make_shared<v1::ReduceMax>(data, reduce_axes, true)};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,10 +31,10 @@ OutputVector group_normalization(const Node& node) {
|
|||
const auto eps = node.get_attribute_value<float>("epsilon", 1e-05f);
|
||||
const auto num_groups = node.get_attribute_value<int64_t>("num_groups");
|
||||
|
||||
const auto zero = v0::Constant::create(element::i64, Shape{1}, {0});
|
||||
const auto one = v0::Constant::create(element::i64, Shape{1}, {1});
|
||||
const auto zero = v0::Constant::create(ov::element::i64, Shape{1}, {0});
|
||||
const auto one = v0::Constant::create(ov::element::i64, Shape{1}, {1});
|
||||
const auto c_dim = std::make_shared<v8::Gather>(std::make_shared<v3::ShapeOf>(data), one, zero);
|
||||
const auto g_dim = v0::Constant::create(element::i64, Shape{1}, {num_groups});
|
||||
const auto g_dim = v0::Constant::create(ov::element::i64, Shape{1}, {num_groups});
|
||||
|
||||
const auto c_g_div = std::make_shared<v1::Divide>(c_dim, g_dim);
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ OutputVector hammingwindow(const Node& node) {
|
|||
const auto cos = std::make_shared<v0::Cos>(factor);
|
||||
const auto scaled_cos = std::make_shared<v1::Multiply>(cos, a_1);
|
||||
const auto y_values = std::make_shared<v1::Subtract>(a_0, scaled_cos);
|
||||
if (output_datatype == element::f32) {
|
||||
if (output_datatype == ov::element::f32) {
|
||||
return {y_values};
|
||||
} else {
|
||||
return {std::make_shared<v0::Convert>(y_values, output_datatype)};
|
||||
|
|
@ -71,4 +71,4 @@ OutputVector hammingwindow(const Node& node) {
|
|||
} // namespace op
|
||||
} // namespace onnx_import
|
||||
} // namespace ngraph
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ OutputVector hannwindow(const Node& node) {
|
|||
const auto cos = std::make_shared<v0::Cos>(factor);
|
||||
const auto scaled_cos = std::make_shared<v1::Multiply>(cos, a_1);
|
||||
const auto y_values = std::make_shared<v1::Subtract>(a_0, scaled_cos);
|
||||
if (output_datatype == element::f32) {
|
||||
if (output_datatype == ov::element::f32) {
|
||||
return {y_values};
|
||||
} else {
|
||||
return {std::make_shared<v0::Convert>(y_values, output_datatype)};
|
||||
|
|
@ -67,4 +67,4 @@ OutputVector hannwindow(const Node& node) {
|
|||
} // namespace op
|
||||
} // namespace onnx_import
|
||||
} // namespace ngraph
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
|
|
|
|||
|
|
@ -37,9 +37,10 @@ OutputVector hardmax(const Node& node) {
|
|||
const auto coerced_tensor = ov::op::util::flatten(input, static_cast<int>(axis));
|
||||
|
||||
const auto coerced_tensor_shape = std::make_shared<ov::op::v0::ShapeOf>(coerced_tensor);
|
||||
ov::Output<ov::Node> row_size = std::make_shared<v8::Gather>(coerced_tensor_shape,
|
||||
ov::op::v0::Constant::create(element::i64, {1}, {1}),
|
||||
ov::op::v0::Constant::create(element::i64, {}, {0}));
|
||||
ov::Output<ov::Node> row_size =
|
||||
std::make_shared<v8::Gather>(coerced_tensor_shape,
|
||||
ov::op::v0::Constant::create(ov::element::i64, {1}, {1}),
|
||||
ov::op::v0::Constant::create(ov::element::i64, {}, {0}));
|
||||
row_size = ngraph::onnx_import::reshape::interpret_as_scalar(row_size);
|
||||
|
||||
const auto indices_axis = 1;
|
||||
|
|
@ -71,8 +72,8 @@ OutputVector hardmax(const Node& node) {
|
|||
const auto input_runtime_shape = std::make_shared<ov::op::v0::ShapeOf>(input);
|
||||
ov::Output<ov::Node> row_size =
|
||||
std::make_shared<v8::Gather>(input_runtime_shape,
|
||||
ov::op::v0::Constant::create(element::i64, {1}, {axis}),
|
||||
ov::op::v0::Constant::create(element::i64, {}, {0}));
|
||||
ov::op::v0::Constant::create(ov::element::i64, {1}, {axis}),
|
||||
ov::op::v0::Constant::create(ov::element::i64, {}, {0}));
|
||||
row_size = ngraph::onnx_import::reshape::interpret_as_scalar(row_size);
|
||||
|
||||
const auto topk = std::make_shared<v11::TopK>(input,
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ OutputVector instance_norm(const Node& node) {
|
|||
const ov::PartialShape& bias_pshape = bias.get_partial_shape();
|
||||
const float epsilon{node.get_attribute_value<float>("epsilon", 1e-5f)};
|
||||
|
||||
element::Type result_et;
|
||||
ov::element::Type result_et;
|
||||
CHECK_VALID_NODE(node,
|
||||
element::Type::merge(result_et, data.get_element_type(), scale.get_element_type()),
|
||||
ov::element::Type::merge(result_et, data.get_element_type(), scale.get_element_type()),
|
||||
"Element types for data and scale input do not match (data element type: ",
|
||||
data.get_element_type(),
|
||||
", scale element type: ",
|
||||
|
|
@ -38,7 +38,7 @@ OutputVector instance_norm(const Node& node) {
|
|||
").");
|
||||
|
||||
CHECK_VALID_NODE(node,
|
||||
element::Type::merge(result_et, data.get_element_type(), bias.get_element_type()),
|
||||
ov::element::Type::merge(result_et, data.get_element_type(), bias.get_element_type()),
|
||||
"Element types for data and bias input do not match (data element type: ",
|
||||
data.get_element_type(),
|
||||
", bias element type: ",
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ OutputVector lp_norm(const Node& node) {
|
|||
p_norm,
|
||||
"Only normalization of 1st or 2nd order is supported.");
|
||||
|
||||
const auto normalize_axis_const = v0::Constant::create(element::i64, {}, {normalize_axis});
|
||||
const auto normalize_axis_const = v0::Constant::create(ov::element::i64, {}, {normalize_axis});
|
||||
std::shared_ptr<ov::Node> norm =
|
||||
ov::op::util::lp_norm(data, normalize_axis_const, static_cast<std::size_t>(p_norm), 0.0f, true);
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ OutputVector global_lp_pool(const Node& node) {
|
|||
Shape output_shape(data_shape.rank().get_length(), 1);
|
||||
output_shape.at(0) = data_shape[0].get_length();
|
||||
|
||||
const auto reshape_pattern = v0::Constant::create(element::i64, Shape{output_shape.size()}, output_shape);
|
||||
const auto reshape_pattern = v0::Constant::create(ov::element::i64, Shape{output_shape.size()}, output_shape);
|
||||
|
||||
slice = std::make_shared<v1::Reshape>(slice, reshape_pattern, false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,17 +69,25 @@ struct LSTMNgInputMap {
|
|||
|
||||
// Get dimensions needed for default inputs creation
|
||||
auto shape_of_x = std::make_shared<v3::ShapeOf>(m_input_map[LSTMInput::LSTM_INPUT_X]);
|
||||
auto axes = v0::Constant::create(element::Type_t::i32, Shape{1}, {0});
|
||||
auto axes = v0::Constant::create(ov::element::Type_t::i32, Shape{1}, {0});
|
||||
auto batch_size_node =
|
||||
std::make_shared<v8::Gather>(shape_of_x, v0::Constant::create(element::Type_t::i32, Shape{1}, {0}), axes);
|
||||
std::make_shared<v8::Gather>(shape_of_x,
|
||||
v0::Constant::create(ov::element::Type_t::i32, Shape{1}, {0}),
|
||||
axes);
|
||||
auto seq_length_node =
|
||||
std::make_shared<v8::Gather>(shape_of_x, v0::Constant::create(element::Type_t::i32, Shape{1}, {1}), axes);
|
||||
std::make_shared<v8::Gather>(shape_of_x,
|
||||
v0::Constant::create(ov::element::Type_t::i32, Shape{1}, {1}),
|
||||
axes);
|
||||
|
||||
auto shape_of_r = std::make_shared<v3::ShapeOf>(m_input_map[LSTMInput::LSTM_INPUT_R]);
|
||||
auto num_directions_node =
|
||||
std::make_shared<v8::Gather>(shape_of_r, v0::Constant::create(element::Type_t::i32, Shape{1}, {0}), axes);
|
||||
std::make_shared<v8::Gather>(shape_of_r,
|
||||
v0::Constant::create(ov::element::Type_t::i32, Shape{1}, {0}),
|
||||
axes);
|
||||
auto hidden_size_node =
|
||||
std::make_shared<v8::Gather>(shape_of_r, v0::Constant::create(element::Type_t::i32, Shape{1}, {2}), axes);
|
||||
std::make_shared<v8::Gather>(shape_of_r,
|
||||
v0::Constant::create(ov::element::Type_t::i32, Shape{1}, {2}),
|
||||
axes);
|
||||
|
||||
// ------ Optional inputs ------
|
||||
// `B` - The bias tensor for input gate.
|
||||
|
|
@ -96,10 +104,10 @@ struct LSTMNgInputMap {
|
|||
1);
|
||||
} else {
|
||||
auto b_shape = std::make_shared<v0::Concat>(
|
||||
OutputVector{
|
||||
num_directions_node,
|
||||
std::make_shared<v1::Multiply>(v0::Constant::create(element::Type_t::i64, Shape{1}, {gates_count}),
|
||||
hidden_size_node)},
|
||||
OutputVector{num_directions_node,
|
||||
std::make_shared<v1::Multiply>(
|
||||
v0::Constant::create(ov::element::Type_t::i64, Shape{1}, {gates_count}),
|
||||
hidden_size_node)},
|
||||
0);
|
||||
m_input_map[LSTMInput::LSTM_INPUT_B] = std::make_shared<v3::Broadcast>(
|
||||
v0::Constant::create(m_input_map[LSTMInput::LSTM_INPUT_X].get_element_type(), Shape{}, {0}),
|
||||
|
|
@ -150,7 +158,7 @@ struct LSTMNgInputMap {
|
|||
auto p_shape = std::make_shared<v0::Concat>(
|
||||
OutputVector{num_directions_node,
|
||||
std::make_shared<v1::Multiply>(
|
||||
v0::Constant::create(element::Type_t::i64, Shape{1}, {P_gates_count}),
|
||||
v0::Constant::create(ov::element::Type_t::i64, Shape{1}, {P_gates_count}),
|
||||
hidden_size_node)},
|
||||
0);
|
||||
m_input_map[LSTMInput::LSTM_INPUT_P] = std::make_shared<v3::Broadcast>(
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@ OutputVector matmul_integer(const Node& node) {
|
|||
const auto& A_zero_point = (inputs.size() > 2) ? inputs.at(2) : v0::Constant::create(ov::element::i32, {1}, {0});
|
||||
const auto& B_zero_point = (inputs.size() > 3) ? inputs.at(3) : v0::Constant::create(ov::element::i32, {1}, {0});
|
||||
|
||||
const auto& converted_A = std::make_shared<v0::Convert>(A, element::i32);
|
||||
const auto& converted_B = std::make_shared<v0::Convert>(B, element::i32);
|
||||
const auto& converted_A = std::make_shared<v0::Convert>(A, ov::element::i32);
|
||||
const auto& converted_B = std::make_shared<v0::Convert>(B, ov::element::i32);
|
||||
|
||||
const auto& converted_A_zero_point = std::make_shared<v0::Convert>(A_zero_point, element::i32);
|
||||
const auto& converted_B_zero_point = std::make_shared<v0::Convert>(B_zero_point, element::i32);
|
||||
const auto& converted_A_zero_point = std::make_shared<v0::Convert>(A_zero_point, ov::element::i32);
|
||||
const auto& converted_B_zero_point = std::make_shared<v0::Convert>(B_zero_point, ov::element::i32);
|
||||
|
||||
const auto& A_zero_point_rank = A_zero_point.get_partial_shape().rank();
|
||||
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@ OutputVector max_roi_pool(const Node& node) {
|
|||
const auto X = inputs.at(0);
|
||||
const auto rois = inputs.at(1);
|
||||
|
||||
FRONT_END_GENERAL_CHECK(X.get_element_type() == element::f16 || X.get_element_type() == element::f32 ||
|
||||
X.get_element_type() == element::f64,
|
||||
"MaxRoiPool operator only supports float16, float32 and float64 datatypes.");
|
||||
OPENVINO_ASSERT(X.get_element_type() == ov::element::f16 || X.get_element_type() == ov::element::f32 ||
|
||||
X.get_element_type() == ov::element::f64,
|
||||
"MaxRoiPool operator only supports float16, float32 and float64 datatypes.");
|
||||
|
||||
const auto pooled_shape = node.get_attribute_value<std::vector<size_t>>("pooled_shape");
|
||||
const auto spatial_scale = node.get_attribute_value<float>("spatial_scale", 1.0);
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ OutputVector mean_variance_normalization(const Node& node) {
|
|||
auto axes = node.get_attribute_value<std::vector<std::int64_t>>("axes", {0, 2, 3});
|
||||
const std::vector<std::size_t> normalized_axes =
|
||||
ov::util::normalize_axes(node.get_description(), axes, data.get_partial_shape().rank());
|
||||
auto const_axes = v0::Constant::create(element::i64, Shape{normalized_axes.size()}, normalized_axes);
|
||||
auto const_axes = v0::Constant::create(ov::element::i64, Shape{normalized_axes.size()}, normalized_axes);
|
||||
return {std::make_shared<v6::MVN>(data, const_axes, true, 1e-09f, ov::op::MVNEpsMode::OUTSIDE_SQRT)};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ inline OutputVector nms_rotated(const Node& node) {
|
|||
auto iou_threshold = node.get_attribute_value<float>("iou_threshold");
|
||||
auto score_threshold = node.get_attribute_value<float>("score_threshold");
|
||||
auto max_output_boxes_per_class =
|
||||
ov::op::v0::Constant::create(element::i64, Shape{1}, {std::numeric_limits<int64_t>::max()});
|
||||
auto iou_threshold_const = ov::op::v0::Constant::create(element::f32, Shape{}, {iou_threshold});
|
||||
auto score_threshold_const = ov::op::v0::Constant::create(element::f32, Shape{}, {score_threshold});
|
||||
ov::op::v0::Constant::create(ov::element::i64, Shape{1}, {std::numeric_limits<int64_t>::max()});
|
||||
auto iou_threshold_const = ov::op::v0::Constant::create(ov::element::f32, Shape{}, {iou_threshold});
|
||||
auto score_threshold_const = ov::op::v0::Constant::create(ov::element::f32, Shape{}, {score_threshold});
|
||||
|
||||
auto nms = std::make_shared<ov::op::v13::NMSRotated>(node.get_ng_inputs().at(0),
|
||||
node.get_ng_inputs().at(1),
|
||||
|
|
|
|||
|
|
@ -29,21 +29,21 @@ OutputVector non_max_suppression(const Node& node) {
|
|||
if (ng_inputs.size() > 2 && !is_null(ng_inputs.at(2))) {
|
||||
max_output_boxes_per_class = ngraph::onnx_import::reshape::interpret_as_scalar(ng_inputs.at(2));
|
||||
} else {
|
||||
max_output_boxes_per_class = v0::Constant::create(element::i64, Shape{}, {0});
|
||||
max_output_boxes_per_class = v0::Constant::create(ov::element::i64, Shape{}, {0});
|
||||
}
|
||||
|
||||
ov::Output<ov::Node> iou_threshold;
|
||||
if (ng_inputs.size() > 3 && !is_null(ng_inputs.at(3))) {
|
||||
iou_threshold = ngraph::onnx_import::reshape::interpret_as_scalar(ng_inputs.at(3));
|
||||
} else {
|
||||
iou_threshold = v0::Constant::create(element::f32, Shape{}, {.0f});
|
||||
iou_threshold = v0::Constant::create(ov::element::f32, Shape{}, {.0f});
|
||||
}
|
||||
|
||||
ov::Output<ov::Node> score_threshold;
|
||||
if (ng_inputs.size() > 4 && !is_null(ng_inputs.at(4))) {
|
||||
score_threshold = ngraph::onnx_import::reshape::interpret_as_scalar(ng_inputs.at(4));
|
||||
} else {
|
||||
score_threshold = v0::Constant::create(element::f32, Shape{}, {-std::numeric_limits<float>::max()});
|
||||
score_threshold = v0::Constant::create(ov::element::f32, Shape{}, {-std::numeric_limits<float>::max()});
|
||||
}
|
||||
|
||||
const auto center_point_box = node.get_attribute_value<std::int64_t>("center_point_box", 0);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace op {
|
|||
namespace set_1 {
|
||||
OutputVector non_zero(const Node& node) {
|
||||
auto data = node.get_ng_inputs().at(0);
|
||||
return {std::make_shared<v3::NonZero>(data, element::i64)};
|
||||
return {std::make_shared<v3::NonZero>(data, ov::element::i64)};
|
||||
}
|
||||
|
||||
} // namespace set_1
|
||||
|
|
|
|||
|
|
@ -19,11 +19,11 @@ namespace op {
|
|||
namespace set_1 {
|
||||
OutputVector onehot(const Node& node) {
|
||||
OutputVector inputs{node.get_ng_inputs()};
|
||||
auto indices = std::make_shared<v0::Convert>(inputs.at(0), element::i64);
|
||||
auto depth = std::make_shared<v0::Convert>(reshape::interpret_as_scalar(inputs.at(1)), element::i64);
|
||||
auto indices = std::make_shared<v0::Convert>(inputs.at(0), ov::element::i64);
|
||||
auto depth = std::make_shared<v0::Convert>(reshape::interpret_as_scalar(inputs.at(1)), ov::element::i64);
|
||||
// Rank 1 tensor containing exactly two elements: [off_value, on_value]
|
||||
auto values = inputs.at(2);
|
||||
auto split_axis = v0::Constant::create(element::i64, {}, {0});
|
||||
auto split_axis = v0::Constant::create(ov::element::i64, {}, {0});
|
||||
auto off_on_values = std::make_shared<v1::Split>(values, split_axis, 2);
|
||||
auto off_value = reshape::interpret_as_scalar(off_on_values->output(0));
|
||||
auto on_value = reshape::interpret_as_scalar(off_on_values->output(1));
|
||||
|
|
|
|||
|
|
@ -51,10 +51,10 @@ OutputVector generate_proposals(const Node& node) {
|
|||
attrs.normalized = !node.get_attribute_value<int64_t>("legacy_plus_one", true);
|
||||
|
||||
// Broadcast anchors from [A, 4] to [H, W, A, 4] where [H, W] is taken from scores shape.
|
||||
const auto zero = v0::Constant::create(element::i64, Shape{1}, {0});
|
||||
const auto zero = v0::Constant::create(ov::element::i64, Shape{1}, {0});
|
||||
const auto scores_shape = std::make_shared<v3::ShapeOf>(scores);
|
||||
const auto anchors_shape = std::make_shared<v3::ShapeOf>(anchors);
|
||||
const auto scores_shape_tail = v0::Constant::create(element::i64, Shape{2}, {2, 3});
|
||||
const auto scores_shape_tail = v0::Constant::create(ov::element::i64, Shape{2}, {2, 3});
|
||||
const auto new_anchors_shape_front = std::make_shared<v8::Gather>(scores_shape, scores_shape_tail, zero);
|
||||
const auto new_anchors_shape =
|
||||
std::make_shared<v0::Concat>(OutputVector{new_anchors_shape_front, anchors_shape}, 0);
|
||||
|
|
|
|||
|
|
@ -46,13 +46,13 @@ OutputVector normalize(const Node& node) {
|
|||
for (int64_t i = 2; i < data_shape.rank().get_length(); ++i) {
|
||||
weights_shape.push_back(1);
|
||||
}
|
||||
auto new_shape = std::make_shared<v0::Constant>(element::i64, Shape{weights_shape.size()}, weights_shape);
|
||||
auto new_shape = std::make_shared<v0::Constant>(ov::element::i64, Shape{weights_shape.size()}, weights_shape);
|
||||
weights = std::make_shared<v1::Reshape>(inputs[1], new_shape, true);
|
||||
}
|
||||
|
||||
std::shared_ptr<ov::Node> axes;
|
||||
if (!across_spatial) {
|
||||
axes = std::make_shared<v0::Constant>(element::i64, Shape{1}, std::vector<int64_t>{1});
|
||||
axes = std::make_shared<v0::Constant>(ov::element::i64, Shape{1}, std::vector<int64_t>{1});
|
||||
} else {
|
||||
axes = common::get_monotonic_range_along_node_rank(data, 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,11 +22,12 @@ namespace op {
|
|||
namespace detail {
|
||||
namespace {
|
||||
std::shared_ptr<v1::StridedSlice> make_slice(std::shared_ptr<ov::Node> node, int64_t start, int64_t end) {
|
||||
return std::make_shared<v1::StridedSlice>(node,
|
||||
v0::Constant::create(element::i64, Shape{1}, std::vector<int64_t>{start}),
|
||||
v0::Constant::create(element::i64, Shape{1}, std::vector<int64_t>{end}),
|
||||
std::vector<int64_t>{0}, // begin mask
|
||||
std::vector<int64_t>{0}); // end mask
|
||||
return std::make_shared<v1::StridedSlice>(
|
||||
node,
|
||||
v0::Constant::create(ov::element::i64, Shape{1}, std::vector<int64_t>{start}),
|
||||
v0::Constant::create(ov::element::i64, Shape{1}, std::vector<int64_t>{end}),
|
||||
std::vector<int64_t>{0}, // begin mask
|
||||
std::vector<int64_t>{0}); // end mask
|
||||
}
|
||||
} // namespace
|
||||
} // namespace detail
|
||||
|
|
@ -56,7 +57,7 @@ OutputVector prior_box(const Node& node) {
|
|||
attrs.density = node.get_attribute_value<std::vector<float>>("density", {});
|
||||
attrs.min_max_aspect_ratios_order = node.get_attribute_value<int64_t>("min_max_aspect_ratios_order", 1);
|
||||
|
||||
auto axes = v0::Constant::create(element::i64, Shape{1}, std::vector<int64_t>{0});
|
||||
auto axes = v0::Constant::create(ov::element::i64, Shape{1}, std::vector<int64_t>{0});
|
||||
|
||||
return {
|
||||
std::make_shared<v0::Unsqueeze>(std::make_shared<v8::PriorBox>(output_shape_slice, image_shape_slice, attrs),
|
||||
|
|
@ -95,7 +96,7 @@ OutputVector prior_box_clustered(const Node& node) {
|
|||
attrs.step = node.get_attribute_value<float>("step", 0.0f);
|
||||
attrs.offset = node.get_attribute_value<float>("offset", 0.0f);
|
||||
|
||||
auto axes = v0::Constant::create(element::i64, Shape{1}, std::vector<int64_t>{0});
|
||||
auto axes = v0::Constant::create(ov::element::i64, Shape{1}, std::vector<int64_t>{0});
|
||||
|
||||
return {std::make_shared<v0::Unsqueeze>(
|
||||
std::make_shared<v0::PriorBoxClustered>(output_shape_slice, image_shape_slice, attrs),
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ OutputVector swish(const Node& node) {
|
|||
if (ng_inputs.size() > 1) {
|
||||
beta = ngraph::onnx_import::reshape::interpret_as_scalar(ng_inputs.at(1));
|
||||
} else {
|
||||
beta = v0::Constant::create(element::f32, Shape{}, {1.0});
|
||||
beta = v0::Constant::create(ov::element::f32, Shape{}, {1.0});
|
||||
}
|
||||
|
||||
return {std::make_shared<v4::Swish>(ng_inputs.at(0), beta)};
|
||||
|
|
|
|||
|
|
@ -54,8 +54,8 @@ OutputVector pad(const Node& node) {
|
|||
|
||||
return {std::make_shared<v12::Pad>(
|
||||
data,
|
||||
std::make_shared<v0::Constant>(element::i64, ov::Shape{padding_below.size()}, padding_below),
|
||||
std::make_shared<v0::Constant>(element::i64, ov::Shape{padding_above.size()}, padding_above),
|
||||
std::make_shared<v0::Constant>(ov::element::i64, ov::Shape{padding_below.size()}, padding_below),
|
||||
std::make_shared<v0::Constant>(ov::element::i64, ov::Shape{padding_above.size()}, padding_above),
|
||||
std::make_shared<v0::Constant>(data.get_element_type(), ov::Shape{}, std::vector<double>{value}),
|
||||
pad_mode)};
|
||||
}
|
||||
|
|
@ -84,8 +84,8 @@ OutputVector pad(const Node& node) {
|
|||
std::vector<std::int64_t> padding_begin_values(pads_vector.begin(), pads_vector.begin() + half_size);
|
||||
std::vector<std::int64_t> padding_end_values(pads_vector.begin() + half_size, pads_vector.end());
|
||||
|
||||
padding_begin = v0::Constant::create(element::i64, ov::Shape{half_size}, padding_begin_values);
|
||||
padding_end = v0::Constant::create(element::i64, ov::Shape{half_size}, padding_end_values);
|
||||
padding_begin = v0::Constant::create(ov::element::i64, ov::Shape{half_size}, padding_begin_values);
|
||||
padding_end = v0::Constant::create(ov::element::i64, ov::Shape{half_size}, padding_end_values);
|
||||
} else {
|
||||
OutputVector padding = ov::op::util::split(pads, 2, 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -37,12 +37,12 @@ OutputVector qlinear_conv(const Node& node) {
|
|||
|
||||
x = set_13::detail::dequantize_linear(x,
|
||||
x_scale,
|
||||
std::make_shared<v0::Convert>(x_zero_point, element::f32),
|
||||
std::make_shared<v0::Convert>(x_zero_point, ov::element::f32),
|
||||
1,
|
||||
node)[0];
|
||||
w = set_13::detail::dequantize_linear(w,
|
||||
w_scale,
|
||||
std::make_shared<v0::Convert>(w_zero_point, element::f32),
|
||||
std::make_shared<v0::Convert>(w_zero_point, ov::element::f32),
|
||||
1,
|
||||
node)[0];
|
||||
|
||||
|
|
|
|||
|
|
@ -32,13 +32,13 @@ OutputVector qlinear_matmul(const Node& node) {
|
|||
const auto& dequnatize_a =
|
||||
set_13::detail::dequantize_linear(a,
|
||||
a_scale,
|
||||
std::make_shared<v0::Convert>(a_zero_point, element::f32),
|
||||
std::make_shared<v0::Convert>(a_zero_point, ov::element::f32),
|
||||
1,
|
||||
node);
|
||||
const auto& dequnatize_b =
|
||||
set_13::detail::dequantize_linear(b,
|
||||
b_scale,
|
||||
std::make_shared<v0::Convert>(b_zero_point, element::f32),
|
||||
std::make_shared<v0::Convert>(b_zero_point, ov::element::f32),
|
||||
1,
|
||||
node);
|
||||
|
||||
|
|
|
|||
|
|
@ -59,16 +59,16 @@ namespace ngraph
|
|||
const OpZeroPoint& op_zero_point,
|
||||
const Output<ngraph::Node>& bias = nullptr)
|
||||
{
|
||||
ngraph::element::Type output_type;
|
||||
if (data.get_element_type() == ngraph::element::u8 &&
|
||||
filters.get_element_type() == ngraph::element::i8)
|
||||
ngraph:: ov::element::Type output_type;
|
||||
if (data.get_element_type() == ngraph:: ov::element::u8 &&
|
||||
filters.get_element_type() == ngraph:: ov::element::i8)
|
||||
{
|
||||
output_type = ngraph::element::i8;
|
||||
output_type = ngraph:: ov::element::i8;
|
||||
}
|
||||
else if (data.get_element_type() == ngraph::element::u8 &&
|
||||
filters.get_element_type() == ngraph::element::u8)
|
||||
else if (data.get_element_type() == ngraph:: ov::element::u8 &&
|
||||
filters.get_element_type() == ngraph:: ov::element::u8)
|
||||
{
|
||||
output_type = ngraph::element::u8;
|
||||
output_type = ngraph:: ov::element::u8;
|
||||
}
|
||||
if (groups > 1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ ov::Output<ov::Node> get_zero_point(const OutputVector& inputs) {
|
|||
if (inputs.size() > 2) {
|
||||
return inputs.at(2);
|
||||
} else {
|
||||
return std::make_shared<v0::Constant>(element::u8, Shape{1}, std::uint8_t(0));
|
||||
return std::make_shared<v0::Constant>(ov::element::u8, Shape{1}, std::uint8_t(0));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -35,8 +35,8 @@ void validate_zero_point_type(const Node& onnx_node, const ov::Output<ov::Node>&
|
|||
const auto& y_zero_point_et = y_zero_point.get_element_type();
|
||||
CHECK_VALID_NODE(
|
||||
onnx_node,
|
||||
y_zero_point_et.is_static() && (y_zero_point_et == element::u8 || y_zero_point_et == element::i8 ||
|
||||
y_zero_point_et == element::u16 || y_zero_point_et == element::i16),
|
||||
y_zero_point_et.is_static() && (y_zero_point_et == ov::element::u8 || y_zero_point_et == ov::element::i8 ||
|
||||
y_zero_point_et == ov::element::u16 || y_zero_point_et == ov::element::i16),
|
||||
"\"y_zero_point\" input data for QuantizeLinear operator must be one of the supported types: u8, i8, u16 or i16"
|
||||
"integer type.");
|
||||
}
|
||||
|
|
@ -44,8 +44,8 @@ void validate_zero_point_type(const Node& onnx_node, const ov::Output<ov::Node>&
|
|||
ov::Output<ov::Node> validate_scale(const Node& onnx_node, const ov::Output<ov::Node>& y_scale) {
|
||||
const auto& y_scale_et = y_scale.get_element_type();
|
||||
CHECK_VALID_NODE(onnx_node, y_scale_et.is_static(), "\"y_scale\" input data type must be static.");
|
||||
if (y_scale_et != element::f32) {
|
||||
return std::make_shared<v0::Convert>(y_scale, element::f32);
|
||||
if (y_scale_et != ov::element::f32) {
|
||||
return std::make_shared<v0::Convert>(y_scale, ov::element::f32);
|
||||
}
|
||||
return y_scale;
|
||||
}
|
||||
|
|
@ -54,33 +54,34 @@ ov::Output<ov::Node> validate_data(const Node& onnx_node, const ov::Output<ov::N
|
|||
const auto& data_et = data.get_element_type();
|
||||
CHECK_VALID_NODE(onnx_node, data_et.is_static(), "\"x\" input data type must be static.");
|
||||
|
||||
if (data_et != element::f32) {
|
||||
return std::make_shared<v0::Convert>(data, element::f32);
|
||||
if (data_et != ov::element::f32) {
|
||||
return std::make_shared<v0::Convert>(data, ov::element::f32);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
std::tuple<std::shared_ptr<ov::Node>, std::shared_ptr<ov::Node>> get_output_bands(const element::Type& destination_type,
|
||||
const element::Type& data_type) {
|
||||
std::tuple<std::shared_ptr<ov::Node>, std::shared_ptr<ov::Node>> get_output_bands(
|
||||
const ov::element::Type& destination_type,
|
||||
const ov::element::Type& data_type) {
|
||||
std::shared_ptr<ov::Node> output_low;
|
||||
std::shared_ptr<ov::Node> output_high;
|
||||
|
||||
// These values could be used in a ConvertQuantizeDequantize transformation and
|
||||
// should be aligned
|
||||
switch (destination_type) {
|
||||
case element::i8:
|
||||
case ov::element::i8:
|
||||
output_low = std::make_shared<v0::Constant>(data_type, Shape{1}, -128);
|
||||
output_high = std::make_shared<v0::Constant>(data_type, Shape{1}, 127);
|
||||
break;
|
||||
case element::u8:
|
||||
case ov::element::u8:
|
||||
output_low = std::make_shared<v0::Constant>(data_type, Shape{1}, 0);
|
||||
output_high = std::make_shared<v0::Constant>(data_type, Shape{1}, 255);
|
||||
break;
|
||||
case element::i16:
|
||||
case ov::element::i16:
|
||||
output_low = std::make_shared<v0::Constant>(data_type, Shape{1}, -32768);
|
||||
output_high = std::make_shared<v0::Constant>(data_type, Shape{1}, 32767);
|
||||
break;
|
||||
case element::u16:
|
||||
case ov::element::u16:
|
||||
output_low = std::make_shared<v0::Constant>(data_type, Shape{1}, 0);
|
||||
output_high = std::make_shared<v0::Constant>(data_type, Shape{1}, 65535);
|
||||
break;
|
||||
|
|
@ -97,7 +98,7 @@ std::tuple<std::shared_ptr<ov::Node>, std::shared_ptr<ov::Node>> get_input_bands
|
|||
const ov::Output<ov::Node>& y_zero_point,
|
||||
const std::shared_ptr<ov::Node>& output_low,
|
||||
const std::shared_ptr<ov::Node>& output_high,
|
||||
const element::Type& data_type) {
|
||||
const ov::element::Type& data_type) {
|
||||
std::shared_ptr<ov::Node> input_low;
|
||||
std::shared_ptr<ov::Node> input_high;
|
||||
const auto& zero_point = std::make_shared<v0::Convert>(y_zero_point, data_type);
|
||||
|
|
@ -117,8 +118,8 @@ std::tuple<std::shared_ptr<ov::Node>, std::shared_ptr<ov::Node>> get_input_bands
|
|||
std::shared_ptr<ov::Node> make_fake_quantize(const ov::Output<ov::Node>& y_scale,
|
||||
const ov::Output<ov::Node>& y_zero_point,
|
||||
const ov::Output<ov::Node>& data) {
|
||||
const element::Type& destination_type = y_zero_point.get_element_type();
|
||||
const element::Type& data_type = data.get_element_type();
|
||||
const ov::element::Type& destination_type = y_zero_point.get_element_type();
|
||||
const ov::element::Type& data_type = data.get_element_type();
|
||||
|
||||
std::shared_ptr<ov::Node> output_low;
|
||||
std::shared_ptr<ov::Node> output_high;
|
||||
|
|
|
|||
|
|
@ -33,12 +33,12 @@ namespace {
|
|||
std::shared_ptr<ov::Node> get_dynamic_all_axes_range(const Node& node) {
|
||||
const auto input = node.get_ng_inputs().at(0);
|
||||
const auto shape_of_input = std::make_shared<v3::ShapeOf>(input);
|
||||
const auto scalar = v0::Constant::create(element::i32, Shape{1}, {0});
|
||||
const auto scalar = v0::Constant::create(ov::element::i32, Shape{1}, {0});
|
||||
const auto rank_of_input = std::make_shared<v3::ShapeOf>(shape_of_input);
|
||||
const auto rank_of_input_scalar = std::make_shared<v0::Squeeze>(rank_of_input, scalar);
|
||||
const auto start = v0::Constant::create(element::i32, Shape{}, {0});
|
||||
const auto step = v0::Constant::create(element::i32, Shape{}, {1});
|
||||
return std::make_shared<v4::Range>(start, rank_of_input_scalar, step, element::i64);
|
||||
const auto start = v0::Constant::create(ov::element::i32, Shape{}, {0});
|
||||
const auto step = v0::Constant::create(ov::element::i32, Shape{}, {1});
|
||||
return std::make_shared<v4::Range>(start, rank_of_input_scalar, step, ov::element::i64);
|
||||
}
|
||||
|
||||
std::shared_ptr<ov::Node> get_reduction_axes_from_input(const Node& node) {
|
||||
|
|
@ -86,7 +86,7 @@ std::shared_ptr<ov::Node> get_reduction_axes_from_attr(const Node& node) {
|
|||
")");
|
||||
}
|
||||
|
||||
return v0::Constant::create(element::i64, Shape{reduction_axes.size()}, reduction_axes);
|
||||
return v0::Constant::create(ov::element::i64, Shape{reduction_axes.size()}, reduction_axes);
|
||||
}
|
||||
|
||||
template <typename OpType>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include "op/reverse_sequence.hpp"
|
||||
|
||||
#include "onnx_import/core/node.hpp"
|
||||
#include "openvino/core/type/element_type.hpp"
|
||||
#include "openvino/frontend/exception.hpp"
|
||||
#include "openvino/op/convert.hpp"
|
||||
#include "openvino/op/reverse_sequence.hpp"
|
||||
|
|
@ -22,7 +23,7 @@ OutputVector reverse_sequence(const Node& node) {
|
|||
|
||||
const auto sequence_lengths = node.get_ng_inputs().at(1);
|
||||
// OpenVINO supports only int32 type of sequence_lengths
|
||||
const auto sequence_lengths_i32 = std::make_shared<v0::Convert>(node.get_ng_inputs().at(1), element::i32);
|
||||
const auto sequence_lengths_i32 = std::make_shared<v0::Convert>(node.get_ng_inputs().at(1), ov::element::i32);
|
||||
const auto data_rank = data.get_partial_shape().rank();
|
||||
|
||||
const auto batch_axis = node.get_attribute_value<int64_t>("batch_axis", 1);
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ OutputVector scan_to_tensor_iterator(const OutputVector& node_inputs,
|
|||
for (int64_t i = 0; i < num_scan_inputs; ++i) {
|
||||
const auto in_idx = num_initial_values + i;
|
||||
auto axis = scan_input_axes[i];
|
||||
const auto axis_node = default_opset::Constant::create(element::i64, Shape{1}, {axis});
|
||||
const auto axis_node = default_opset::Constant::create(ov::element::i64, Shape{1}, {axis});
|
||||
auto shape = node_inputs[in_idx + in_offset].get_partial_shape();
|
||||
if (shape.rank().is_static()) {
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
|
|
@ -71,7 +71,7 @@ OutputVector scan_to_tensor_iterator(const OutputVector& node_inputs,
|
|||
for (size_t i = 0; i < num_scan_outputs; ++i) {
|
||||
const auto out_idx = num_initial_values + i;
|
||||
const auto axis = scan_output_axes[i];
|
||||
const auto axis_node = default_opset::Constant::create(element::i64, Shape{1}, {axis});
|
||||
const auto axis_node = default_opset::Constant::create(ov::element::i64, Shape{1}, {axis});
|
||||
body_outputs[out_idx] = std::make_shared<default_opset::Unsqueeze>(body_outputs[out_idx], axis_node);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
#include "default_opset.hpp"
|
||||
#include "ngraph/node.hpp"
|
||||
#include "ngraph/type/element_type.hpp"
|
||||
#include "op/shape.hpp"
|
||||
#include "openvino/core/type/element_type.hpp"
|
||||
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
namespace ngraph {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#include "default_opset.hpp"
|
||||
#include "ngraph/shape.hpp"
|
||||
#include "ngraph/type/element_type.hpp"
|
||||
#include "openvino/core/type/element_type.hpp"
|
||||
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
namespace ngraph {
|
||||
|
|
@ -19,7 +19,7 @@ namespace op {
|
|||
namespace set_1 {
|
||||
OutputVector size(const Node& node) {
|
||||
auto data = node.get_ng_inputs().at(0);
|
||||
auto axes = default_opset::Constant::create(ngraph::element::i32, Shape{}, {0});
|
||||
auto axes = default_opset::Constant::create(ov::element::i32, Shape{}, {0});
|
||||
auto input_shape = std::make_shared<default_opset::ShapeOf>(data);
|
||||
return {std::make_shared<default_opset::ReduceProd>(input_shape, axes)};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,9 +32,9 @@ OutputVector slice(const Node& node) {
|
|||
steps = inputs.at(4);
|
||||
} else {
|
||||
const auto& default_step = default_opset::Constant::create(starts.get_element_type(), {1}, {1});
|
||||
steps =
|
||||
std::make_shared<default_opset::Broadcast>(default_step,
|
||||
std::make_shared<default_opset::ShapeOf>(starts, element::i64));
|
||||
steps = std::make_shared<default_opset::Broadcast>(
|
||||
default_step,
|
||||
std::make_shared<default_opset::ShapeOf>(starts, ov::element::i64));
|
||||
}
|
||||
|
||||
if (axes_input_provided) {
|
||||
|
|
@ -52,17 +52,19 @@ OutputVector slice(const Node& node) {
|
|||
const auto starts_atr = node.get_attribute_value<std::vector<int64_t>>("starts");
|
||||
const auto ends = node.get_attribute_as_constant<std::vector<int64_t>>("ends");
|
||||
|
||||
const auto starts = std::make_shared<default_opset::Constant>(element::i64, Shape{starts_atr.size()}, starts_atr);
|
||||
const auto starts =
|
||||
std::make_shared<default_opset::Constant>(ov::element::i64, Shape{starts_atr.size()}, starts_atr);
|
||||
auto axes_atr = node.get_attribute_value<std::vector<int64_t>>("axes", std::vector<int64_t>());
|
||||
|
||||
const auto steps = default_opset::Constant::create(element::i64,
|
||||
const auto steps = default_opset::Constant::create(ov::element::i64,
|
||||
Shape{starts_atr.size()},
|
||||
std::vector<int64_t>(starts_atr.size(), 1));
|
||||
|
||||
if (axes_atr.empty()) {
|
||||
return {std::make_shared<ov::opset8::Slice>(data, starts, ends, steps)};
|
||||
} else {
|
||||
const auto& axes = std::make_shared<default_opset::Constant>(element::i64, Shape{axes_atr.size()}, axes_atr);
|
||||
const auto& axes =
|
||||
std::make_shared<default_opset::Constant>(ov::element::i64, Shape{axes_atr.size()}, axes_atr);
|
||||
return {std::make_shared<ov::opset8::Slice>(data, starts, ends, steps, axes)};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ OutputVector split(const Node& node) {
|
|||
const auto outputs_number = node.get_output_names().size();
|
||||
return ov::op::util::split(inputs.at(0), outputs_number, axis);
|
||||
} else {
|
||||
const auto axis_node = default_opset::Constant::create(element::Type_t::i64, Shape{}, {axis});
|
||||
const auto axis_node = default_opset::Constant::create(ov::element::Type_t::i64, Shape{}, {axis});
|
||||
return {std::make_shared<default_opset::VariadicSplit>(inputs.at(0), axis_node, inputs.at(1))->outputs()};
|
||||
}
|
||||
}
|
||||
|
|
@ -49,4 +49,4 @@ OutputVector split(const Node& node) {
|
|||
} // namespace onnx_import
|
||||
|
||||
} // namespace ngraph
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ OutputVector squeeze(const Node& node) {
|
|||
if (axes.empty()) {
|
||||
return {std::make_shared<default_opset::Squeeze>(data)};
|
||||
} else {
|
||||
const auto axes_const = std::make_shared<default_opset::Constant>(element::i64, Shape{axes.size()}, axes);
|
||||
const auto axes_const = std::make_shared<default_opset::Constant>(ov::element::i64, Shape{axes.size()}, axes);
|
||||
return {std::make_shared<default_opset::Squeeze>(data, axes_const)};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,28 +69,28 @@ OutputVector stft(const Node& node) {
|
|||
}
|
||||
const int64_t batch_size = signal_param_shape[0].get_length();
|
||||
const auto nstfts = static_cast<int64_t>((signal_param_shape[axis].get_length() - frame_length) / frame_step) + 1;
|
||||
const auto axis_const = default_opset::Constant::create(element::i64, {}, {axis});
|
||||
const auto zero_const = default_opset::Constant::create(element::i64, {}, {0});
|
||||
const auto step = default_opset::Constant::create(element::i64, Shape{2}, {1, 1});
|
||||
const auto axis_const = default_opset::Constant::create(ov::element::i64, {}, {axis});
|
||||
const auto zero_const = default_opset::Constant::create(ov::element::i64, {}, {0});
|
||||
const auto step = default_opset::Constant::create(ov::element::i64, Shape{2}, {1, 1});
|
||||
ov::OutputVector all_signals;
|
||||
for (int64_t batch = 0; batch < batch_size; ++batch) {
|
||||
ov::OutputVector signals_in_batch;
|
||||
for (int64_t sig_idx = 0; sig_idx < nstfts; ++sig_idx) {
|
||||
const auto start = default_opset::Constant::create(element::i64,
|
||||
const auto start = default_opset::Constant::create(ov::element::i64,
|
||||
Shape{2},
|
||||
std::vector<int64_t>{batch, sig_idx * frame_step});
|
||||
const auto stop =
|
||||
default_opset::Constant::create(element::i64,
|
||||
default_opset::Constant::create(ov::element::i64,
|
||||
Shape{2},
|
||||
std::vector<int64_t>{batch + 1, sig_idx * frame_step + frame_length});
|
||||
const auto slice_axes =
|
||||
default_opset::Constant::create(element::i64, Shape{2}, std::vector<int64_t>{0, axis});
|
||||
default_opset::Constant::create(ov::element::i64, Shape{2}, std::vector<int64_t>{0, axis});
|
||||
const auto slice = std::make_shared<default_opset::Slice>(signal, start, stop, step, slice_axes);
|
||||
const ov::Output<ov::Node> flatten_slice = std::make_shared<default_opset::Reshape>(
|
||||
slice,
|
||||
is_complex(slice) ? default_opset::Constant::create(element::i64, {2}, {-1, 2})
|
||||
: (onesided ? default_opset::Constant::create(element::i64, {1}, {-1})
|
||||
: default_opset::Constant::create(element::i64, {2}, {-1, 1})),
|
||||
is_complex(slice) ? default_opset::Constant::create(ov::element::i64, {2}, {-1, 2})
|
||||
: (onesided ? default_opset::Constant::create(ov::element::i64, {1}, {-1})
|
||||
: default_opset::Constant::create(ov::element::i64, {2}, {-1, 1})),
|
||||
false);
|
||||
const auto dft = dft::make_dft(
|
||||
window_node_provided
|
||||
|
|
@ -100,7 +100,7 @@ OutputVector stft(const Node& node) {
|
|||
? std::make_shared<default_opset::Broadcast>( // align window shape with signal shape
|
||||
std::make_shared<default_opset::Unsqueeze>(
|
||||
ng_inputs[2],
|
||||
default_opset::Constant::create(element::i64, {1}, {1})),
|
||||
default_opset::Constant::create(ov::element::i64, {1}, {1})),
|
||||
std::make_shared<default_opset::ShapeOf>(flatten_slice))
|
||||
: ng_inputs[2])
|
||||
: flatten_slice,
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ OutputVector tile(const Node& node) {
|
|||
|
||||
// Workaround for backends which require repeats to be i64.
|
||||
// Remove the following line when no longer needed.
|
||||
repeats = std::make_shared<default_opset::Convert>(repeats, element::i64);
|
||||
repeats = std::make_shared<default_opset::Convert>(repeats, ov::element::i64);
|
||||
|
||||
return {std::make_shared<default_opset::Tile>(input, repeats)};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
#include "default_opset.hpp"
|
||||
#include "ngraph/node.hpp"
|
||||
#include "ngraph/shape.hpp"
|
||||
#include "ngraph/type/element_type.hpp"
|
||||
#include "openvino/core/type/element_type.hpp"
|
||||
#include "openvino/frontend/exception.hpp"
|
||||
#include "utils/reshape.hpp"
|
||||
|
||||
|
|
@ -42,7 +42,7 @@ OutputVector topk(const Node& node) {
|
|||
axis,
|
||||
default_opset::TopK::Mode::MAX,
|
||||
default_opset::TopK::SortType::SORT_VALUES,
|
||||
element::i64);
|
||||
ov::element::i64);
|
||||
|
||||
return {top_k->output(0), top_k->output(1)};
|
||||
}
|
||||
|
|
@ -60,7 +60,7 @@ OutputVector topk(const Node& node) {
|
|||
axis,
|
||||
default_opset::TopK::Mode::MAX,
|
||||
default_opset::TopK::SortType::SORT_VALUES,
|
||||
element::i64);
|
||||
ov::element::i64);
|
||||
|
||||
return {top_k->output(0), top_k->output(1)};
|
||||
}
|
||||
|
|
@ -84,7 +84,7 @@ OutputVector topk(const Node& node) {
|
|||
const auto mode = compute_max ? default_opset::TopK::Mode::MAX : default_opset::TopK::Mode::MIN;
|
||||
|
||||
std::shared_ptr<ngraph::Node> top_k =
|
||||
std::make_shared<default_opset::TopK>(data, k, axis, mode, sort_type, element::i64);
|
||||
std::make_shared<default_opset::TopK>(data, k, axis, mode, sort_type, ov::element::i64);
|
||||
|
||||
return {top_k->output(0), top_k->output(1)};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ OutputVector trilu(const Node& node) {
|
|||
}
|
||||
|
||||
const auto shape = std::make_shared<default_opset::ShapeOf>(input);
|
||||
const auto zero = default_opset::Constant::create(element::i64, Shape{}, {0});
|
||||
const auto one = default_opset::Constant::create(element::i64, Shape{}, {1});
|
||||
const auto zero = default_opset::Constant::create(ov::element::i64, Shape{}, {0});
|
||||
const auto one = default_opset::Constant::create(ov::element::i64, Shape{}, {1});
|
||||
|
||||
// The approach here is to create a mask, that later can be used in Select operator
|
||||
// to choose appropiate values from the input
|
||||
|
|
@ -62,26 +62,28 @@ OutputVector trilu(const Node& node) {
|
|||
// fetch last two dimensions of input shape
|
||||
// M = shape[-1]
|
||||
// N = shape[-2]
|
||||
const auto M = std::make_shared<default_opset::Gather>(shape,
|
||||
default_opset::Constant::create(element::i32, Shape{}, {-1}),
|
||||
zero);
|
||||
const auto N = std::make_shared<default_opset::Gather>(shape,
|
||||
default_opset::Constant::create(element::i32, Shape{}, {-2}),
|
||||
zero);
|
||||
const auto M =
|
||||
std::make_shared<default_opset::Gather>(shape,
|
||||
default_opset::Constant::create(ov::element::i32, Shape{}, {-1}),
|
||||
zero);
|
||||
const auto N =
|
||||
std::make_shared<default_opset::Gather>(shape,
|
||||
default_opset::Constant::create(ov::element::i32, Shape{}, {-2}),
|
||||
zero);
|
||||
|
||||
// create 2D tensor with shape [1, M] and values [[0, 1, ..., M - 1]]
|
||||
const auto horizontal_range =
|
||||
std::make_shared<default_opset::Unsqueeze>(std::make_shared<default_opset::Range>(zero, M, one, element::i64),
|
||||
zero);
|
||||
const auto horizontal_range = std::make_shared<default_opset::Unsqueeze>(
|
||||
std::make_shared<default_opset::Range>(zero, M, one, ov::element::i64),
|
||||
zero);
|
||||
// create 2D tensor with shape [N, 1] and values [[k], [k + 1], ..., [N + k - 1]]
|
||||
std::shared_ptr<ngraph::Node> vertical_range;
|
||||
if (is_k_available) {
|
||||
vertical_range = std::make_shared<default_opset::Range>(inputs[1],
|
||||
std::make_shared<default_opset::Add>(N, inputs[1]),
|
||||
one,
|
||||
element::i64);
|
||||
ov::element::i64);
|
||||
} else {
|
||||
vertical_range = std::make_shared<default_opset::Range>(zero, N, one, element::i64);
|
||||
vertical_range = std::make_shared<default_opset::Range>(zero, N, one, ov::element::i64);
|
||||
}
|
||||
vertical_range = std::make_shared<default_opset::Unsqueeze>(vertical_range, one);
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ OutputVector upsample(const onnx_import::Node& node) {
|
|||
scales[rank_size - 1] = width_scale;
|
||||
scales[rank_size - 2] = height_scale;
|
||||
|
||||
const auto scales_const = default_opset::Constant::create(ngraph::element::f32, Shape({scales.size()}), scales);
|
||||
const auto scales_const = default_opset::Constant::create(ov::element::f32, Shape({scales.size()}), scales);
|
||||
|
||||
return std::make_shared<default_opset::Interpolate>(data, scales_const, get_attributes(mode))->outputs();
|
||||
}
|
||||
|
|
@ -96,7 +96,7 @@ OutputVector upsample(const onnx_import::Node& node) {
|
|||
"Input tensor's rank is required to be the same as number of "
|
||||
"elements of 'scales' attribute.");
|
||||
|
||||
const auto scales_const = default_opset::Constant::create(ngraph::element::f32, Shape({scales.size()}), scales);
|
||||
const auto scales_const = default_opset::Constant::create(ov::element::f32, Shape({scales.size()}), scales);
|
||||
|
||||
return std::make_shared<default_opset::Interpolate>(data, scales_const, get_attributes(mode))->outputs();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ std::shared_ptr<ov::Node> ArgMinMaxFactory::make_arg_min() const {
|
|||
}
|
||||
|
||||
std::shared_ptr<ov::Node> ArgMinMaxFactory::make_topk_subgraph(v11::TopK::Mode mode) const {
|
||||
const auto k_node = v0::Constant::create(element::i64, Shape{}, {1});
|
||||
const auto k_node = v0::Constant::create(ov::element::i64, Shape{}, {1});
|
||||
|
||||
if (m_select_last_index == 1) {
|
||||
// Example (ArgMin):
|
||||
|
|
@ -69,22 +69,23 @@ std::shared_ptr<ov::Node> ArgMinMaxFactory::make_topk_subgraph(v11::TopK::Mode m
|
|||
ov::normalize_axis(m_input_node.get_node(), m_axis, m_input_node.get_partial_shape().rank());
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
|
||||
const auto axis_node = v0::Constant::create(element::i64, Shape{1}, {normalized_axis});
|
||||
const auto axis_node = v0::Constant::create(ov::element::i64, Shape{1}, {normalized_axis});
|
||||
const auto reverse = std::make_shared<v1::Reverse>(m_input_node, axis_node, v1::Reverse::Mode::INDEX);
|
||||
|
||||
const auto topk = std::make_shared<v11::TopK>(reverse, k_node, normalized_axis, mode, v1::TopK::SortType::NONE);
|
||||
|
||||
const auto data_shape = std::make_shared<v0::ShapeOf>(m_input_node);
|
||||
const auto dims_on_axis =
|
||||
std::make_shared<v1::Gather>(data_shape, axis_node, v0::Constant::create(element::i64, Shape{}, {0}));
|
||||
std::make_shared<v1::Gather>(data_shape, axis_node, v0::Constant::create(ov::element::i64, Shape{}, {0}));
|
||||
|
||||
const auto res_index =
|
||||
std::make_shared<v1::Subtract>(dims_on_axis, std::make_shared<v0::Convert>(topk->output(1), element::i64));
|
||||
std::make_shared<v1::Subtract>(dims_on_axis,
|
||||
std::make_shared<v0::Convert>(topk->output(1), ov::element::i64));
|
||||
const auto result =
|
||||
std::make_shared<v1::Subtract>(res_index, v0::Constant::create(element::i64, Shape{1}, {1}));
|
||||
std::make_shared<v1::Subtract>(res_index, v0::Constant::create(ov::element::i64, Shape{1}, {1}));
|
||||
|
||||
if (m_keep_dims == 0) {
|
||||
const auto axis_to_remove = v0::Constant::create(element::u64, Shape{}, {topk->get_axis()});
|
||||
const auto axis_to_remove = v0::Constant::create(ov::element::u64, Shape{}, {topk->get_axis()});
|
||||
|
||||
return std::make_shared<v0::Squeeze>(result, axis_to_remove);
|
||||
}
|
||||
|
|
@ -94,10 +95,10 @@ std::shared_ptr<ov::Node> ArgMinMaxFactory::make_topk_subgraph(v11::TopK::Mode m
|
|||
|
||||
const auto topk = std::make_shared<v11::TopK>(m_input_node, k_node, m_axis, mode, v11::TopK::SortType::NONE);
|
||||
|
||||
const auto result = std::make_shared<v0::Convert>(topk->output(1), element::i64);
|
||||
const auto result = std::make_shared<v0::Convert>(topk->output(1), ov::element::i64);
|
||||
|
||||
if (m_keep_dims == 0) {
|
||||
const auto axis_to_remove = v0::Constant::create(element::u64, Shape{}, {topk->get_axis()});
|
||||
const auto axis_to_remove = v0::Constant::create(ov::element::u64, Shape{}, {topk->get_axis()});
|
||||
|
||||
return std::make_shared<v0::Squeeze>(result, axis_to_remove);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,33 +29,33 @@ namespace common {
|
|||
const ov::element::Type& get_ov_element_type(int64_t onnx_type) {
|
||||
switch (onnx_type) {
|
||||
case ONNX_NAMESPACE::TensorProto_DataType_BOOL:
|
||||
return element::boolean;
|
||||
return ov::element::boolean;
|
||||
case ONNX_NAMESPACE::TensorProto_DataType_DOUBLE:
|
||||
return element::f64;
|
||||
return ov::element::f64;
|
||||
case ONNX_NAMESPACE::TensorProto_DataType_FLOAT16:
|
||||
return element::f16;
|
||||
return ov::element::f16;
|
||||
case ONNX_NAMESPACE::TensorProto_DataType_FLOAT:
|
||||
return element::f32;
|
||||
return ov::element::f32;
|
||||
case ONNX_NAMESPACE::TensorProto_DataType_INT8:
|
||||
return element::i8;
|
||||
return ov::element::i8;
|
||||
case ONNX_NAMESPACE::TensorProto_DataType_INT16:
|
||||
return element::i16;
|
||||
return ov::element::i16;
|
||||
case ONNX_NAMESPACE::TensorProto_DataType_INT32:
|
||||
return element::i32;
|
||||
return ov::element::i32;
|
||||
case ONNX_NAMESPACE::TensorProto_DataType_INT64:
|
||||
return element::i64;
|
||||
return ov::element::i64;
|
||||
case ONNX_NAMESPACE::TensorProto_DataType_UINT8:
|
||||
return element::u8;
|
||||
return ov::element::u8;
|
||||
case ONNX_NAMESPACE::TensorProto_DataType_UINT16:
|
||||
return element::u16;
|
||||
return ov::element::u16;
|
||||
case ONNX_NAMESPACE::TensorProto_DataType_UINT32:
|
||||
return element::u32;
|
||||
return ov::element::u32;
|
||||
case ONNX_NAMESPACE::TensorProto_DataType_UINT64:
|
||||
return element::u64;
|
||||
return ov::element::u64;
|
||||
case ONNX_NAMESPACE::TensorProto_DataType_UNDEFINED:
|
||||
return element::dynamic;
|
||||
return ov::element::dynamic;
|
||||
case ONNX_NAMESPACE::TensorProto_DataType_BFLOAT16:
|
||||
return element::bf16;
|
||||
return ov::element::bf16;
|
||||
}
|
||||
OPENVINO_THROW("unsupported element type");
|
||||
}
|
||||
|
|
@ -66,19 +66,19 @@ std::shared_ptr<ov::Node> get_monotonic_range_along_node_rank(const ov::Output<o
|
|||
if (value.get_partial_shape().rank().is_static()) {
|
||||
const auto range_value =
|
||||
get_monotonic_range<int64_t>(value.get_partial_shape().rank().get_length(), start_value, step);
|
||||
return v0::Constant::create(element::i64, {range_value.size()}, range_value);
|
||||
return v0::Constant::create(ov::element::i64, {range_value.size()}, range_value);
|
||||
}
|
||||
|
||||
const auto value_shape = std::make_shared<v0::ShapeOf>(value);
|
||||
return std::make_shared<v4::Range>(v0::Constant::create(element::i64, {}, {start_value}),
|
||||
return std::make_shared<v4::Range>(v0::Constant::create(ov::element::i64, {}, {start_value}),
|
||||
std::make_shared<v0::ShapeOf>(value_shape),
|
||||
v0::Constant::create(element::i64, {}, {step}),
|
||||
element::i64);
|
||||
v0::Constant::create(ov::element::i64, {}, {step}),
|
||||
ov::element::i64);
|
||||
}
|
||||
|
||||
void validate_scalar_input(const char* input_name,
|
||||
const std::shared_ptr<ov::Node> input,
|
||||
const std::set<element::Type> allowed_types) {
|
||||
const std::set<ov::element::Type> allowed_types) {
|
||||
const auto validated_input_shape = input->get_output_partial_shape(0);
|
||||
const auto validated_input_rank = validated_input_shape.rank();
|
||||
|
||||
|
|
@ -113,7 +113,7 @@ OutputVector handle_opset6_binary_op(const Node& node) {
|
|||
if (axis < 0)
|
||||
axis += lhs_rank;
|
||||
if (lhs_rank > axis + rhs_rank) {
|
||||
auto ones = v0::Constant::create(element::i64,
|
||||
auto ones = v0::Constant::create(ov::element::i64,
|
||||
Shape{static_cast<size_t>(lhs_rank - axis - rhs_rank)},
|
||||
std::vector<int64_t>(lhs_rank - axis - rhs_rank, 1));
|
||||
auto rhs_shape = std::make_shared<v0::ShapeOf>(rhs_node);
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ std::shared_ptr<ov::Node> get_monotonic_range_along_node_rank(const ov::Output<o
|
|||
/// \return A Constant node representing shifted identity matrix.
|
||||
template <typename T = double>
|
||||
std::shared_ptr<ov::op::v0::Constant> shifted_square_identity(const Shape output_shape,
|
||||
const element::Type& output_type,
|
||||
const ov::element::Type& output_type,
|
||||
const std::int64_t shift) {
|
||||
std::vector<T> identity_matrix(shape_size(output_shape), T{0});
|
||||
std::int64_t rows = output_shape[0];
|
||||
|
|
@ -100,7 +100,7 @@ std::shared_ptr<ov::op::v0::Constant> shifted_square_identity(const Shape output
|
|||
///
|
||||
/// \return A Constant node representing identity matrix with shape (n, n).
|
||||
template <typename T = double>
|
||||
std::shared_ptr<ov::op::v0::Constant> square_identity(const size_t n, const element::Type& type) {
|
||||
std::shared_ptr<ov::op::v0::Constant> square_identity(const size_t n, const ov::element::Type& type) {
|
||||
return shifted_square_identity(Shape{n, n}, type, 0);
|
||||
}
|
||||
|
||||
|
|
@ -112,7 +112,7 @@ std::shared_ptr<ov::op::v0::Constant> square_identity(const size_t n, const elem
|
|||
/// \param[in] allowed_types An optional set of allowed element types for this input
|
||||
void validate_scalar_input(const char* input_name,
|
||||
const std::shared_ptr<ov::Node> input,
|
||||
const std::set<element::Type> allowed_types = {});
|
||||
const std::set<ov::element::Type> allowed_types = {});
|
||||
|
||||
/// \brief Temporary replacement for C++14 std::make_unique.
|
||||
/// \note details: https://en.cppreference.com/w/cpp/memory/unique_ptr/make_unique
|
||||
|
|
|
|||
|
|
@ -164,9 +164,9 @@ void calculate_auto_pads(const Shape& data_shape,
|
|||
}
|
||||
|
||||
Output<ov::Node> get_reshaped_filters(const Output<ov::Node>& filters, int64_t groups) {
|
||||
const auto zero_node = v0::Constant::create(element::i64, Shape(), {0});
|
||||
const auto split_lengths = v0::Constant::create(element::i64, Shape{2}, {1, -1});
|
||||
const auto groups_node = v0::Constant::create(element::i64, Shape{1}, {groups});
|
||||
const auto zero_node = v0::Constant::create(ov::element::i64, Shape(), {0});
|
||||
const auto split_lengths = v0::Constant::create(ov::element::i64, Shape{2}, {1, -1});
|
||||
const auto groups_node = v0::Constant::create(ov::element::i64, Shape{1}, {groups});
|
||||
|
||||
const auto filters_shape = std::make_shared<v3::ShapeOf>(filters);
|
||||
const auto splitted_shape = std::make_shared<v1::VariadicSplit>(filters_shape, zero_node, split_lengths);
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ ov::Output<ov::Node> make_dft(const ov::Output<ov::Node>& signal,
|
|||
bool is_inversed,
|
||||
bool is_onesided) {
|
||||
auto processed_signal = signal;
|
||||
const auto axis_const = v0::Constant::create(element::i64, {1}, {axis});
|
||||
const auto axis_const = v0::Constant::create(ov::element::i64, {1}, {axis});
|
||||
bool conversion_to_complex_applied = false;
|
||||
if (is_inversed || !is_onesided) { // skip for RDFT case
|
||||
conversion_to_complex_applied = try_convert_real_to_complex(processed_signal);
|
||||
|
|
@ -64,7 +64,7 @@ ov::Output<ov::Node> make_dft(const ov::Output<ov::Node>& signal,
|
|||
result = dft_length_provided ? std::make_shared<v9::IRDFT>(processed_signal, axis_const, length)
|
||||
: std::make_shared<v9::IRDFT>(processed_signal, axis_const);
|
||||
if (conversion_to_complex_applied) { // align the output shape with a real numbers representation
|
||||
const auto unsqueeze_axis = v0::Constant::create(element::i64, {}, {-1});
|
||||
const auto unsqueeze_axis = v0::Constant::create(ov::element::i64, {}, {-1});
|
||||
result = std::make_shared<v0::Unsqueeze>(result, unsqueeze_axis);
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ std::shared_ptr<v0::Constant> transposition_axis_order(const ov::Rank& input_ran
|
|||
std::iota(axes.begin(), axes.end(), 0);
|
||||
std::reverse(axes.begin() + 2, axes.end());
|
||||
|
||||
return std::make_shared<v0::Constant>(element::i32, Shape{rank}, axes);
|
||||
return std::make_shared<v0::Constant>(ov::element::i32, Shape{rank}, axes);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
|
|
|||
|
|
@ -40,17 +40,17 @@ OpInputMap::OpInputMap(const onnx_import::Node& node, std::size_t gates_count) {
|
|||
|
||||
// Get dimensions needed for default inputs creation
|
||||
auto shape_of_x = std::make_shared<v3::ShapeOf>(m_map[OpInput::X]);
|
||||
auto axes = v0::Constant::create(element::i32, Shape{1}, {0});
|
||||
auto axes = v0::Constant::create(ov::element::i32, Shape{1}, {0});
|
||||
auto batch_size_node =
|
||||
std::make_shared<v8::Gather>(shape_of_x, v0::Constant::create(element::i32, Shape{1}, {0}), axes);
|
||||
std::make_shared<v8::Gather>(shape_of_x, v0::Constant::create(ov::element::i32, Shape{1}, {0}), axes);
|
||||
auto seq_length_node =
|
||||
std::make_shared<v8::Gather>(shape_of_x, v0::Constant::create(element::i32, Shape{1}, {1}), axes);
|
||||
std::make_shared<v8::Gather>(shape_of_x, v0::Constant::create(ov::element::i32, Shape{1}, {1}), axes);
|
||||
|
||||
auto shape_of_r = std::make_shared<v3::ShapeOf>(m_map[OpInput::R]);
|
||||
auto num_directions_node =
|
||||
std::make_shared<v8::Gather>(shape_of_r, v0::Constant::create(element::i32, Shape{1}, {0}), axes);
|
||||
std::make_shared<v8::Gather>(shape_of_r, v0::Constant::create(ov::element::i32, Shape{1}, {0}), axes);
|
||||
auto hidden_size_node =
|
||||
std::make_shared<v8::Gather>(shape_of_r, v0::Constant::create(element::i32, Shape{1}, {2}), axes);
|
||||
std::make_shared<v8::Gather>(shape_of_r, v0::Constant::create(ov::element::i32, Shape{1}, {2}), axes);
|
||||
|
||||
// ------ Optional inputs ------
|
||||
if (ng_inputs.size() > 3 && !ov::op::util::is_null(ng_inputs.at(3))) {
|
||||
|
|
@ -61,7 +61,7 @@ OpInputMap::OpInputMap(const onnx_import::Node& node, std::size_t gates_count) {
|
|||
auto b_shape = std::make_shared<v0::Concat>(
|
||||
OutputVector{
|
||||
num_directions_node,
|
||||
std::make_shared<v1::Multiply>(v0::Constant::create(element::Type_t::i64, Shape{1}, {gates_count}),
|
||||
std::make_shared<v1::Multiply>(v0::Constant::create(ov::element::Type_t::i64, Shape{1}, {gates_count}),
|
||||
hidden_size_node)},
|
||||
0);
|
||||
m_map[OpInput::B] =
|
||||
|
|
|
|||
|
|
@ -94,8 +94,8 @@ ov::Output<ov::Node> interpret_as_scalar(const ov::Output<ov::Node>& node) {
|
|||
ov::Output<ov::Node> reshape_channel_shaped_node_to_nchw(const ov::Output<ov::Node>& node,
|
||||
const ov::Output<ov::Node>& expected_rank) {
|
||||
// Prepare tail shape (rank = conv.rank - 2): [1, 1, 1, 1, ... ]
|
||||
const auto one_const = v0::Constant::create(element::i64, Shape{1}, {1});
|
||||
const auto two_const = v0::Constant::create(element::i64, Shape{1}, {2});
|
||||
const auto one_const = v0::Constant::create(ov::element::i64, Shape{1}, {1});
|
||||
const auto two_const = v0::Constant::create(ov::element::i64, Shape{1}, {2});
|
||||
const auto tail_shape_rank = std::make_shared<v1::Subtract>(expected_rank, two_const);
|
||||
const auto tail_shape = std::make_shared<v3::Broadcast>(one_const, tail_shape_rank);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,21 +21,21 @@ size_t get_onnx_data_size(int32_t onnx_type);
|
|||
///
|
||||
/// \param onnx_type An element of TensorProto_DataType enum which determines an ONNX type.
|
||||
///
|
||||
element::Type_t onnx_to_ov_data_type(const TensorProto_DataType& onnx_type);
|
||||
ov::element::Type_t onnx_to_ov_data_type(const TensorProto_DataType& onnx_type);
|
||||
|
||||
/// \brief Retuns an ONNX data type corresponding to a OpenVINO data type.
|
||||
///
|
||||
/// \param ov_type An element of element::Type_t enum class which determines a OpenVINO data
|
||||
/// \param ov_type An element of ov::element::Type_t enum class which determines a OpenVINO data
|
||||
/// type.
|
||||
///
|
||||
TensorProto_DataType ov_to_onnx_data_type(const element::Type_t& ov_type);
|
||||
TensorProto_DataType ov_to_onnx_data_type(const ov::element::Type_t& ov_type);
|
||||
|
||||
/// \brief Retuns true if a OpenVINO data type is mapped to an ONNX data type.
|
||||
///
|
||||
/// \param ov_type An element of element::Type_t enum class which determines a OpenVINO data
|
||||
/// \param ov_type An element of ov::element::Type_t enum class which determines a OpenVINO data
|
||||
/// type.
|
||||
///
|
||||
bool is_supported_ov_type(const element::Type_t& ov_type);
|
||||
bool is_supported_ov_type(const ov::element::Type_t& ov_type);
|
||||
|
||||
/// \brief Retuns OpenVINO PartialShape based on onnx_shape.
|
||||
///
|
||||
|
|
@ -46,4 +46,4 @@ PartialShape onnx_to_ov_shape(const TensorShapeProto& onnx_shape);
|
|||
} // namespace common
|
||||
} // namespace onnx
|
||||
} // namespace frontend
|
||||
} // namespace ov
|
||||
} // namespace ov
|
||||
|
|
|
|||
|
|
@ -51,26 +51,26 @@ size_t get_onnx_data_size(int32_t onnx_type) {
|
|||
}
|
||||
namespace {
|
||||
using namespace ONNX_NAMESPACE;
|
||||
const std::map<element::Type_t, TensorProto_DataType> OV_2_ONNX_TYPES = {
|
||||
{element::Type_t::bf16, TensorProto_DataType::TensorProto_DataType_BFLOAT16},
|
||||
{element::Type_t::f16, TensorProto_DataType::TensorProto_DataType_FLOAT16},
|
||||
{element::Type_t::f32, TensorProto_DataType::TensorProto_DataType_FLOAT},
|
||||
{element::Type_t::f64, TensorProto_DataType::TensorProto_DataType_DOUBLE},
|
||||
{element::Type_t::i8, TensorProto_DataType::TensorProto_DataType_INT8},
|
||||
{element::Type_t::i16, TensorProto_DataType::TensorProto_DataType_INT16},
|
||||
{element::Type_t::i32, TensorProto_DataType::TensorProto_DataType_INT32},
|
||||
{element::Type_t::i64, TensorProto_DataType::TensorProto_DataType_INT64},
|
||||
{element::Type_t::u8, TensorProto_DataType::TensorProto_DataType_UINT8},
|
||||
{element::Type_t::u16, TensorProto_DataType::TensorProto_DataType_UINT16},
|
||||
{element::Type_t::u32, TensorProto_DataType::TensorProto_DataType_UINT32},
|
||||
{element::Type_t::u64, TensorProto_DataType::TensorProto_DataType_UINT64},
|
||||
{element::Type_t::boolean, TensorProto_DataType::TensorProto_DataType_BOOL}};
|
||||
const std::map<ov::element::Type_t, TensorProto_DataType> OV_2_ONNX_TYPES = {
|
||||
{ov::element::Type_t::bf16, TensorProto_DataType::TensorProto_DataType_BFLOAT16},
|
||||
{ov::element::Type_t::f16, TensorProto_DataType::TensorProto_DataType_FLOAT16},
|
||||
{ov::element::Type_t::f32, TensorProto_DataType::TensorProto_DataType_FLOAT},
|
||||
{ov::element::Type_t::f64, TensorProto_DataType::TensorProto_DataType_DOUBLE},
|
||||
{ov::element::Type_t::i8, TensorProto_DataType::TensorProto_DataType_INT8},
|
||||
{ov::element::Type_t::i16, TensorProto_DataType::TensorProto_DataType_INT16},
|
||||
{ov::element::Type_t::i32, TensorProto_DataType::TensorProto_DataType_INT32},
|
||||
{ov::element::Type_t::i64, TensorProto_DataType::TensorProto_DataType_INT64},
|
||||
{ov::element::Type_t::u8, TensorProto_DataType::TensorProto_DataType_UINT8},
|
||||
{ov::element::Type_t::u16, TensorProto_DataType::TensorProto_DataType_UINT16},
|
||||
{ov::element::Type_t::u32, TensorProto_DataType::TensorProto_DataType_UINT32},
|
||||
{ov::element::Type_t::u64, TensorProto_DataType::TensorProto_DataType_UINT64},
|
||||
{ov::element::Type_t::boolean, TensorProto_DataType::TensorProto_DataType_BOOL}};
|
||||
} // namespace
|
||||
|
||||
element::Type_t onnx_to_ov_data_type(const TensorProto_DataType& onnx_type) {
|
||||
ov::element::Type_t onnx_to_ov_data_type(const TensorProto_DataType& onnx_type) {
|
||||
const auto result = std::find_if(OV_2_ONNX_TYPES.begin(),
|
||||
OV_2_ONNX_TYPES.end(),
|
||||
[&onnx_type](const std::pair<element::Type_t, TensorProto_DataType>& pair) {
|
||||
[&onnx_type](const std::pair<ov::element::Type_t, TensorProto_DataType>& pair) {
|
||||
return pair.second == onnx_type;
|
||||
});
|
||||
if (result == std::end(OV_2_ONNX_TYPES)) {
|
||||
|
|
@ -80,11 +80,11 @@ element::Type_t onnx_to_ov_data_type(const TensorProto_DataType& onnx_type) {
|
|||
return result->first;
|
||||
}
|
||||
|
||||
TensorProto_DataType ov_to_onnx_data_type(const element::Type_t& ov_type) {
|
||||
TensorProto_DataType ov_to_onnx_data_type(const ov::element::Type_t& ov_type) {
|
||||
return OV_2_ONNX_TYPES.at(ov_type);
|
||||
}
|
||||
|
||||
bool is_supported_ov_type(const element::Type_t& ov_type) {
|
||||
bool is_supported_ov_type(const ov::element::Type_t& ov_type) {
|
||||
return OV_2_ONNX_TYPES.count(ov_type) > 0;
|
||||
}
|
||||
|
||||
|
|
@ -108,4 +108,4 @@ PartialShape onnx_to_ov_shape(const TensorShapeProto& onnx_shape) {
|
|||
} // namespace common
|
||||
} // namespace onnx
|
||||
} // namespace frontend
|
||||
} // namespace ov
|
||||
} // namespace ov
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ namespace {
|
|||
using InputTypePred = std::function<bool(const std::shared_ptr<ov::Node>)>;
|
||||
|
||||
// A higher order factory function that produces predicates bound to a particular element type
|
||||
InputTypePred element_type_is(const element::Type et) {
|
||||
InputTypePred element_type_is(const ov::element::Type et) {
|
||||
return [et](const std::shared_ptr<ov::Node> input) {
|
||||
return input->get_element_type() == et;
|
||||
};
|
||||
|
|
@ -44,21 +44,21 @@ OPENVINO_TEST(onnx_editor, types__single_input_type_substitution) {
|
|||
FrontEnd::Ptr front_end;
|
||||
auto input_model = load_model("model_editor/add_abc.onnx", &front_end);
|
||||
|
||||
input_model->set_element_type(input_model->get_place_by_tensor_name("A"), element::i64);
|
||||
input_model->set_element_type(input_model->get_place_by_tensor_name("A"), ov::element::i64);
|
||||
|
||||
const auto model = front_end->convert(input_model);
|
||||
const auto graph_inputs = model->get_parameters();
|
||||
|
||||
const auto float_inputs_count =
|
||||
std::count_if(std::begin(graph_inputs), std::end(graph_inputs), element_type_is(element::f32));
|
||||
std::count_if(std::begin(graph_inputs), std::end(graph_inputs), element_type_is(ov::element::f32));
|
||||
|
||||
const auto integer_inputs_count =
|
||||
std::count_if(std::begin(graph_inputs), std::end(graph_inputs), element_type_is(element::i64));
|
||||
std::count_if(std::begin(graph_inputs), std::end(graph_inputs), element_type_is(ov::element::i64));
|
||||
|
||||
EXPECT_EQ(float_inputs_count, 0);
|
||||
EXPECT_EQ(integer_inputs_count, 3);
|
||||
|
||||
EXPECT_EQ(find_input(graph_inputs, "A")->get_element_type(), element::i64);
|
||||
EXPECT_EQ(find_input(graph_inputs, "A")->get_element_type(), ov::element::i64);
|
||||
}
|
||||
|
||||
OPENVINO_TEST(onnx_editor, types__all_inputs_type_substitution) {
|
||||
|
|
@ -66,19 +66,19 @@ OPENVINO_TEST(onnx_editor, types__all_inputs_type_substitution) {
|
|||
FrontEnd::Ptr front_end;
|
||||
auto input_model = load_model("model_editor/add_abc.onnx", &front_end);
|
||||
|
||||
input_model->set_element_type(input_model->get_place_by_tensor_name("A"), element::i8);
|
||||
input_model->set_element_type(input_model->get_place_by_tensor_name("B"), element::i8);
|
||||
input_model->set_element_type(input_model->get_place_by_tensor_name("C"), element::i8);
|
||||
input_model->set_element_type(input_model->get_place_by_tensor_name("A"), ov::element::i8);
|
||||
input_model->set_element_type(input_model->get_place_by_tensor_name("B"), ov::element::i8);
|
||||
input_model->set_element_type(input_model->get_place_by_tensor_name("C"), ov::element::i8);
|
||||
|
||||
const auto model = front_end->convert(input_model);
|
||||
|
||||
const auto graph_inputs = model->get_parameters();
|
||||
|
||||
const auto float_inputs_count =
|
||||
std::count_if(std::begin(graph_inputs), std::end(graph_inputs), element_type_is(element::f32));
|
||||
std::count_if(std::begin(graph_inputs), std::end(graph_inputs), element_type_is(ov::element::f32));
|
||||
|
||||
const auto integer_inputs_count =
|
||||
std::count_if(std::begin(graph_inputs), std::end(graph_inputs), element_type_is(element::i8));
|
||||
std::count_if(std::begin(graph_inputs), std::end(graph_inputs), element_type_is(ov::element::i8));
|
||||
|
||||
EXPECT_EQ(float_inputs_count, 0);
|
||||
EXPECT_EQ(integer_inputs_count, 3);
|
||||
|
|
@ -88,7 +88,7 @@ OPENVINO_TEST(onnx_editor, types__missing_type_in_input_descriptor) {
|
|||
auto input_model = load_model("model_editor/invalid_input_no_type.onnx");
|
||||
|
||||
// input A doesn't have the "type" field in the model and so the data type cannot be modified
|
||||
EXPECT_THROW(input_model->set_element_type(input_model->get_place_by_tensor_name("A"), element::f32),
|
||||
EXPECT_THROW(input_model->set_element_type(input_model->get_place_by_tensor_name("A"), ov::element::f32),
|
||||
ov::Exception);
|
||||
}
|
||||
|
||||
|
|
@ -96,14 +96,14 @@ OPENVINO_TEST(onnx_editor, types__missing_tensor_type_in_input_descriptor) {
|
|||
auto input_model = load_model("model_editor/invalid_input_no_tensor_type.onnx");
|
||||
|
||||
// input A doesn't have the "tensor_type" field in the model
|
||||
EXPECT_THROW(input_model->set_element_type(input_model->get_place_by_tensor_name("A"), element::f32),
|
||||
EXPECT_THROW(input_model->set_element_type(input_model->get_place_by_tensor_name("A"), ov::element::f32),
|
||||
ov::Exception);
|
||||
}
|
||||
|
||||
OPENVINO_TEST(onnx_editor, types__unsupported_data_type_passed) {
|
||||
auto input_model = load_model("model_editor/add_abc.onnx");
|
||||
|
||||
EXPECT_THROW(input_model->set_element_type(input_model->get_place_by_tensor_name("A"), element::dynamic),
|
||||
EXPECT_THROW(input_model->set_element_type(input_model->get_place_by_tensor_name("A"), ov::element::dynamic),
|
||||
ov::Exception);
|
||||
}
|
||||
|
||||
|
|
@ -119,19 +119,19 @@ OPENVINO_TEST(onnx_editor, types__elem_type_missing_in_input) {
|
|||
auto input_model = load_model("model_editor/elem_type_missing_in_input.onnx", &front_end);
|
||||
|
||||
// the "elem_type" is missing in the model but it should be possible to set the type anyway
|
||||
EXPECT_NO_THROW(input_model->set_element_type(input_model->get_place_by_tensor_name("A"), element::i64));
|
||||
EXPECT_NO_THROW(input_model->set_element_type(input_model->get_place_by_tensor_name("A"), ov::element::i64));
|
||||
|
||||
const auto model = front_end->convert(input_model);
|
||||
|
||||
const auto graph_inputs = model->get_parameters();
|
||||
|
||||
const auto integer_inputs_count =
|
||||
std::count_if(std::begin(graph_inputs), std::end(graph_inputs), element_type_is(element::i64));
|
||||
std::count_if(std::begin(graph_inputs), std::end(graph_inputs), element_type_is(ov::element::i64));
|
||||
|
||||
EXPECT_EQ(integer_inputs_count, 2);
|
||||
|
||||
const auto function_result = model->get_result();
|
||||
EXPECT_EQ(function_result->get_element_type(), element::i64);
|
||||
EXPECT_EQ(function_result->get_element_type(), ov::element::i64);
|
||||
}
|
||||
|
||||
OPENVINO_TEST(onnx_editor, shapes__modify_single_input) {
|
||||
|
|
@ -727,8 +727,8 @@ OPENVINO_TEST(onnx_editor, values__append_two_initializers_to_invalid) {
|
|||
FrontEnd::Ptr front_end;
|
||||
auto input_model = load_model("model_editor/add_1D_invalid.onnx", &front_end);
|
||||
std::map<std::string, std::shared_ptr<ov::op::v0::Constant>> in_vals;
|
||||
// in_vals.emplace("A", ov::op::v0::Constant::create(element::i64, Shape{2}, {4, 2}));
|
||||
// in_vals.emplace("B", ov::op::v0::Constant::create(element::i64, Shape{2}, {1, 3}));
|
||||
// in_vals.emplace("A", ov::op::v0::Constant::create( ov::element::i64, Shape{2}, {4, 2}));
|
||||
// in_vals.emplace("B", ov::op::v0::Constant::create( ov::element::i64, Shape{2}, {1, 3}));
|
||||
// editor.set_input_values(in_vals);
|
||||
|
||||
auto place = input_model->get_place_by_operation_name_and_input_port("add_node", 0);
|
||||
|
|
@ -798,12 +798,12 @@ OPENVINO_TEST(onnx_editor, values__append_two_initializers_change_shape_type) {
|
|||
auto input_model = load_model("model_editor/add_1D.onnx", &front_end);
|
||||
|
||||
auto place = input_model->get_place_by_tensor_name("A");
|
||||
input_model->set_element_type(place, element::i8);
|
||||
input_model->set_element_type(place, ov::element::i8);
|
||||
input_model->set_partial_shape(place, Shape{2, 1});
|
||||
input_model->set_tensor_value(place, std::vector<int8_t>{-1, 1}.data());
|
||||
|
||||
place = input_model->get_place_by_tensor_name("B");
|
||||
input_model->set_element_type(place, element::i8);
|
||||
input_model->set_element_type(place, ov::element::i8);
|
||||
input_model->set_partial_shape(place, Shape{2, 1});
|
||||
input_model->set_tensor_value(place, std::vector<int8_t>{-2, 2}.data());
|
||||
|
||||
|
|
@ -817,12 +817,12 @@ OPENVINO_TEST(onnx_editor, values__append_two_initializers_mixed_types) {
|
|||
FrontEnd::Ptr front_end;
|
||||
auto input_model = load_model("gather_elements_float_3D_axis_2.onnx", &front_end);
|
||||
auto place = input_model->get_place_by_tensor_name("data");
|
||||
input_model->set_element_type(place, element::i16);
|
||||
input_model->set_element_type(place, ov::element::i16);
|
||||
input_model->set_partial_shape(place, Shape{2, 2, 2});
|
||||
input_model->set_tensor_value(place, std::vector<int16_t>{1, 2, 3, 4, 5, 6, 7, 8}.data());
|
||||
|
||||
place = input_model->get_place_by_tensor_name("indices");
|
||||
input_model->set_element_type(place, element::i32);
|
||||
input_model->set_element_type(place, ov::element::i32);
|
||||
input_model->set_partial_shape(place, Shape{2, 2, 1});
|
||||
input_model->set_tensor_value(place, std::vector<int32_t>{0, 1, 0, 1}.data());
|
||||
|
||||
|
|
@ -1002,10 +1002,10 @@ OPENVINO_TEST(onnx_editor, add_output) {
|
|||
|
||||
OPENVINO_TEST(onnx_editor, get_tensor_element_type) {
|
||||
auto input_model = load_model("model_editor/subgraph_extraction_tests.onnx");
|
||||
EXPECT_EQ(input_model->get_element_type(input_model->get_place_by_tensor_name("in1")), element::f32);
|
||||
EXPECT_EQ(input_model->get_element_type(input_model->get_place_by_tensor_name("in2")), element::f32);
|
||||
input_model->set_element_type(input_model->get_place_by_tensor_name("in3"), element::f16);
|
||||
EXPECT_EQ(input_model->get_element_type(input_model->get_place_by_tensor_name("in3")), element::f16);
|
||||
EXPECT_EQ(input_model->get_element_type(input_model->get_place_by_tensor_name("in1")), ov::element::f32);
|
||||
EXPECT_EQ(input_model->get_element_type(input_model->get_place_by_tensor_name("in2")), ov::element::f32);
|
||||
input_model->set_element_type(input_model->get_place_by_tensor_name("in3"), ov::element::f16);
|
||||
EXPECT_EQ(input_model->get_element_type(input_model->get_place_by_tensor_name("in3")), ov::element::f16);
|
||||
EXPECT_THROW(input_model->get_element_type(nullptr), ov::Exception);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,16 +31,16 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_controlflow_loop_2d_add) {
|
|||
// Shape inference tests
|
||||
const auto& parameters = model->get_parameters();
|
||||
EXPECT_EQ(parameters.size(), 1);
|
||||
EXPECT_EQ(parameters.at(0)->get_element_type(), element::f32);
|
||||
EXPECT_EQ(parameters.at(0)->get_element_type(), ov::element::f32);
|
||||
EXPECT_TRUE(parameters.at(0)->get_partial_shape().is_static());
|
||||
EXPECT_EQ(parameters.at(0)->get_partial_shape().to_shape(), (Shape{1, 2}));
|
||||
|
||||
const auto& results = model->get_results();
|
||||
EXPECT_EQ(results.size(), 2);
|
||||
EXPECT_EQ(model->get_output_element_type(0), element::f32);
|
||||
EXPECT_EQ(model->get_output_element_type(0), ov::element::f32);
|
||||
EXPECT_TRUE(model->get_output_partial_shape(0).is_static());
|
||||
EXPECT_EQ(model->get_output_shape(0), (Shape{1, 2}));
|
||||
EXPECT_EQ(model->get_output_element_type(1), element::f32);
|
||||
EXPECT_EQ(model->get_output_element_type(1), ov::element::f32);
|
||||
EXPECT_TRUE(model->get_output_partial_shape(1).is_static());
|
||||
EXPECT_EQ(model->get_output_shape(1), (Shape{3, 1, 2}));
|
||||
|
||||
|
|
@ -380,10 +380,10 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_controlflow_loop_2d_trip_count_and_cond_skip
|
|||
|
||||
const auto& results = model->get_results();
|
||||
EXPECT_EQ(results.size(), 2);
|
||||
EXPECT_EQ(model->get_output_element_type(0), element::f32);
|
||||
EXPECT_EQ(model->get_output_element_type(0), ov::element::f32);
|
||||
EXPECT_TRUE(model->get_output_partial_shape(0).is_static());
|
||||
EXPECT_EQ(model->get_output_shape(0), (Shape{1, 2}));
|
||||
EXPECT_EQ(model->get_output_element_type(1), element::f32);
|
||||
EXPECT_EQ(model->get_output_element_type(1), ov::element::f32);
|
||||
EXPECT_TRUE(model->get_output_partial_shape(1).rank().is_static());
|
||||
EXPECT_EQ(model->get_output_partial_shape(1).rank(), 3);
|
||||
EXPECT_EQ(model->get_output_partial_shape(1), (PartialShape{Dimension::dynamic(), 1, 2}));
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_compress_axis_0) {
|
|||
|
||||
std::map<std::string, std::shared_ptr<op::v0::Constant>> in_vals;
|
||||
|
||||
in_vals.emplace("input", op::v0::Constant::create(element::f32, Shape{3, 2}, {1., 2., 3., 4., 5., 6.}));
|
||||
in_vals.emplace("condition", op::v0::Constant::create(element::boolean, Shape{3}, {false, true, true}));
|
||||
in_vals.emplace("input", op::v0::Constant::create( ov::element::f32, Shape{3, 2}, {1., 2., 3., 4., 5., 6.}));
|
||||
in_vals.emplace("condition", op::v0::Constant::create( ov::element::boolean, Shape{3}, {false, true, true}));
|
||||
editor.set_input_values(in_vals);
|
||||
|
||||
const auto function = editor.get_function();
|
||||
|
|
@ -48,8 +48,8 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_compress_axis_1) {
|
|||
|
||||
std::map<std::string, std::shared_ptr<op::v0::Constant>> in_vals;
|
||||
|
||||
in_vals.emplace("input", op::v0::Constant::create(element::f32, Shape{3, 2}, {1., 2., 3., 4., 5., 6.}));
|
||||
in_vals.emplace("condition", op::v0::Constant::create(element::boolean, Shape{2}, {false, true}));
|
||||
in_vals.emplace("input", op::v0::Constant::create( ov::element::f32, Shape{3, 2}, {1., 2., 3., 4., 5., 6.}));
|
||||
in_vals.emplace("condition", op::v0::Constant::create( ov::element::boolean, Shape{2}, {false, true}));
|
||||
editor.set_input_values(in_vals);
|
||||
|
||||
const auto function = editor.get_function();
|
||||
|
|
@ -65,9 +65,9 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_compress_default_axis) {
|
|||
|
||||
std::map<std::string, std::shared_ptr<op::v0::Constant>> in_vals;
|
||||
|
||||
in_vals.emplace("input", op::v0::Constant::create(element::f32, Shape{3, 2}, {1., 2., 3., 4., 5., 6.}));
|
||||
in_vals.emplace("input", op::v0::Constant::create( ov::element::f32, Shape{3, 2}, {1., 2., 3., 4., 5., 6.}));
|
||||
in_vals.emplace("condition",
|
||||
op::v0::Constant::create(element::boolean, Shape{5}, {false, true, false, false, true}));
|
||||
op::v0::Constant::create( ov::element::boolean, Shape{5}, {false, true, false, false, true}));
|
||||
editor.set_input_values(in_vals);
|
||||
|
||||
const auto function = editor.get_function();
|
||||
|
|
@ -83,8 +83,8 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_compress_negative_axis) {
|
|||
|
||||
std::map<std::string, std::shared_ptr<op::v0::Constant>> in_vals;
|
||||
|
||||
in_vals.emplace("input", op::v0::Constant::create(element::f32, Shape{3, 2}, {1., 2., 3., 4., 5., 6.}));
|
||||
in_vals.emplace("condition", op::v0::Constant::create(element::boolean, Shape{2}, {false, true}));
|
||||
in_vals.emplace("input", op::v0::Constant::create( ov::element::f32, Shape{3, 2}, {1., 2., 3., 4., 5., 6.}));
|
||||
in_vals.emplace("condition", op::v0::Constant::create( ov::element::boolean, Shape{2}, {false, true}));
|
||||
editor.set_input_values(in_vals);
|
||||
|
||||
const auto function = editor.get_function();
|
||||
|
|
@ -100,7 +100,7 @@ TYPED_TEST_SUITE_P(ElemTypesTests);
|
|||
|
||||
TYPED_TEST_P(ElemTypesTests, onnx_test_add_abc_set_precission) {
|
||||
using DataType = TypeParam;
|
||||
const element::Type ng_type = element::from<DataType>();
|
||||
const ov::element::Type ng_type = ov::element::from<DataType>();
|
||||
|
||||
ov::onnx_editor::ONNXModelEditor editor{
|
||||
util::path_join({ov::test::utils::getExecutableDirectory(), TEST_ONNX_MODELS_DIRNAME, "add_abc_3d.onnx"})};
|
||||
|
|
@ -118,7 +118,7 @@ TYPED_TEST_P(ElemTypesTests, onnx_test_add_abc_set_precission) {
|
|||
|
||||
TYPED_TEST_P(ElemTypesTests, onnx_test_split_multioutput_set_precission) {
|
||||
using DataType = TypeParam;
|
||||
const element::Type ng_type = element::from<DataType>();
|
||||
const ov::element::Type ng_type = ov::element::from<DataType>();
|
||||
|
||||
ov::onnx_editor::ONNXModelEditor editor{util::path_join(
|
||||
{ov::test::utils::getExecutableDirectory(), TEST_ONNX_MODELS_DIRNAME, "split_equal_parts_default.onnx"})};
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ TEST(ONNX_Importer_Tests, ImportBasicModel) {
|
|||
|
||||
ASSERT_EQ(model->get_output_size(), 1);
|
||||
ASSERT_EQ(std::string(model->get_output_op(0)->get_type_name()), "Result");
|
||||
ASSERT_EQ(model->get_output_element_type(0), element::f32);
|
||||
ASSERT_EQ(model->get_output_element_type(0), ov::element::f32);
|
||||
ASSERT_EQ(model->get_output_shape(0), Shape({2, 2}));
|
||||
ASSERT_EQ(count_additions, 2);
|
||||
ASSERT_EQ(count_constants, 2);
|
||||
|
|
@ -55,7 +55,7 @@ TEST(ONNX_Importer_Tests, ImportModelWithFusedOp) {
|
|||
|
||||
ASSERT_EQ(model->get_output_size(), 1);
|
||||
ASSERT_EQ(std::string(model->get_output_op(0)->get_type_name()), "Result");
|
||||
ASSERT_EQ(model->get_output_element_type(0), element::f32);
|
||||
ASSERT_EQ(model->get_output_element_type(0), ov::element::f32);
|
||||
ASSERT_EQ(model->get_output_shape(0), Shape({3, 4, 5}));
|
||||
ASSERT_EQ(count_selu, 1);
|
||||
ASSERT_EQ(count_constants, 2);
|
||||
|
|
@ -79,8 +79,8 @@ TEST(ONNX_Importer_Tests, ImportModelWithMultiOutput) {
|
|||
ASSERT_EQ(model->get_output_size(), 2);
|
||||
ASSERT_EQ(std::string(model->get_output_op(0)->get_type_name()), "Result");
|
||||
ASSERT_EQ(std::string(model->get_output_op(1)->get_type_name()), "Result");
|
||||
ASSERT_EQ(model->get_output_element_type(0), element::f32);
|
||||
ASSERT_EQ(model->get_output_element_type(1), element::i64);
|
||||
ASSERT_EQ(model->get_output_element_type(0), ov::element::f32);
|
||||
ASSERT_EQ(model->get_output_element_type(1), ov::element::i64);
|
||||
ASSERT_EQ(model->get_output_shape(0), Shape({3, 3}));
|
||||
ASSERT_EQ(model->get_output_shape(1), Shape({3, 3}));
|
||||
ASSERT_EQ(count_topk, 1);
|
||||
|
|
|
|||
|
|
@ -17,12 +17,12 @@ from tests.runtime import get_runtime
|
|||
|
||||
def create_onnx_model():
|
||||
add = onnx.helper.make_node("Add", inputs=["x", "y"], outputs=["z"])
|
||||
const_tensor = onnx.helper.make_tensor("const_tensor",
|
||||
onnx.TensorProto.FLOAT,
|
||||
(2, 2),
|
||||
[0.5, 1, 1.5, 2.0])
|
||||
const_node = onnx.helper.make_node("Constant", [], outputs=["const_node"],
|
||||
value=const_tensor, name="const_node")
|
||||
const_tensor = onnx.helper.make_tensor(
|
||||
"const_tensor", onnx.TensorProto.FLOAT, (2, 2), [0.5, 1, 1.5, 2.0]
|
||||
)
|
||||
const_node = onnx.helper.make_node(
|
||||
"Constant", [], outputs=["const_node"], value=const_tensor, name="const_node"
|
||||
)
|
||||
mul = onnx.helper.make_node("Mul", inputs=["z", "const_node"], outputs=["out"])
|
||||
input_tensors = [
|
||||
make_tensor_value_info("x", onnx.TensorProto.FLOAT, (2, 2)),
|
||||
|
|
@ -72,31 +72,31 @@ def create_onnx_model_with_subgraphs():
|
|||
|
||||
|
||||
def create_onnx_model_with_custom_attributes():
|
||||
add = onnx.helper.make_node("Add", inputs=["x", "y"], outputs=["z"],
|
||||
attribute_i32=np.int32(10),
|
||||
attribute_i64=np.int64(10),
|
||||
attribute_str="string",
|
||||
attribute_f32=float(10),
|
||||
attribute_f64=np.float64(10),
|
||||
attribute_bool=True,
|
||||
attribute_type=onnx.TensorProto.INT32,
|
||||
|
||||
attribute_list_i32=np.array([1, 2, 3], dtype=np.int32),
|
||||
attribute_list_i64=np.array([1, 2, 3], dtype=np.int64),
|
||||
attribute_list_str=np.array(["a", "b", "c"], dtype=str),
|
||||
attribute_list_f32=np.array([1, 2, 3], dtype=float),
|
||||
attribute_list_f64=np.array([1, 2, 3], dtype=np.float64),
|
||||
attribute_list_bool=[True, False, True],
|
||||
attribute_list_type=np.array([onnx.TensorProto.INT32,
|
||||
onnx.TensorProto.FLOAT]),
|
||||
|
||||
)
|
||||
const_tensor = onnx.helper.make_tensor("const_tensor",
|
||||
onnx.TensorProto.FLOAT,
|
||||
(2, 2),
|
||||
[0.5, 1, 1.5, 2.0])
|
||||
const_node = onnx.helper.make_node("Constant", [], outputs=["const_node"],
|
||||
value=const_tensor, name="const_node")
|
||||
add = onnx.helper.make_node(
|
||||
"Add",
|
||||
inputs=["x", "y"],
|
||||
outputs=["z"],
|
||||
attribute_i32=np.int32(10),
|
||||
attribute_i64=np.int64(10),
|
||||
attribute_str="string",
|
||||
attribute_f32=float(10),
|
||||
attribute_f64=np.float64(10),
|
||||
attribute_bool=True,
|
||||
attribute_type=onnx.TensorProto.INT32,
|
||||
attribute_list_i32=np.array([1, 2, 3], dtype=np.int32),
|
||||
attribute_list_i64=np.array([1, 2, 3], dtype=np.int64),
|
||||
attribute_list_str=np.array(["a", "b", "c"], dtype=str),
|
||||
attribute_list_f32=np.array([1, 2, 3], dtype=float),
|
||||
attribute_list_f64=np.array([1, 2, 3], dtype=np.float64),
|
||||
attribute_list_bool=[True, False, True],
|
||||
attribute_list_type=np.array([onnx.TensorProto.INT32, onnx.TensorProto.FLOAT]),
|
||||
)
|
||||
const_tensor = onnx.helper.make_tensor(
|
||||
"const_tensor", onnx.TensorProto.FLOAT, (2, 2), [0.5, 1, 1.5, 2.0]
|
||||
)
|
||||
const_node = onnx.helper.make_node(
|
||||
"Constant", [], outputs=["const_node"], value=const_tensor, name="const_node"
|
||||
)
|
||||
mul = onnx.helper.make_node("Mul", inputs=["z", "const_node"], outputs=["out"])
|
||||
input_tensors = [
|
||||
make_tensor_value_info("x", onnx.TensorProto.FLOAT, (2, 2)),
|
||||
|
|
@ -112,45 +112,62 @@ def create_onnx_model_for_op_extension():
|
|||
elu = onnx.helper.make_node("Elu", alpha=1.0, inputs=["x"], outputs=["elu"])
|
||||
|
||||
# operation with vector<size_t>, enum, bool attributes
|
||||
avg_pool = onnx.helper.make_node("AveragePool", kernel_shape=[2, 2], auto_pad="SAME_LOWER",
|
||||
strides=[2, 2],
|
||||
inputs=["elu"], outputs=["avg_pool"])
|
||||
avg_pool = onnx.helper.make_node(
|
||||
"AveragePool",
|
||||
kernel_shape=[2, 2],
|
||||
auto_pad="SAME_LOWER",
|
||||
strides=[2, 2],
|
||||
inputs=["elu"],
|
||||
outputs=["avg_pool"],
|
||||
)
|
||||
|
||||
# operation with no attributes
|
||||
floor = onnx.helper.make_node("Floor", inputs=["avg_pool"], outputs=["floor"])
|
||||
|
||||
# operation with int64_t attribute
|
||||
concat = onnx.helper.make_node("Concat", axis=0, inputs=["floor", "avg_pool"], outputs=["concat"])
|
||||
concat = onnx.helper.make_node(
|
||||
"Concat", axis=0, inputs=["floor", "avg_pool"], outputs=["concat"]
|
||||
)
|
||||
|
||||
const_tensor = onnx.helper.make_tensor("const_tensor",
|
||||
onnx.TensorProto.FLOAT,
|
||||
[1],
|
||||
[0.5])
|
||||
const_tensor = onnx.helper.make_tensor(
|
||||
"const_tensor", onnx.TensorProto.FLOAT, [1], [0.5]
|
||||
)
|
||||
|
||||
const_node = onnx.helper.make_node("Constant", [], outputs=["const_node"],
|
||||
value=const_tensor, name="const_node")
|
||||
const_node = onnx.helper.make_node(
|
||||
"Constant", [], outputs=["const_node"], value=const_tensor, name="const_node"
|
||||
)
|
||||
# operation with enum attribute
|
||||
mul = onnx.helper.make_node("Mul", inputs=["concat", "const_node"], outputs=["mul"])
|
||||
|
||||
# operation with element::type (class) attribute
|
||||
cast = onnx.helper.make_node("Cast", to=int(onnx.TensorProto.FLOAT), inputs=["mul"], outputs=["out"])
|
||||
# operation with ov::element::type (class) attribute
|
||||
cast = onnx.helper.make_node(
|
||||
"Cast", to=int(onnx.TensorProto.FLOAT), inputs=["mul"], outputs=["out"]
|
||||
)
|
||||
input_tensors = [
|
||||
make_tensor_value_info("x", onnx.TensorProto.FLOAT, (1, 3, 32, 32)),
|
||||
]
|
||||
output_tensors = [make_tensor_value_info("out", onnx.TensorProto.FLOAT, (3, 3, 32, 32))]
|
||||
graph = make_graph([const_node, elu, avg_pool, floor, concat, mul, cast], "graph",
|
||||
input_tensors, output_tensors)
|
||||
output_tensors = [
|
||||
make_tensor_value_info("out", onnx.TensorProto.FLOAT, (3, 3, 32, 32))
|
||||
]
|
||||
graph = make_graph(
|
||||
[const_node, elu, avg_pool, floor, concat, mul, cast],
|
||||
"graph",
|
||||
input_tensors,
|
||||
output_tensors,
|
||||
)
|
||||
return make_model(graph, producer_name="ONNX Frontend")
|
||||
|
||||
|
||||
def create_onnx_model_extension_with_custom_domain():
|
||||
add = onnx.helper.make_node("CustomAdd", inputs=["x", "y"], outputs=["z"], domain="custom_domain")
|
||||
const_tensor = onnx.helper.make_tensor("const_tensor",
|
||||
onnx.TensorProto.FLOAT,
|
||||
(2, 2),
|
||||
[0.5, 1, 1.5, 2.0])
|
||||
const_node = onnx.helper.make_node("Constant", [], outputs=["const_node"],
|
||||
value=const_tensor, name="const_node")
|
||||
add = onnx.helper.make_node(
|
||||
"CustomAdd", inputs=["x", "y"], outputs=["z"], domain="custom_domain"
|
||||
)
|
||||
const_tensor = onnx.helper.make_tensor(
|
||||
"const_tensor", onnx.TensorProto.FLOAT, (2, 2), [0.5, 1, 1.5, 2.0]
|
||||
)
|
||||
const_node = onnx.helper.make_node(
|
||||
"Constant", [], outputs=["const_node"], value=const_tensor, name="const_node"
|
||||
)
|
||||
mul = onnx.helper.make_node("Mul", inputs=["z", "const_node"], outputs=["out"])
|
||||
input_tensors = [
|
||||
make_tensor_value_info("x", onnx.TensorProto.FLOAT, (2, 2)),
|
||||
|
|
@ -187,11 +204,20 @@ def setup_module():
|
|||
onnx.save_model(create_onnx_model(), onnx_model_filename)
|
||||
onnx.save_model(create_onnx_model(), model_stream)
|
||||
onnx.save_model(create_onnx_model_2(), onnx_model_2_filename)
|
||||
onnx.save_model(create_onnx_model_with_custom_attributes(),
|
||||
onnx_model_with_custom_attributes_filename)
|
||||
onnx.save_model(create_onnx_model_with_subgraphs(), onnx_model_with_subgraphs_filename)
|
||||
onnx.save_model(create_onnx_model_for_op_extension(), onnx_model_for_op_extension_test)
|
||||
onnx.save_model(create_onnx_model_extension_with_custom_domain(), onnx_model_extension_with_custom_domain)
|
||||
onnx.save_model(
|
||||
create_onnx_model_with_custom_attributes(),
|
||||
onnx_model_with_custom_attributes_filename,
|
||||
)
|
||||
onnx.save_model(
|
||||
create_onnx_model_with_subgraphs(), onnx_model_with_subgraphs_filename
|
||||
)
|
||||
onnx.save_model(
|
||||
create_onnx_model_for_op_extension(), onnx_model_for_op_extension_test
|
||||
)
|
||||
onnx.save_model(
|
||||
create_onnx_model_extension_with_custom_domain(),
|
||||
onnx_model_extension_with_custom_domain,
|
||||
)
|
||||
|
||||
|
||||
def teardown_module():
|
||||
|
|
@ -227,17 +253,28 @@ def test_convert():
|
|||
run_model(converted_model, input_1, input_2, expected=[expected])
|
||||
|
||||
|
||||
@pytest.mark.parametrize(("model_filename", "inputs", "expected"), [
|
||||
[onnx_model_filename,
|
||||
[np.array([[1, 2], [3, 4]], dtype=np.float32),
|
||||
np.array([[2, 3], [4, 5]], dtype=np.float32)],
|
||||
np.array([[1.5, 5], [10.5, 18]], dtype=np.float32)],
|
||||
[onnx_model_with_subgraphs_filename,
|
||||
[np.array(False, dtype=bool),
|
||||
np.array([1, 2, 3], dtype=np.float32),
|
||||
np.array([2, 3, 5], dtype=np.float32)],
|
||||
np.array([-1, -1, -2], dtype=np.float32)],
|
||||
])
|
||||
@pytest.mark.parametrize(
|
||||
("model_filename", "inputs", "expected"),
|
||||
[
|
||||
[
|
||||
onnx_model_filename,
|
||||
[
|
||||
np.array([[1, 2], [3, 4]], dtype=np.float32),
|
||||
np.array([[2, 3], [4, 5]], dtype=np.float32),
|
||||
],
|
||||
np.array([[1.5, 5], [10.5, 18]], dtype=np.float32),
|
||||
],
|
||||
[
|
||||
onnx_model_with_subgraphs_filename,
|
||||
[
|
||||
np.array(False, dtype=bool),
|
||||
np.array([1, 2, 3], dtype=np.float32),
|
||||
np.array([2, 3, 5], dtype=np.float32),
|
||||
],
|
||||
np.array([-1, -1, -2], dtype=np.float32),
|
||||
],
|
||||
],
|
||||
)
|
||||
def test_decode_and_convert(model_filename, inputs, expected):
|
||||
skip_if_onnx_frontend_is_disabled()
|
||||
|
||||
|
|
@ -251,13 +288,21 @@ def test_decode_and_convert(model_filename, inputs, expected):
|
|||
assert decoded_model
|
||||
|
||||
for op in decoded_model.get_ordered_ops():
|
||||
assert op.get_type_name() in ["Parameter", "Constant", "ONNXFrameworkNode",
|
||||
"ONNXSubgraphFrameworkNode", "Result"]
|
||||
assert op.get_type_name() in [
|
||||
"Parameter",
|
||||
"Constant",
|
||||
"ONNXFrameworkNode",
|
||||
"ONNXSubgraphFrameworkNode",
|
||||
"Result",
|
||||
]
|
||||
|
||||
fe.convert(decoded_model)
|
||||
assert decoded_model
|
||||
for op in decoded_model.get_ordered_ops():
|
||||
assert op.get_type_name() not in ["ONNXFrameworkNode", "ONNXSubgraphFrameworkNode"]
|
||||
assert op.get_type_name() not in [
|
||||
"ONNXFrameworkNode",
|
||||
"ONNXSubgraphFrameworkNode",
|
||||
]
|
||||
|
||||
run_model(decoded_model, *inputs, expected=[expected])
|
||||
|
||||
|
|
@ -305,16 +350,16 @@ def test_onnx_conversion_extension_check_attributes():
|
|||
check_attribute(node, "attribute_i32", int, 10)
|
||||
check_attribute(node, "attribute_i64", int, 10)
|
||||
check_attribute(node, "attribute_str", str, "string")
|
||||
check_attribute(node, "attribute_f32", float, 10.)
|
||||
check_attribute(node, "attribute_f64", float, 10.)
|
||||
check_attribute(node, "attribute_f32", float, 10.0)
|
||||
check_attribute(node, "attribute_f64", float, 10.0)
|
||||
check_attribute(node, "attribute_bool", int, 1)
|
||||
check_attribute(node, "attribute_type", int, 6)
|
||||
|
||||
check_attribute(node, "attribute_list_i32", list, [1, 2, 3])
|
||||
check_attribute(node, "attribute_list_i64", list, [1, 2, 3])
|
||||
check_attribute(node, "attribute_list_str", list, ["a", "b", "c"])
|
||||
check_attribute(node, "attribute_list_f32", list, [1., 2., 3.])
|
||||
check_attribute(node, "attribute_list_f64", list, [1., 2., 3.])
|
||||
check_attribute(node, "attribute_list_f32", list, [1.0, 2.0, 3.0])
|
||||
check_attribute(node, "attribute_list_f64", list, [1.0, 2.0, 3.0])
|
||||
check_attribute(node, "attribute_list_bool", list, [1, 0, 1])
|
||||
check_attribute(node, "attribute_list_type", list, [6, 1])
|
||||
|
||||
|
|
@ -369,12 +414,21 @@ def test_onnx_conversion_extension_attribute_with_default_value():
|
|||
|
||||
check_attribute(node, "attribute_list_i32", np.array([4, 5, 6], dtype=np.int32))
|
||||
check_attribute(node, "attribute_list_i64", np.array([4, 5, 6], dtype=np.int64))
|
||||
check_attribute(node, "attribute_list_str", np.array(["d", "e", "f"], dtype=str))
|
||||
check_attribute(
|
||||
node, "attribute_list_str", np.array(["d", "e", "f"], dtype=str)
|
||||
)
|
||||
check_attribute(node, "attribute_list_f32", np.array([4, 5, 6], dtype=float))
|
||||
check_attribute(node, "attribute_list_f64", np.array([4, 5, 6], dtype=np.float64))
|
||||
check_attribute(node, "attribute_list_bool", np.array([True, False, True], dtype=bool))
|
||||
check_attribute(node, "attribute_list_type", np.array([onnx.TensorProto.INT32,
|
||||
onnx.TensorProto.FLOAT]))
|
||||
check_attribute(
|
||||
node, "attribute_list_f64", np.array([4, 5, 6], dtype=np.float64)
|
||||
)
|
||||
check_attribute(
|
||||
node, "attribute_list_bool", np.array([True, False, True], dtype=bool)
|
||||
)
|
||||
check_attribute(
|
||||
node,
|
||||
"attribute_list_type",
|
||||
np.array([onnx.TensorProto.INT32, onnx.TensorProto.FLOAT]),
|
||||
)
|
||||
|
||||
input_1 = node.get_input(0)
|
||||
input_2 = node.get_input(1)
|
||||
|
|
@ -425,8 +479,8 @@ def test_onnx_conversion_extension_cast_attributes():
|
|||
check_attribute(node, "attribute_bool", True, bool)
|
||||
check_attribute(node, "attribute_type", Type.i32, Type)
|
||||
|
||||
check_attribute(node, "attribute_list_i32", [1., 2., 3.], float)
|
||||
check_attribute(node, "attribute_list_i64", [1., 2., 3.], float)
|
||||
check_attribute(node, "attribute_list_i32", [1.0, 2.0, 3.0], float)
|
||||
check_attribute(node, "attribute_list_i64", [1.0, 2.0, 3.0], float)
|
||||
check_attribute(node, "attribute_list_str", ["a", "b", "c"], str)
|
||||
check_attribute(node, "attribute_list_f32", [1, 2, 3], int)
|
||||
check_attribute(node, "attribute_list_f64", [1, 2, 3], int)
|
||||
|
|
@ -528,7 +582,9 @@ def test_onnx_conversion_extension_with_custom_domain():
|
|||
add = ops.add(input_1, input_2)
|
||||
return [add.output(0)]
|
||||
|
||||
fe.add_extension(ConversionExtension("CustomAdd", "custom_domain", custom_converter))
|
||||
fe.add_extension(
|
||||
ConversionExtension("CustomAdd", "custom_domain", custom_converter)
|
||||
)
|
||||
input_model = fe.load(onnx_model_extension_with_custom_domain)
|
||||
assert input_model
|
||||
model = fe.convert(input_model)
|
||||
|
|
@ -546,14 +602,20 @@ def test_onnx_op_extension_with_custom_domain():
|
|||
assert fe
|
||||
assert fe.get_name() == "onnx"
|
||||
|
||||
fe.add_extension(OpExtension("opset1.Add", "CustomAdd", "custom_domain", {}, {"auto_broadcast": "numpy"}))
|
||||
fe.add_extension(
|
||||
OpExtension(
|
||||
"opset1.Add", "CustomAdd", "custom_domain", {}, {"auto_broadcast": "numpy"}
|
||||
)
|
||||
)
|
||||
input_model = fe.load(onnx_model_extension_with_custom_domain)
|
||||
assert input_model
|
||||
model = fe.convert(input_model)
|
||||
assert model
|
||||
|
||||
|
||||
@pytest.mark.parametrize("opset_prefix", ["opset1.", "opset1::", "opset8.", "opset8::", ""])
|
||||
@pytest.mark.parametrize(
|
||||
"opset_prefix", ["opset1.", "opset1::", "opset8.", "opset8::", ""]
|
||||
)
|
||||
def test_op_extension_specify_opset(opset_prefix):
|
||||
skip_if_onnx_frontend_is_disabled()
|
||||
|
||||
|
|
@ -576,7 +638,9 @@ def test_op_extension_specify_opset(opset_prefix):
|
|||
assert model
|
||||
|
||||
|
||||
@pytest.mark.parametrize("opset_prefix", ["opset1..", "opset1:::", "opset.", "opset::", "wrong"])
|
||||
@pytest.mark.parametrize(
|
||||
"opset_prefix", ["opset1..", "opset1:::", "opset.", "opset::", "wrong"]
|
||||
)
|
||||
def test_op_extension_specify_wrong_opset(opset_prefix):
|
||||
skip_if_onnx_frontend_is_disabled()
|
||||
|
||||
|
|
@ -609,17 +673,26 @@ def test_op_extension_via_onnx_extension_set_attrs_values():
|
|||
|
||||
# add extensions
|
||||
core.add_extension(OpExtension("Multiply", "Mul", {}, {"auto_broadcast": "numpy"}))
|
||||
core.add_extension(OpExtension("Elu", {}, {"alpha": 1.}))
|
||||
core.add_extension(OpExtension("Elu", {}, {"alpha": 1.0}))
|
||||
core.add_extension(OpExtension("Floor"))
|
||||
core.add_extension(OpExtension("Concat", {}, {"axis": 0}))
|
||||
core.add_extension(OpExtension("Convert", "Cast", {}, {"destination_type": "i64"}))
|
||||
core.add_extension(OpExtension("AvgPool", "AveragePool", {}, {"kernel": [2, 2],
|
||||
"strides": [2, 2],
|
||||
"pads_begin": [0, 0],
|
||||
"pads_end": [1, 1],
|
||||
"exclude-pad": True,
|
||||
"auto_pad": "same_upper",
|
||||
"rounding_type": "floor"}))
|
||||
core.add_extension(
|
||||
OpExtension(
|
||||
"AvgPool",
|
||||
"AveragePool",
|
||||
{},
|
||||
{
|
||||
"kernel": [2, 2],
|
||||
"strides": [2, 2],
|
||||
"pads_begin": [0, 0],
|
||||
"pads_end": [1, 1],
|
||||
"exclude-pad": True,
|
||||
"auto_pad": "same_upper",
|
||||
"rounding_type": "floor",
|
||||
},
|
||||
)
|
||||
)
|
||||
|
||||
model = core.read_model(onnx_model_for_op_extension_test)
|
||||
assert model
|
||||
|
|
@ -639,17 +712,26 @@ def test_op_extension_via_frontend_extension_set_attrs_values():
|
|||
|
||||
# add extensions
|
||||
core.add_extension(OpExtension("Multiply", "Mul", {}, {"auto_broadcast": "numpy"}))
|
||||
core.add_extension(OpExtension("Elu", "Elu", {}, {"alpha": 1.}))
|
||||
core.add_extension(OpExtension("Elu", "Elu", {}, {"alpha": 1.0}))
|
||||
core.add_extension(OpExtension("Floor"))
|
||||
core.add_extension(OpExtension("Concat", {}, {"axis": 0}))
|
||||
core.add_extension(OpExtension("Convert", "Cast", {}, {"destination_type": "i64"}))
|
||||
core.add_extension(OpExtension("AvgPool", "AveragePool", {}, {"kernel": [2, 2],
|
||||
"strides": [2, 2],
|
||||
"pads_begin": [0, 0],
|
||||
"pads_end": [1, 1],
|
||||
"exclude-pad": True,
|
||||
"auto_pad": "same_upper",
|
||||
"rounding_type": "floor"}))
|
||||
core.add_extension(
|
||||
OpExtension(
|
||||
"AvgPool",
|
||||
"AveragePool",
|
||||
{},
|
||||
{
|
||||
"kernel": [2, 2],
|
||||
"strides": [2, 2],
|
||||
"pads_begin": [0, 0],
|
||||
"pads_end": [1, 1],
|
||||
"exclude-pad": True,
|
||||
"auto_pad": "same_upper",
|
||||
"rounding_type": "floor",
|
||||
},
|
||||
)
|
||||
)
|
||||
|
||||
model = core.read_model(onnx_model_for_op_extension_test)
|
||||
assert model
|
||||
|
|
@ -671,13 +753,19 @@ def test_op_extension_via_frontend_extension_map_attributes():
|
|||
core.add_extension(OpExtension("Elu", "Elu", {"alpha": "alpha"}))
|
||||
core.add_extension(OpExtension("Concat", {"axis": "axis"}, {"axis": 0}))
|
||||
|
||||
core.add_extension(OpExtension("AvgPool", "AveragePool", {"kernel": "kernel_shape",
|
||||
"strides": "strides",
|
||||
"auto_pad": "auto_pad"},
|
||||
{"pads_begin": [0, 0],
|
||||
"pads_end": [1, 1],
|
||||
"exclude-pad": True,
|
||||
"rounding_type": "floor"}))
|
||||
core.add_extension(
|
||||
OpExtension(
|
||||
"AvgPool",
|
||||
"AveragePool",
|
||||
{"kernel": "kernel_shape", "strides": "strides", "auto_pad": "auto_pad"},
|
||||
{
|
||||
"pads_begin": [0, 0],
|
||||
"pads_end": [1, 1],
|
||||
"exclude-pad": True,
|
||||
"rounding_type": "floor",
|
||||
},
|
||||
)
|
||||
)
|
||||
|
||||
model = core.read_model(onnx_model_for_op_extension_test)
|
||||
assert model
|
||||
|
|
@ -686,14 +774,18 @@ def test_op_extension_via_frontend_extension_map_attributes():
|
|||
def get_builtin_extensions_path():
|
||||
win_folder_path = Path(__file__).parent.parent.parent.parent
|
||||
linux_folder_path = win_folder_path.joinpath("lib")
|
||||
for lib_path in chain(win_folder_path.glob("*.dll"), linux_folder_path.glob("*.so")):
|
||||
for lib_path in chain(
|
||||
win_folder_path.glob("*.dll"), linux_folder_path.glob("*.so")
|
||||
):
|
||||
if "libtest_builtin_extensions" in lib_path.name:
|
||||
return str(lib_path)
|
||||
return ""
|
||||
|
||||
|
||||
@pytest.mark.skipif(len(get_builtin_extensions_path()) == 0,
|
||||
reason="The extension library path was not found")
|
||||
@pytest.mark.skipif(
|
||||
len(get_builtin_extensions_path()) == 0,
|
||||
reason="The extension library path was not found",
|
||||
)
|
||||
def test_so_extension_via_frontend_convert_input_model():
|
||||
skip_if_onnx_frontend_is_disabled()
|
||||
|
||||
|
|
@ -709,8 +801,10 @@ def test_so_extension_via_frontend_convert_input_model():
|
|||
assert all(op.get_type_name() != "Relu" for op in model.get_ops())
|
||||
|
||||
|
||||
@pytest.mark.skipif(len(get_builtin_extensions_path()) == 0,
|
||||
reason="The extension library path was not found")
|
||||
@pytest.mark.skipif(
|
||||
len(get_builtin_extensions_path()) == 0,
|
||||
reason="The extension library path was not found",
|
||||
)
|
||||
def test_so_extension_via_frontend_decode_input_model():
|
||||
skip_if_onnx_frontend_is_disabled()
|
||||
|
||||
|
|
@ -720,7 +814,9 @@ def test_so_extension_via_frontend_decode_input_model():
|
|||
in_model = fe.load(onnx_model_2_filename)
|
||||
return fe.decode(in_model)
|
||||
|
||||
decoded_model = load_decoded_model() # decoded model has longer lifetime than frontend
|
||||
decoded_model = (
|
||||
load_decoded_model()
|
||||
) # decoded model has longer lifetime than frontend
|
||||
assert decoded_model
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -109,15 +109,15 @@ void CNNNetworkNGraphImpl::validateFunctionNames() const {
|
|||
}
|
||||
}
|
||||
|
||||
ngraph::element::Type details::toLegacyType(const ngraph::element::Type& ngraph_type, bool input) {
|
||||
ov::element::Type details::toLegacyType(const ov::element::Type& ngraph_type, bool input) {
|
||||
if (input) {
|
||||
return ngraph_type == ngraph::element::f16 ? ngraph::element::f32 : ngraph_type;
|
||||
return ngraph_type == ov::element::f16 ? ov::element::f32 : ngraph_type;
|
||||
} else {
|
||||
if (ngraph_type == ngraph::element::i64 || ngraph_type == ngraph::element::u64 ||
|
||||
ngraph_type == ngraph::element::i32 || ngraph_type == ngraph::element::u32) {
|
||||
return ngraph::element::i32;
|
||||
} else if (ngraph_type != ngraph::element::f32) {
|
||||
return ngraph::element::f32;
|
||||
if (ngraph_type == ov::element::i64 || ngraph_type == ov::element::u64 || ngraph_type == ov::element::i32 ||
|
||||
ngraph_type == ov::element::u32) {
|
||||
return ov::element::i32;
|
||||
} else if (ngraph_type != ov::element::f32) {
|
||||
return ov::element::f32;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ CNNNetwork convert_to_cnnnetwork(std::shared_ptr<ov::Model>& function, bool is_n
|
|||
// In the following code we add Convert node from old_api_map_type to Parameter type
|
||||
// using PrePostProcessor. As some plugins do not support uint8 type, Convert to uint8 leads
|
||||
// to error, so for such case type is set directly to Parameter node instead of inserting Convert.
|
||||
if ((param_type == ngraph::element::u8 && old_api_map_type.is_real())) {
|
||||
if ((param_type == ov::element::u8 && old_api_map_type.is_real())) {
|
||||
parameter->set_element_type(old_api_map_type);
|
||||
need_validate_nodes_and_infer_types = true;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -18,46 +18,35 @@ const std::vector<ov::PartialShape> inputShapes = {
|
|||
};
|
||||
|
||||
const std::vector<MultiplyToGroupConvolutionTransformationParam> params = {
|
||||
{
|
||||
{ 256ul, ov::Shape { 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 25.5f } },
|
||||
{{1.f, 2.f, 3.f}, element::f32, Shape{1, 3, 1, 1}},
|
||||
"output/GroupConvolution",
|
||||
"U8",
|
||||
true
|
||||
},
|
||||
{{256ul, ov::Shape{1, 1, 1, 1}, {0.f}, {25.5f}, {0.f}, {25.5f}},
|
||||
{{1.f, 2.f, 3.f}, ov::element::f32, Shape{1, 3, 1, 1}},
|
||||
"output/GroupConvolution",
|
||||
"U8",
|
||||
true},
|
||||
// Multiply with scalar is not transformed to GroupConvolution
|
||||
{
|
||||
{ 256ul, ov::Shape { 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 25.5f } },
|
||||
{{4.f}, element::f32, Shape{1, 1, 1, 1}},
|
||||
"output/GroupConvolution",
|
||||
"",
|
||||
true
|
||||
},
|
||||
{{256ul, ov::Shape{1, 1, 1, 1}, {0.f}, {25.5f}, {0.f}, {25.5f}},
|
||||
{{4.f}, ov::element::f32, Shape{1, 1, 1, 1}},
|
||||
"output/GroupConvolution",
|
||||
"",
|
||||
true},
|
||||
// Multiply with scalar is not transformed to GroupConvolution
|
||||
{
|
||||
{ 256ul, ov::Shape { 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 25.5f } },
|
||||
{{4.f}, element::f32, Shape{}},
|
||||
"output/GroupConvolution",
|
||||
"",
|
||||
true
|
||||
},
|
||||
{{256ul, ov::Shape{1, 1, 1, 1}, {0.f}, {25.5f}, {0.f}, {25.5f}},
|
||||
{{4.f}, ov::element::f32, Shape{}},
|
||||
"output/GroupConvolution",
|
||||
"",
|
||||
true},
|
||||
// Zero point
|
||||
{
|
||||
{ 256ul, ov::Shape { 1, 1, 1, 1 }, { -1.28f }, { 1.27f }, { -1.28f }, { 1.27f } },
|
||||
{{1.f, 2.f, 3.f}, element::f32, Shape{1, 3, 1, 1}},
|
||||
"output/GroupConvolution",
|
||||
"U8",
|
||||
true
|
||||
},
|
||||
{{256ul, ov::Shape{1, 1, 1, 1}, {-1.28f}, {1.27f}, {-1.28f}, {1.27f}},
|
||||
{{1.f, 2.f, 3.f}, ov::element::f32, Shape{1, 3, 1, 1}},
|
||||
"output/GroupConvolution",
|
||||
"U8",
|
||||
true},
|
||||
// Zero point
|
||||
{
|
||||
{ 256ul, ov::Shape { 1, 1, 1, 1 }, { -1.28f }, { 1.27f / 2.f }, { -1.28f }, { 1.27f / 2.f} },
|
||||
{{1.f, 2.f, 3.f}, element::f32, Shape{1, 3, 1, 1}},
|
||||
"output/GroupConvolution",
|
||||
"U8",
|
||||
true
|
||||
}
|
||||
};
|
||||
{{256ul, ov::Shape{1, 1, 1, 1}, {-1.28f}, {1.27f / 2.f}, {-1.28f}, {1.27f / 2.f}},
|
||||
{{1.f, 2.f, 3.f}, ov::element::f32, Shape{1, 3, 1, 1}},
|
||||
"output/GroupConvolution",
|
||||
"U8",
|
||||
true}};
|
||||
|
||||
//Comment out the tests because of the transformation is disabled by another WR
|
||||
/*
|
||||
|
|
@ -78,41 +67,30 @@ const std::vector<ov::PartialShape> inputShapes = {
|
|||
};
|
||||
|
||||
const std::vector<MultiplyToGroupConvolutionTransformationParam> params = {
|
||||
{
|
||||
{ 256ul, ov::Shape { 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 25.5f } },
|
||||
{{1.f, 2.f, 3.f}, element::f32, Shape{1, 3, 1, 1, 1}},
|
||||
"output/GroupConvolution",
|
||||
"U8"
|
||||
},
|
||||
{{256ul, ov::Shape{1, 1, 1, 1}, {0.f}, {25.5f}, {0.f}, {25.5f}},
|
||||
{{1.f, 2.f, 3.f}, ov::element::f32, Shape{1, 3, 1, 1, 1}},
|
||||
"output/GroupConvolution",
|
||||
"U8"},
|
||||
// Multiply with scalar is not transformed to GroupConvolution
|
||||
{
|
||||
{ 256ul, ov::Shape { 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 25.5f } },
|
||||
{{4.f}, element::f32, Shape{1, 1, 1, 1, 1}},
|
||||
"output/GroupConvolution",
|
||||
""
|
||||
},
|
||||
{{256ul, ov::Shape{1, 1, 1, 1}, {0.f}, {25.5f}, {0.f}, {25.5f}},
|
||||
{{4.f}, ov::element::f32, Shape{1, 1, 1, 1, 1}},
|
||||
"output/GroupConvolution",
|
||||
""},
|
||||
// Multiply with scalar is not transformed to GroupConvolution
|
||||
{
|
||||
{ 256ul, ov::Shape { 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 25.5f } },
|
||||
{{4.f}, element::f32, Shape{}},
|
||||
"output/GroupConvolution",
|
||||
""
|
||||
},
|
||||
{{256ul, ov::Shape{1, 1, 1, 1}, {0.f}, {25.5f}, {0.f}, {25.5f}},
|
||||
{{4.f}, ov::element::f32, Shape{}},
|
||||
"output/GroupConvolution",
|
||||
""},
|
||||
// Zero point
|
||||
{
|
||||
{ 256ul, ov::Shape { 1, 1, 1, 1 }, { -1.28f }, { 1.27f }, { -1.28f }, { 1.27f } },
|
||||
{{1.f, 2.f, 3.f}, element::f32, Shape{1, 3, 1, 1, 1}},
|
||||
"output/GroupConvolution",
|
||||
"U8"
|
||||
},
|
||||
{{256ul, ov::Shape{1, 1, 1, 1}, {-1.28f}, {1.27f}, {-1.28f}, {1.27f}},
|
||||
{{1.f, 2.f, 3.f}, ov::element::f32, Shape{1, 3, 1, 1, 1}},
|
||||
"output/GroupConvolution",
|
||||
"U8"},
|
||||
// Zero point
|
||||
{
|
||||
{ 256ul, ov::Shape { 1, 1, 1, 1 }, { -1.28f }, { 1.27f / 2.f }, { -1.28f }, { 1.27f / 2.f} },
|
||||
{{1.f, 2.f, 3.f}, element::f32, Shape{1, 3, 1, 1, 1}},
|
||||
"output/GroupConvolution",
|
||||
"U8"
|
||||
}
|
||||
};
|
||||
{{256ul, ov::Shape{1, 1, 1, 1}, {-1.28f}, {1.27f / 2.f}, {-1.28f}, {1.27f / 2.f}},
|
||||
{{1.f, 2.f, 3.f}, ov::element::f32, Shape{1, 3, 1, 1, 1}},
|
||||
"output/GroupConvolution",
|
||||
"U8"}};
|
||||
|
||||
//Comment out the tests because of the transformation is disabled by another WR
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ auto configs = []() {
|
|||
|
||||
std::shared_ptr<ngraph::Function> getFunction1() {
|
||||
const std::vector<size_t> inputShape = {1, 4, 20, 20};
|
||||
const ngraph::element::Type_t ngPrc = ngraph::element::Type_t::f32;
|
||||
const ov::element::Type_t ngPrc = ov::element::Type_t::f32;
|
||||
|
||||
ov::ParameterVector params{std::make_shared<ov::op::v0::Parameter>(ngPrc, ov::Shape(inputShape))};
|
||||
params.front()->set_friendly_name("Param_1");
|
||||
|
|
|
|||
|
|
@ -7,75 +7,75 @@
|
|||
using namespace ov::test::behavior;
|
||||
|
||||
namespace {
|
||||
static const std::vector<ngraph::element::Type> precisionsGPU = {
|
||||
ngraph::element::f32,
|
||||
ngraph::element::f16,
|
||||
ngraph::element::i32,
|
||||
ngraph::element::i64,
|
||||
ngraph::element::i8,
|
||||
ngraph::element::u8,
|
||||
ngraph::element::i16,
|
||||
ngraph::element::u16,
|
||||
};
|
||||
static const std::vector<ov::element::Type> precisionsGPU = {
|
||||
ov::element::f32,
|
||||
ov::element::f16,
|
||||
ov::element::i32,
|
||||
ov::element::i64,
|
||||
ov::element::i8,
|
||||
ov::element::u8,
|
||||
ov::element::i16,
|
||||
ov::element::u16,
|
||||
};
|
||||
|
||||
static const std::vector<std::size_t> batchSizesGPU = {
|
||||
1, 2
|
||||
};
|
||||
static const std::vector<std::size_t> batchSizesGPU = {1, 2};
|
||||
|
||||
static const std::vector<ov::element::Type> floatingPointPrecisionsGPU = {
|
||||
ngraph::element::f32,
|
||||
ngraph::element::f16,
|
||||
};
|
||||
static const std::vector<ov::element::Type> floatingPointPrecisionsGPU = {
|
||||
ov::element::f32,
|
||||
ov::element::f16,
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_CachingSupportCaseAnyType_GPU, CompileModelCacheTestBase,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(CompileModelCacheTestBase::getNumericAnyTypeFunctions()),
|
||||
::testing::ValuesIn(precisionsGPU),
|
||||
::testing::ValuesIn(batchSizesGPU),
|
||||
::testing::Values(ov::test::utils::DEVICE_GPU),
|
||||
::testing::Values(ov::AnyMap{})),
|
||||
CompileModelCacheTestBase::getTestCaseName);
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
smoke_CachingSupportCaseAnyType_GPU,
|
||||
CompileModelCacheTestBase,
|
||||
::testing::Combine(::testing::ValuesIn(CompileModelCacheTestBase::getNumericAnyTypeFunctions()),
|
||||
::testing::ValuesIn(precisionsGPU),
|
||||
::testing::ValuesIn(batchSizesGPU),
|
||||
::testing::Values(ov::test::utils::DEVICE_GPU),
|
||||
::testing::Values(ov::AnyMap{})),
|
||||
CompileModelCacheTestBase::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_CachingSupportCaseFloat_GPU, CompileModelCacheTestBase,
|
||||
::testing::Combine(
|
||||
::testing::ValuesIn(CompileModelCacheTestBase::getFloatingPointOnlyFunctions()),
|
||||
::testing::ValuesIn(floatingPointPrecisionsGPU),
|
||||
::testing::ValuesIn(batchSizesGPU),
|
||||
::testing::Values(ov::test::utils::DEVICE_GPU),
|
||||
::testing::Values(ov::AnyMap{})),
|
||||
CompileModelCacheTestBase::getTestCaseName);
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
smoke_CachingSupportCaseFloat_GPU,
|
||||
CompileModelCacheTestBase,
|
||||
::testing::Combine(::testing::ValuesIn(CompileModelCacheTestBase::getFloatingPointOnlyFunctions()),
|
||||
::testing::ValuesIn(floatingPointPrecisionsGPU),
|
||||
::testing::ValuesIn(batchSizesGPU),
|
||||
::testing::Values(ov::test::utils::DEVICE_GPU),
|
||||
::testing::Values(ov::AnyMap{})),
|
||||
CompileModelCacheTestBase::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_KernelCachingSupportCase_GPU, CompiledKernelsCacheTest,
|
||||
::testing::Combine(
|
||||
::testing::Values(ov::test::utils::DEVICE_GPU),
|
||||
::testing::Values(std::make_pair(ov::AnyMap{}, "blob"))),
|
||||
CompiledKernelsCacheTest::getTestCaseName);
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_KernelCachingSupportCase_GPU,
|
||||
CompiledKernelsCacheTest,
|
||||
::testing::Combine(::testing::Values(ov::test::utils::DEVICE_GPU),
|
||||
::testing::Values(std::make_pair(ov::AnyMap{}, "blob"))),
|
||||
CompiledKernelsCacheTest::getTestCaseName);
|
||||
|
||||
const std::vector<ov::AnyMap> GPULoadFromFileConfigs = {
|
||||
{ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT)},
|
||||
{ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY)},
|
||||
{},
|
||||
};
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_CachingSupportCase_GPU, CompileModelLoadFromFileTestBase,
|
||||
::testing::Combine(
|
||||
::testing::Values(ov::test::utils::DEVICE_GPU),
|
||||
::testing::ValuesIn(GPULoadFromFileConfigs)),
|
||||
CompileModelLoadFromFileTestBase::getTestCaseName);
|
||||
const std::vector<ov::AnyMap> GPULoadFromFileConfigs = {
|
||||
{ov::hint::performance_mode(ov::hint::PerformanceMode::THROUGHPUT)},
|
||||
{ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY)},
|
||||
{},
|
||||
};
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_CachingSupportCase_GPU,
|
||||
CompileModelLoadFromFileTestBase,
|
||||
::testing::Combine(::testing::Values(ov::test::utils::DEVICE_GPU),
|
||||
::testing::ValuesIn(GPULoadFromFileConfigs)),
|
||||
CompileModelLoadFromFileTestBase::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_CachingSupportCase_GPU,
|
||||
CompileModelCacheRuntimePropertiesTestBase,
|
||||
::testing::Combine(::testing::Values(ov::test::utils::DEVICE_GPU),
|
||||
::testing::ValuesIn(GPULoadFromFileConfigs)),
|
||||
CompileModelCacheRuntimePropertiesTestBase::getTestCaseName);
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_CachingSupportCase_GPU,
|
||||
CompileModelCacheRuntimePropertiesTestBase,
|
||||
::testing::Combine(::testing::Values(ov::test::utils::DEVICE_GPU),
|
||||
::testing::ValuesIn(GPULoadFromFileConfigs)),
|
||||
CompileModelCacheRuntimePropertiesTestBase::getTestCaseName);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_CachingSupportCase_GPU,
|
||||
CompileModelLoadFromMemoryTestBase,
|
||||
::testing::Combine(::testing::Values(ov::test::utils::DEVICE_GPU),
|
||||
::testing::ValuesIn(GPULoadFromFileConfigs)),
|
||||
CompileModelLoadFromMemoryTestBase::getTestCaseName);
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_CachingSupportCase_GPU,
|
||||
CompileModelLoadFromCacheTest,
|
||||
::testing::Combine(::testing::Values(ov::test::utils::DEVICE_GPU),
|
||||
::testing::ValuesIn(GPULoadFromFileConfigs)),
|
||||
CompileModelLoadFromCacheTest::getTestCaseName);
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_CachingSupportCase_GPU,
|
||||
CompileModelLoadFromMemoryTestBase,
|
||||
::testing::Combine(::testing::Values(ov::test::utils::DEVICE_GPU),
|
||||
::testing::ValuesIn(GPULoadFromFileConfigs)),
|
||||
CompileModelLoadFromMemoryTestBase::getTestCaseName);
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_CachingSupportCase_GPU,
|
||||
CompileModelLoadFromCacheTest,
|
||||
::testing::Combine(::testing::Values(ov::test::utils::DEVICE_GPU),
|
||||
::testing::ValuesIn(GPULoadFromFileConfigs)),
|
||||
CompileModelLoadFromCacheTest::getTestCaseName);
|
||||
} // namespace
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue