Remove legacy API from op/util (#18951)
This commit is contained in:
parent
fb45deb65e
commit
e64f84d88e
@ -2,15 +2,13 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "ngraph/axis_vector.hpp"
|
||||
#include "openvino/core/axis_vector.hpp"
|
||||
|
||||
#include "ngraph/util.hpp"
|
||||
#include "openvino/util/common_util.hpp"
|
||||
|
||||
std::ostream& ov::operator<<(std::ostream& s, const AxisVector& axis_vector) {
|
||||
s << "AxisVector{";
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
s << ngraph::join(axis_vector);
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
s << ov::util::join(axis_vector);
|
||||
s << "}";
|
||||
return s;
|
||||
}
|
||||
|
@ -2,38 +2,36 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "ngraph/op/util/activation_functions.hpp"
|
||||
#include "openvino/op/util/activation_functions.hpp"
|
||||
|
||||
#include <cmath>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "ngraph/op/constant.hpp"
|
||||
#include "ngraph/op/hard_sigmoid.hpp"
|
||||
#include "ngraph/op/relu.hpp"
|
||||
#include "ngraph/op/sigmoid.hpp"
|
||||
#include "ngraph/op/tanh.hpp"
|
||||
#include "openvino/op/constant.hpp"
|
||||
#include "openvino/op/hard_sigmoid.hpp"
|
||||
#include "openvino/op/relu.hpp"
|
||||
#include "openvino/op/sigmoid.hpp"
|
||||
#include "openvino/op/tanh.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
static shared_ptr<ov::Node> sigmoid(const shared_ptr<ov::Node>& arg, float /* alpha */, float /* beta */) {
|
||||
return make_shared<ngraph::op::Sigmoid>(arg);
|
||||
static std::shared_ptr<ov::Node> sigmoid(const std::shared_ptr<ov::Node>& arg, float /* alpha */, float /* beta */) {
|
||||
return std::make_shared<ov::op::v0::Sigmoid>(arg);
|
||||
}
|
||||
|
||||
static shared_ptr<ov::Node> tanh(const shared_ptr<ov::Node>& arg, float /* alpha */, float /* beta */) {
|
||||
return make_shared<ngraph::op::Tanh>(arg);
|
||||
static std::shared_ptr<ov::Node> tanh(const std::shared_ptr<ov::Node>& arg, float /* alpha */, float /* beta */) {
|
||||
return std::make_shared<ov::op::v0::Tanh>(arg);
|
||||
}
|
||||
|
||||
static shared_ptr<ov::Node> relu(const shared_ptr<ov::Node>& arg, float /* alpha */, float /* beta */) {
|
||||
return make_shared<ngraph::op::Relu>(arg);
|
||||
static std::shared_ptr<ov::Node> relu(const std::shared_ptr<ov::Node>& arg, float /* alpha */, float /* beta */) {
|
||||
return std::make_shared<ov::op::v0::Relu>(arg);
|
||||
}
|
||||
|
||||
static shared_ptr<ov::Node> hardsigmoid(const shared_ptr<ov::Node>& arg, float alpha, float beta) {
|
||||
const auto alpha_node = ngraph::op::Constant::create<float>(arg->get_element_type(), ngraph::Shape{}, {alpha});
|
||||
const auto beta_node = ngraph::op::Constant::create<float>(arg->get_element_type(), ngraph::Shape{}, {beta});
|
||||
static std::shared_ptr<ov::Node> hardsigmoid(const std::shared_ptr<ov::Node>& arg, float alpha, float beta) {
|
||||
const auto alpha_node = ov::op::v0::Constant::create<float>(arg->get_element_type(), ov::Shape{}, {alpha});
|
||||
const auto beta_node = ov::op::v0::Constant::create<float>(arg->get_element_type(), ov::Shape{}, {beta});
|
||||
|
||||
return make_shared<ngraph::op::HardSigmoid>(arg, alpha_node, beta_node);
|
||||
return std::make_shared<ov::op::v0::HardSigmoid>(arg, alpha_node, beta_node);
|
||||
}
|
||||
|
||||
ov::op::util::ActivationFunction::ActivationFunction(ActivationFunctionType f, float alpha, float beta)
|
||||
@ -47,12 +45,12 @@ ov::op::util::ActivationFunction::ActivationFunction(ActivationFunctionType f, f
|
||||
ov::op::util::ActivationFunction::ActivationFunction(ActivationFunctionType f)
|
||||
: ActivationFunction(f, nanf(""), nanf("")) {}
|
||||
|
||||
shared_ptr<ov::Node> ov::op::util::ActivationFunction::operator()(const shared_ptr<Node>& arg) const {
|
||||
std::shared_ptr<ov::Node> ov::op::util::ActivationFunction::operator()(const std::shared_ptr<Node>& arg) const {
|
||||
return m_function(arg, m_alpha, m_beta);
|
||||
}
|
||||
|
||||
ov::op::util::ActivationFunction ov::op::util::get_activation_func_by_name(const string& func_name) {
|
||||
using ActivationFunctionMap = unordered_map<string, op::util::ActivationFunction>;
|
||||
ov::op::util::ActivationFunction ov::op::util::get_activation_func_by_name(const std::string& func_name) {
|
||||
using ActivationFunctionMap = std::unordered_map<std::string, op::util::ActivationFunction>;
|
||||
|
||||
static ActivationFunctionMap func_map{
|
||||
{"sigmoid", op::util::ActivationFunction{sigmoid}},
|
||||
|
@ -2,12 +2,9 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "ngraph/op/util/arithmetic_reduction.hpp"
|
||||
#include "openvino/op/util/arithmetic_reduction.hpp"
|
||||
|
||||
#include "itt.hpp"
|
||||
#include "ngraph/validation_util.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
ov::op::util::ArithmeticReduction::ArithmeticReduction() = default;
|
||||
|
||||
|
@ -2,19 +2,13 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "ngraph/op/util/arithmetic_reductions_keep_dims.hpp"
|
||||
#include "openvino/op/util/arithmetic_reductions_keep_dims.hpp"
|
||||
|
||||
#include "itt.hpp"
|
||||
#include "ngraph/attribute_visitor.hpp"
|
||||
#include "ngraph/op/constant.hpp"
|
||||
#include "ngraph/validation_util.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
ov::op::util::ArithmeticReductionKeepDims::ArithmeticReductionKeepDims(
|
||||
const ngraph::Output<ngraph::Node>& arg,
|
||||
const ngraph::Output<ngraph::Node>& reduction_axes,
|
||||
bool keep_dims)
|
||||
ov::op::util::ArithmeticReductionKeepDims::ArithmeticReductionKeepDims(const ov::Output<ov::Node>& arg,
|
||||
const ov::Output<ov::Node>& reduction_axes,
|
||||
bool keep_dims)
|
||||
: ArithmeticReduction(arg, reduction_axes),
|
||||
m_keep_dims{keep_dims} {}
|
||||
|
||||
|
@ -2,109 +2,105 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "ngraph/op/util/attr_types.hpp"
|
||||
#include "openvino/op/util/attr_types.hpp"
|
||||
|
||||
#include <cctype>
|
||||
#include <map>
|
||||
|
||||
#include "ngraph/attribute_visitor.hpp"
|
||||
#include "ngraph/check.hpp"
|
||||
#include "ngraph/enum_names.hpp"
|
||||
#include "openvino/core/except.hpp"
|
||||
|
||||
namespace ov {
|
||||
|
||||
template <>
|
||||
NGRAPH_API EnumNames<ngraph::op::PadMode>& EnumNames<ngraph::op::PadMode>::get() {
|
||||
static auto enum_names = EnumNames<ngraph::op::PadMode>("ngraph::op::PadMode",
|
||||
{{"constant", ngraph::op::PadMode::CONSTANT},
|
||||
{"edge", ngraph::op::PadMode::EDGE},
|
||||
{"reflect", ngraph::op::PadMode::REFLECT},
|
||||
{"symmetric", ngraph::op::PadMode::SYMMETRIC}});
|
||||
OPENVINO_API EnumNames<ov::op::PadMode>& EnumNames<ov::op::PadMode>::get() {
|
||||
static auto enum_names = EnumNames<ov::op::PadMode>("ov::op::PadMode",
|
||||
{{"constant", ov::op::PadMode::CONSTANT},
|
||||
{"edge", ov::op::PadMode::EDGE},
|
||||
{"reflect", ov::op::PadMode::REFLECT},
|
||||
{"symmetric", ov::op::PadMode::SYMMETRIC}});
|
||||
return enum_names;
|
||||
}
|
||||
|
||||
template <>
|
||||
NGRAPH_API EnumNames<ngraph::op::PadType>& EnumNames<ngraph::op::PadType>::get() {
|
||||
static auto enum_names = EnumNames<ngraph::op::PadType>("ngraph::op::PadType",
|
||||
{{"explicit", ngraph::op::PadType::EXPLICIT},
|
||||
{"same_lower", ngraph::op::PadType::SAME_LOWER},
|
||||
{"same_upper", ngraph::op::PadType::SAME_UPPER},
|
||||
{"valid", ngraph::op::PadType::VALID}});
|
||||
OPENVINO_API EnumNames<ov::op::PadType>& EnumNames<ov::op::PadType>::get() {
|
||||
static auto enum_names = EnumNames<ov::op::PadType>("ov::op::PadType",
|
||||
{{"explicit", ov::op::PadType::EXPLICIT},
|
||||
{"same_lower", ov::op::PadType::SAME_LOWER},
|
||||
{"same_upper", ov::op::PadType::SAME_UPPER},
|
||||
{"valid", ov::op::PadType::VALID}});
|
||||
return enum_names;
|
||||
}
|
||||
|
||||
template <>
|
||||
NGRAPH_API EnumNames<ngraph::op::RoundingType>& EnumNames<ngraph::op::RoundingType>::get() {
|
||||
static auto enum_names = EnumNames<ngraph::op::RoundingType>(
|
||||
"ngraph::op::RoundingType",
|
||||
{{"floor", ngraph::op::RoundingType::FLOOR}, {"ceil", ngraph::op::RoundingType::CEIL}});
|
||||
return enum_names;
|
||||
}
|
||||
|
||||
template <>
|
||||
NGRAPH_API EnumNames<ngraph::op::AutoBroadcastType>& EnumNames<ngraph::op::AutoBroadcastType>::get() {
|
||||
OPENVINO_API EnumNames<ov::op::RoundingType>& EnumNames<ov::op::RoundingType>::get() {
|
||||
static auto enum_names =
|
||||
EnumNames<ngraph::op::AutoBroadcastType>("ngraph::op::AutoBroadcastType",
|
||||
{{"none", ngraph::op::AutoBroadcastType::NONE},
|
||||
{"explicit", ngraph::op::AutoBroadcastType::EXPLICIT},
|
||||
{"numpy", ngraph::op::AutoBroadcastType::NUMPY},
|
||||
{"pdpd", ngraph::op::AutoBroadcastType::PDPD}});
|
||||
EnumNames<ov::op::RoundingType>("ov::op::RoundingType",
|
||||
{{"floor", ov::op::RoundingType::FLOOR}, {"ceil", ov::op::RoundingType::CEIL}});
|
||||
return enum_names;
|
||||
}
|
||||
|
||||
template <>
|
||||
NGRAPH_API EnumNames<ngraph::op::BroadcastType>& EnumNames<ngraph::op::BroadcastType>::get() {
|
||||
OPENVINO_API EnumNames<ov::op::AutoBroadcastType>& EnumNames<ov::op::AutoBroadcastType>::get() {
|
||||
static auto enum_names = EnumNames<ov::op::AutoBroadcastType>("ov::op::AutoBroadcastType",
|
||||
{{"none", ov::op::AutoBroadcastType::NONE},
|
||||
{"explicit", ov::op::AutoBroadcastType::EXPLICIT},
|
||||
{"numpy", ov::op::AutoBroadcastType::NUMPY},
|
||||
{"pdpd", ov::op::AutoBroadcastType::PDPD}});
|
||||
return enum_names;
|
||||
}
|
||||
|
||||
template <>
|
||||
OPENVINO_API EnumNames<ov::op::BroadcastType>& EnumNames<ov::op::BroadcastType>::get() {
|
||||
static auto enum_names =
|
||||
EnumNames<ngraph::op::BroadcastType>("ngraph::op::BroadcastType",
|
||||
{{"explicit", ngraph::op::BroadcastType::EXPLICIT},
|
||||
{"none", ngraph::op::BroadcastType::NONE},
|
||||
{"numpy", ngraph::op::BroadcastType::NUMPY},
|
||||
{"pdpd", ngraph::op::BroadcastType::PDPD},
|
||||
{"bidirectional", ngraph::op::BroadcastType::BIDIRECTIONAL}});
|
||||
EnumNames<ov::op::BroadcastType>("ov::op::BroadcastType",
|
||||
{{"explicit", ov::op::BroadcastType::EXPLICIT},
|
||||
{"none", ov::op::BroadcastType::NONE},
|
||||
{"numpy", ov::op::BroadcastType::NUMPY},
|
||||
{"pdpd", ov::op::BroadcastType::PDPD},
|
||||
{"bidirectional", ov::op::BroadcastType::BIDIRECTIONAL}});
|
||||
return enum_names;
|
||||
}
|
||||
|
||||
template <>
|
||||
NGRAPH_API EnumNames<ngraph::op::EpsMode>& EnumNames<ngraph::op::EpsMode>::get() {
|
||||
OPENVINO_API EnumNames<ov::op::EpsMode>& EnumNames<ov::op::EpsMode>::get() {
|
||||
static auto enum_names =
|
||||
EnumNames<ngraph::op::EpsMode>("ngraph::op::EpsMode",
|
||||
{{"add", ngraph::op::EpsMode::ADD}, {"max", ngraph::op::EpsMode::MAX}});
|
||||
EnumNames<ov::op::EpsMode>("ov::op::EpsMode", {{"add", ov::op::EpsMode::ADD}, {"max", ov::op::EpsMode::MAX}});
|
||||
return enum_names;
|
||||
}
|
||||
|
||||
template <>
|
||||
NGRAPH_API EnumNames<ngraph::op::TopKSortType>& EnumNames<ngraph::op::TopKSortType>::get() {
|
||||
static auto enum_names = EnumNames<ngraph::op::TopKSortType>("ngraph::op::TopKSortType",
|
||||
{{"none", ngraph::op::TopKSortType::NONE},
|
||||
{"index", ngraph::op::TopKSortType::SORT_INDICES},
|
||||
{"value", ngraph::op::TopKSortType::SORT_VALUES}});
|
||||
OPENVINO_API EnumNames<ov::op::TopKSortType>& EnumNames<ov::op::TopKSortType>::get() {
|
||||
static auto enum_names = EnumNames<ov::op::TopKSortType>("ov::op::TopKSortType",
|
||||
{{"none", ov::op::TopKSortType::NONE},
|
||||
{"index", ov::op::TopKSortType::SORT_INDICES},
|
||||
{"value", ov::op::TopKSortType::SORT_VALUES}});
|
||||
return enum_names;
|
||||
}
|
||||
template <>
|
||||
NGRAPH_API EnumNames<ngraph::op::TopKMode>& EnumNames<ngraph::op::TopKMode>::get() {
|
||||
OPENVINO_API EnumNames<ov::op::TopKMode>& EnumNames<ov::op::TopKMode>::get() {
|
||||
static auto enum_names =
|
||||
EnumNames<ngraph::op::TopKMode>("ngraph::op::TopKMode",
|
||||
{{"min", ngraph::op::TopKMode::MIN}, {"max", ngraph::op::TopKMode::MAX}});
|
||||
EnumNames<ov::op::TopKMode>("ov::op::TopKMode",
|
||||
{{"min", ov::op::TopKMode::MIN}, {"max", ov::op::TopKMode::MAX}});
|
||||
return enum_names;
|
||||
}
|
||||
|
||||
bool AttributeAdapter<ngraph::op::AutoBroadcastSpec>::visit_attributes(AttributeVisitor& visitor) {
|
||||
bool AttributeAdapter<ov::op::AutoBroadcastSpec>::visit_attributes(AttributeVisitor& visitor) {
|
||||
// Maintain back-compatibility
|
||||
std::string name = visitor.finish_structure();
|
||||
visitor.on_attribute(name, m_ref.m_type);
|
||||
visitor.start_structure(name);
|
||||
if (m_ref.m_type == ngraph::op::AutoBroadcastType::PDPD) {
|
||||
if (m_ref.m_type == ov::op::AutoBroadcastType::PDPD) {
|
||||
visitor.on_attribute("auto_broadcast_axis", m_ref.m_axis);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AttributeAdapter<ngraph::op::BroadcastModeSpec>::visit_attributes(AttributeVisitor& visitor) {
|
||||
bool AttributeAdapter<ov::op::BroadcastModeSpec>::visit_attributes(AttributeVisitor& visitor) {
|
||||
// Maintain back-compatibility
|
||||
std::string name = visitor.finish_structure();
|
||||
visitor.on_attribute(name, m_ref.m_type);
|
||||
visitor.start_structure(name);
|
||||
if (m_ref.m_type == ngraph::op::BroadcastType::PDPD) {
|
||||
if (m_ref.m_type == ov::op::BroadcastType::PDPD) {
|
||||
visitor.start_structure(name);
|
||||
visitor.on_attribute("axis", m_ref.m_axis);
|
||||
visitor.finish_structure();
|
||||
@ -113,44 +109,44 @@ bool AttributeAdapter<ngraph::op::BroadcastModeSpec>::visit_attributes(Attribute
|
||||
}
|
||||
|
||||
template <>
|
||||
NGRAPH_API EnumNames<ngraph::op::RecurrentSequenceDirection>& EnumNames<ngraph::op::RecurrentSequenceDirection>::get() {
|
||||
static auto enum_names = EnumNames<ngraph::op::RecurrentSequenceDirection>(
|
||||
"ngraph::op::RecurrentSequenceDirection",
|
||||
{{"forward", ngraph::op::RecurrentSequenceDirection::FORWARD},
|
||||
{"reverse", ngraph::op::RecurrentSequenceDirection::REVERSE},
|
||||
{"bidirectional", ngraph::op::RecurrentSequenceDirection::BIDIRECTIONAL}});
|
||||
OPENVINO_API EnumNames<ov::op::RecurrentSequenceDirection>& EnumNames<ov::op::RecurrentSequenceDirection>::get() {
|
||||
static auto enum_names = EnumNames<ov::op::RecurrentSequenceDirection>(
|
||||
"ov::op::RecurrentSequenceDirection",
|
||||
{{"forward", ov::op::RecurrentSequenceDirection::FORWARD},
|
||||
{"reverse", ov::op::RecurrentSequenceDirection::REVERSE},
|
||||
{"bidirectional", ov::op::RecurrentSequenceDirection::BIDIRECTIONAL}});
|
||||
return enum_names;
|
||||
}
|
||||
|
||||
std::ostream& op::operator<<(std::ostream& s, const ngraph::op::PadMode& type) {
|
||||
std::ostream& op::operator<<(std::ostream& s, const ov::op::PadMode& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
std::ostream& op::operator<<(std::ostream& s, const ngraph::op::PadType& type) {
|
||||
std::ostream& op::operator<<(std::ostream& s, const ov::op::PadType& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
std::ostream& op::operator<<(std::ostream& s, const ngraph::op::RoundingType& type) {
|
||||
std::ostream& op::operator<<(std::ostream& s, const ov::op::RoundingType& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
std::ostream& op::operator<<(std::ostream& s, const ngraph::op::BroadcastType& type) {
|
||||
std::ostream& op::operator<<(std::ostream& s, const ov::op::BroadcastType& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
std::ostream& op::operator<<(std::ostream& s, const ngraph::op::AutoBroadcastType& type) {
|
||||
std::ostream& op::operator<<(std::ostream& s, const ov::op::AutoBroadcastType& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
std::ostream& op::operator<<(std::ostream& s, const ngraph::op::EpsMode& type) {
|
||||
std::ostream& op::operator<<(std::ostream& s, const ov::op::EpsMode& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
std::ostream& op::operator<<(std::ostream& s, const ngraph::op::TopKSortType& type) {
|
||||
std::ostream& op::operator<<(std::ostream& s, const ov::op::TopKSortType& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
std::ostream& op::operator<<(std::ostream& s, const ngraph::op::TopKMode& type) {
|
||||
std::ostream& op::operator<<(std::ostream& s, const ov::op::TopKMode& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
@ -165,12 +161,12 @@ op::AutoBroadcastType op::AutoBroadcastSpec::type_from_string(const std::string&
|
||||
{"pdpd", AutoBroadcastType::PDPD},
|
||||
{"explicit", AutoBroadcastType::EXPLICIT}};
|
||||
|
||||
NGRAPH_CHECK(allowed_values.count(lowercase_type) > 0, "Invalid 'type' value passed in.");
|
||||
OPENVINO_ASSERT(allowed_values.count(lowercase_type) > 0, "Invalid 'type' value passed in.");
|
||||
|
||||
return allowed_values.at(lowercase_type);
|
||||
}
|
||||
|
||||
std::ostream& op::operator<<(std::ostream& s, const ngraph::op::RecurrentSequenceDirection& direction) {
|
||||
std::ostream& op::operator<<(std::ostream& s, const ov::op::RecurrentSequenceDirection& direction) {
|
||||
return s << as_string(direction);
|
||||
}
|
||||
} // namespace ov
|
||||
|
@ -2,14 +2,11 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "ngraph/op/util/binary_elementwise_arithmetic.hpp"
|
||||
#include "openvino/op/util/binary_elementwise_arithmetic.hpp"
|
||||
|
||||
#include "bound_evaluate.hpp"
|
||||
#include "itt.hpp"
|
||||
#include "ngraph/attribute_visitor.hpp"
|
||||
#include "ngraph/op/util/elementwise_args.hpp"
|
||||
|
||||
using namespace std;
|
||||
#include "openvino/op/util/elementwise_args.hpp"
|
||||
|
||||
ov::op::util::BinaryElementwiseArithmetic::BinaryElementwiseArithmetic(const AutoBroadcastSpec& autob)
|
||||
: m_autob(autob) {}
|
||||
|
@ -2,13 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "ngraph/op/util/binary_elementwise_comparison.hpp"
|
||||
#include "openvino/op/util/binary_elementwise_comparison.hpp"
|
||||
|
||||
#include "itt.hpp"
|
||||
#include "ngraph/attribute_visitor.hpp"
|
||||
#include "ngraph/op/util/elementwise_args.hpp"
|
||||
|
||||
using namespace std;
|
||||
#include "openvino/op/util/elementwise_args.hpp"
|
||||
|
||||
ov::op::util::BinaryElementwiseComparison::BinaryElementwiseComparison(const AutoBroadcastSpec& autob)
|
||||
: m_autob(autob) {}
|
||||
|
@ -2,13 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "ngraph/op/util/binary_elementwise_logical.hpp"
|
||||
#include "openvino/op/util/binary_elementwise_logical.hpp"
|
||||
|
||||
#include "itt.hpp"
|
||||
#include "ngraph/attribute_visitor.hpp"
|
||||
#include "ngraph/op/util/elementwise_args.hpp"
|
||||
|
||||
using namespace std;
|
||||
#include "openvino/op/util/elementwise_args.hpp"
|
||||
|
||||
ov::op::util::BinaryElementwiseLogical::BinaryElementwiseLogical() = default;
|
||||
|
||||
|
@ -2,19 +2,17 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "ngraph/op/util/broadcast_base.hpp"
|
||||
#include "openvino/op/util/broadcast_base.hpp"
|
||||
|
||||
#include <ngraph/validation_util.hpp>
|
||||
#include <numeric>
|
||||
|
||||
#include "bound_evaluate.hpp"
|
||||
#include "itt.hpp"
|
||||
#include "ngraph/attribute_visitor.hpp"
|
||||
#include "ngraph/op/concat.hpp"
|
||||
#include "ngraph/op/constant.hpp"
|
||||
#include "ngraph/op/util/op_types.hpp"
|
||||
#include "ngraph/partial_shape.hpp"
|
||||
#include "ngraph/runtime/host_tensor.hpp"
|
||||
#include "ngraph/runtime/reference/broadcast.hpp"
|
||||
#include "ngraph/validation_util.hpp"
|
||||
#include "openvino/core/validation_util.hpp"
|
||||
#include "openvino/op/concat.hpp"
|
||||
#include "openvino/op/util/precision_sensitive_attribute.hpp"
|
||||
|
||||
using namespace std;
|
||||
@ -197,10 +195,10 @@ void ov::op::util::BroadcastBase::validate_and_infer_types() {
|
||||
|
||||
PartialShape output_shape;
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
bool output_shape_defined = ngraph::evaluate_as_partial_shape(get_input_source_output(1), output_shape);
|
||||
bool output_shape_defined = ov::evaluate_as_partial_shape(get_input_source_output(1), output_shape);
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
|
||||
if (auto concat = ov::as_type_ptr<ngraph::op::v0::Concat>(input_value(1).get_node_shared_ptr())) {
|
||||
if (auto concat = ov::as_type_ptr<ov::op::v0::Concat>(input_value(1).get_node_shared_ptr())) {
|
||||
auto concat_inputs = concat->inputs();
|
||||
|
||||
if (!output_shape_defined && concat->get_output_partial_shape(0).is_static() &&
|
||||
@ -208,7 +206,7 @@ void ov::op::util::BroadcastBase::validate_and_infer_types() {
|
||||
auto output_partial_shape = vector<Dimension>{};
|
||||
for (const auto& concat_input : concat_inputs) {
|
||||
auto source_node_ptr = concat_input.get_source_output().get_node_shared_ptr();
|
||||
if (auto source_const_ptr = ov::as_type_ptr<ngraph::op::v0::Constant>(source_node_ptr)) {
|
||||
if (auto source_const_ptr = ov::as_type_ptr<ov::op::v0::Constant>(source_node_ptr)) {
|
||||
output_partial_shape.emplace_back(source_const_ptr->get_axis_vector_val()[0]);
|
||||
} else {
|
||||
output_partial_shape.push_back(Dimension::dynamic());
|
||||
@ -267,7 +265,7 @@ std::pair<bool, ov::AxisSet> ov::op::util::BroadcastBase::get_broadcast_axes_num
|
||||
int64_t start_axis = ((broadcast_spec.m_type == op::BroadcastType::PDPD) && (broadcast_spec.m_axis != -1))
|
||||
? broadcast_spec.m_axis
|
||||
: static_cast<int64_t>(result_shape.size()) - static_cast<int64_t>(arg_shape.size());
|
||||
NGRAPH_CHECK(start_axis >= 0);
|
||||
OPENVINO_ASSERT(start_axis >= 0);
|
||||
for (size_t i = 0; i < result_shape.size(); i++) {
|
||||
if (i < static_cast<size_t>(start_axis) || result_shape[i] != arg_shape[i - start_axis]) {
|
||||
broadcast_axes.insert(i);
|
||||
@ -304,7 +302,7 @@ std::pair<bool, ov::AxisSet> ov::op::util::BroadcastBase::get_broadcast_axes() c
|
||||
if (get_input_partial_shape(1).is_static() && axes_mapping_constant) {
|
||||
auto axes_mapping_val = axes_mapping_constant->get_axis_vector_val();
|
||||
auto target_shape = get_input_shape(1);
|
||||
NGRAPH_CHECK(target_shape.size() == 1);
|
||||
OPENVINO_ASSERT(target_shape.size() == 1);
|
||||
return get_broadcast_axes_none(axes_mapping_val, target_shape[0]);
|
||||
}
|
||||
} else if (m_mode.m_type == BroadcastType::NUMPY || m_mode.m_type == BroadcastType::PDPD) {
|
||||
@ -377,11 +375,11 @@ void get_axis_vector_from_ht(const ngraph::HostTensorPtr& arg,
|
||||
OPENVINO_THROW("get_axis_vector_from_ht: type is not integral");
|
||||
}
|
||||
// Rank(arg_shape) == shape_size(axes_mapping)
|
||||
NGRAPH_CHECK(axis_vector.size() == arg_shape.size(),
|
||||
"Broadcast axes_mapping shape ",
|
||||
axis_vector.size(),
|
||||
" doesn't match rank of input tensor ",
|
||||
arg_shape.size());
|
||||
OPENVINO_ASSERT(axis_vector.size() == arg_shape.size(),
|
||||
"Broadcast axes_mapping shape ",
|
||||
axis_vector.size(),
|
||||
" doesn't match rank of input tensor ",
|
||||
arg_shape.size());
|
||||
}
|
||||
|
||||
template <ov::element::Type_t ET>
|
||||
@ -446,8 +444,8 @@ ov::Shape ov::op::util::BroadcastBase::get_target_shape(const HostTensorPtr& inp
|
||||
bool ov::op::util::BroadcastBase::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const {
|
||||
OV_OP_SCOPE(util_BroadcastBase_evaluate);
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
NGRAPH_CHECK(ngraph::validate_host_tensor_vector(inputs, 2) || ngraph::validate_host_tensor_vector(inputs, 3));
|
||||
NGRAPH_CHECK(ngraph::validate_host_tensor_vector(outputs, 1));
|
||||
OPENVINO_ASSERT(ngraph::validate_host_tensor_vector(inputs, 2) || ngraph::validate_host_tensor_vector(inputs, 3));
|
||||
OPENVINO_ASSERT(ngraph::validate_host_tensor_vector(outputs, 1));
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
Shape target_shape = get_target_shape(inputs[1]);
|
||||
|
||||
|
@ -6,8 +6,6 @@
|
||||
|
||||
#include "itt.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
ov::op::util::DeformableConvolutionBase::DeformableConvolutionBase(const OutputVector& arguments,
|
||||
const Strides& strides,
|
||||
const CoordinateDiff& pads_begin,
|
||||
|
@ -2,23 +2,13 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "ngraph/op/util/detection_output_base.hpp"
|
||||
#include "openvino/op/util/detection_output_base.hpp"
|
||||
|
||||
#include <detection_output_shape_inference.hpp>
|
||||
#include <ngraph/validation_util.hpp>
|
||||
#include "detection_output_shape_inference.hpp"
|
||||
|
||||
#include "ngraph/op/concat.hpp"
|
||||
#include "ngraph/op/constant.hpp"
|
||||
#include "ngraph/op/squeeze.hpp"
|
||||
#include "ngraph/runtime/host_tensor.hpp"
|
||||
#include "ngraph/shape.hpp"
|
||||
ov::op::util::DetectionOutputBase::DetectionOutputBase(const ov::OutputVector& args) : Op(args) {}
|
||||
|
||||
using namespace std;
|
||||
using namespace ov::op::util;
|
||||
|
||||
DetectionOutputBase::DetectionOutputBase(const ov::OutputVector& args) : Op(args) {}
|
||||
|
||||
void DetectionOutputBase::validate_base(const DetectionOutputBase::AttributesBase& attrs) {
|
||||
void ov::op::util::DetectionOutputBase::validate_base(const DetectionOutputBase::AttributesBase& attrs) {
|
||||
NODE_VALIDATION_CHECK(
|
||||
this,
|
||||
attrs.code_type == "caffe.PriorBoxParameter.CORNER" || attrs.code_type == "caffe.PriorBoxParameter.CENTER_SIZE",
|
||||
@ -74,7 +64,7 @@ bool ov::op::util::DetectionOutputBase::visit_attributes_base(AttributeVisitor&
|
||||
return true;
|
||||
}
|
||||
|
||||
ov::Dimension DetectionOutputBase::compute_num_classes(const AttributesBase& attrs) {
|
||||
ov::Dimension ov::op::util::DetectionOutputBase::compute_num_classes(const AttributesBase& attrs) {
|
||||
NODE_VALIDATION_CHECK(this,
|
||||
3 == get_input_size() || get_input_size() == 5,
|
||||
"A number of arguments must be equal to 3 or equal to 5. Got ",
|
||||
|
@ -2,10 +2,9 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "ngraph/op/util/elementwise_args.hpp"
|
||||
#include "openvino/op/util/elementwise_args.hpp"
|
||||
|
||||
#include "eltwise_shape_inference.hpp"
|
||||
#include "ngraph/op/util/binary_elementwise_arithmetic.hpp"
|
||||
|
||||
std::tuple<ov::element::Type, ov::PartialShape> ov::op::util::validate_and_infer_elementwise_args(Node* node) {
|
||||
OPENVINO_ASSERT(node != nullptr, "Node is empty! Cannot validate eltwise arguments.");
|
||||
|
@ -2,13 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "ngraph/op/util/embeddingbag_offsets_base.hpp"
|
||||
#include "openvino/op/util/embeddingbag_offsets_base.hpp"
|
||||
|
||||
#include "embeddingbag_offsets_shape_inference.hpp"
|
||||
#include "itt.hpp"
|
||||
#include "ngraph/op/constant.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
ov::op::util::EmbeddingBagOffsetsBase::EmbeddingBagOffsetsBase(const Output<Node>& emb_table,
|
||||
const Output<Node>& indices,
|
||||
|
@ -2,11 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "ngraph/op/util/embeddingbag_packed_base.hpp"
|
||||
#include "openvino/op/util/embeddingbag_packed_base.hpp"
|
||||
|
||||
#include "embeddingbag_packed_shape_inference.hpp"
|
||||
#include "itt.hpp"
|
||||
#include "ngraph/op/constant.hpp"
|
||||
#include "openvino/core/validation_util.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
@ -2,15 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "ngraph/op/util/fft_base.hpp"
|
||||
|
||||
#include <fft_base_shape_inference.hpp>
|
||||
#include <ngraph/validation_util.hpp>
|
||||
#include "openvino/op/util/fft_base.hpp"
|
||||
|
||||
#include "fft_base_shape_inference.hpp"
|
||||
#include "itt.hpp"
|
||||
#include "ngraph/attribute_visitor.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
ov::op::util::FFTBase::FFTBase(const Output<Node>& data, const Output<Node>& axes) : Op({data, axes}) {}
|
||||
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include "openvino/op/util/framework_node.hpp"
|
||||
|
||||
#include "itt.hpp"
|
||||
#include "ngraph/graph_util.hpp"
|
||||
|
||||
ov::op::util::FrameworkNode::FrameworkNode(const OutputVector& inputs, size_t output_size, size_t num_subgraphs)
|
||||
: MultiSubGraphOp(num_subgraphs),
|
||||
|
@ -2,19 +2,15 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "ngraph/op/util/gather_base.hpp"
|
||||
#include "openvino/op/util/gather_base.hpp"
|
||||
|
||||
#include "bound_evaluate.hpp"
|
||||
#include "gather_shape_inference.hpp"
|
||||
#include "itt.hpp"
|
||||
#include "ngraph/op/concat.hpp"
|
||||
#include "ngraph/op/constant.hpp"
|
||||
#include "ngraph/op/squeeze.hpp"
|
||||
#include "ngraph/runtime/host_tensor.hpp"
|
||||
#include "ngraph/runtime/reference/gather.hpp"
|
||||
#include "ngraph/shape.hpp"
|
||||
|
||||
using namespace std;
|
||||
#include "openvino/op/concat.hpp"
|
||||
#include "openvino/op/constant.hpp"
|
||||
#include "openvino/op/squeeze.hpp"
|
||||
|
||||
ov::op::util::GatherBase::GatherBase(const Output<Node>& data,
|
||||
const Output<Node>& indices,
|
||||
@ -143,9 +139,9 @@ bool cf_gather_with_subgraph(ov::OutputVector& output_values,
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto concat = std::dynamic_pointer_cast<ngraph::op::Concat>(input_values[0].get_node_shared_ptr());
|
||||
const auto indices = std::dynamic_pointer_cast<ngraph::op::Constant>(input_values[1].get_node_shared_ptr());
|
||||
const auto axis = std::dynamic_pointer_cast<ngraph::op::Constant>(input_values[2].get_node_shared_ptr());
|
||||
const auto concat = std::dynamic_pointer_cast<ov::op::v0::Concat>(input_values[0].get_node_shared_ptr());
|
||||
const auto indices = std::dynamic_pointer_cast<ov::op::v0::Constant>(input_values[1].get_node_shared_ptr());
|
||||
const auto axis = std::dynamic_pointer_cast<ov::op::v0::Constant>(input_values[2].get_node_shared_ptr());
|
||||
|
||||
if (!concat || !indices || !axis) {
|
||||
return false;
|
||||
@ -173,7 +169,7 @@ bool cf_gather_with_subgraph(ov::OutputVector& output_values,
|
||||
const int64_t rank = concat->get_shape()[0];
|
||||
const int64_t raw_index = indices->cast_vector<int64_t>()[0];
|
||||
const int64_t positive_index = raw_index < 0 ? rank + raw_index : raw_index;
|
||||
NGRAPH_CHECK(positive_index >= 0 && positive_index < rank);
|
||||
OPENVINO_ASSERT(positive_index >= 0 && positive_index < rank);
|
||||
|
||||
// gather takes exactly one element out of the Concat output
|
||||
const auto gathered_concat_input = concat_inputs[positive_index].get_source_output().get_node_shared_ptr();
|
||||
@ -181,8 +177,8 @@ bool cf_gather_with_subgraph(ov::OutputVector& output_values,
|
||||
auto gathered = gathered_concat_input;
|
||||
if (indices_shape.empty()) {
|
||||
// gathering a scalar
|
||||
const auto axis_const = ngraph::op::Constant::create(ov::element::i64, ov::Shape{1}, {0});
|
||||
gathered = make_shared<ngraph::op::v0::Squeeze>(gathered_concat_input, axis_const);
|
||||
const auto axis_const = ov::op::v0::Constant::create(ov::element::i64, ov::Shape{1}, {0});
|
||||
gathered = std::make_shared<ov::op::v0::Squeeze>(gathered_concat_input, axis_const);
|
||||
}
|
||||
|
||||
output_values[0] = gathered;
|
||||
@ -195,8 +191,8 @@ bool cf_gather_with_subgraph(ov::OutputVector& output_values,
|
||||
bool ov::op::util::GatherBase::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const {
|
||||
OV_OP_SCOPE(util_GatherBase_evaluate);
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
NGRAPH_CHECK(ngraph::validate_host_tensor_vector(inputs, 3));
|
||||
NGRAPH_CHECK(ngraph::validate_host_tensor_vector(outputs, 1));
|
||||
OPENVINO_ASSERT(ngraph::validate_host_tensor_vector(inputs, 3));
|
||||
OPENVINO_ASSERT(ngraph::validate_host_tensor_vector(outputs, 1));
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
int64_t axis = 0;
|
||||
switch (inputs[2]->get_element_type()) {
|
||||
|
@ -2,18 +2,9 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "ngraph/op/util/gather_nd_base.hpp"
|
||||
|
||||
#include <ngraph/validation_util.hpp>
|
||||
#include "openvino/op/util/gather_nd_base.hpp"
|
||||
|
||||
#include "gather_nd_shape_inference.hpp"
|
||||
#include "ngraph/op/concat.hpp"
|
||||
#include "ngraph/op/constant.hpp"
|
||||
#include "ngraph/op/squeeze.hpp"
|
||||
#include "ngraph/runtime/host_tensor.hpp"
|
||||
#include "ngraph/shape.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
ov::op::util::GatherNDBase::GatherNDBase(const Output<Node>& data, const Output<Node>& indices, const size_t batch_dims)
|
||||
: Op({data, indices}),
|
||||
|
@ -2,14 +2,11 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "ngraph/op/util/index_reduction.hpp"
|
||||
#include "openvino/op/util/index_reduction.hpp"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "itt.hpp"
|
||||
#include "ngraph/attribute_visitor.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
ov::op::util::IndexReduction::IndexReduction() = default;
|
||||
|
||||
|
@ -2,22 +2,19 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "ngraph/op/util/logical_reduction.hpp"
|
||||
#include "openvino/op/util/logical_reduction.hpp"
|
||||
|
||||
#include "itt.hpp"
|
||||
#include "ngraph/op/constant.hpp"
|
||||
#include "ngraph/validation_util.hpp"
|
||||
#include "openvino/op/constant.hpp"
|
||||
|
||||
namespace ov {
|
||||
|
||||
using namespace std;
|
||||
|
||||
op::util::LogicalReduction::LogicalReduction() = default;
|
||||
|
||||
op::util::LogicalReduction::LogicalReduction(const Output<Node>& arg, const AxisSet& reduction_axes)
|
||||
: ReductionBase(
|
||||
arg,
|
||||
ngraph::op::Constant::create(element::i64, ov::Shape{reduction_axes.size()}, reduction_axes.to_vector())
|
||||
ov::op::v0::Constant::create(element::i64, ov::Shape{reduction_axes.size()}, reduction_axes.to_vector())
|
||||
->output(0)) {}
|
||||
|
||||
op::util::LogicalReduction::LogicalReduction(const Output<Node>& arg, const Output<Node>& reduction_axes)
|
||||
|
@ -2,17 +2,12 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "ngraph/op/util/logical_reduction_keep_dims.hpp"
|
||||
#include "openvino/op/util/logical_reduction_keep_dims.hpp"
|
||||
|
||||
#include "itt.hpp"
|
||||
#include "ngraph/attribute_visitor.hpp"
|
||||
#include "ngraph/op/constant.hpp"
|
||||
#include "ngraph/validation_util.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
ov::op::util::LogicalReductionKeepDims::LogicalReductionKeepDims(const ngraph::Output<ngraph::Node>& arg,
|
||||
const ngraph::Output<ngraph::Node>& reduction_axes,
|
||||
ov::op::util::LogicalReductionKeepDims::LogicalReductionKeepDims(const ov::Output<ov::Node>& arg,
|
||||
const ov::Output<ov::Node>& reduction_axes,
|
||||
const bool keep_dims)
|
||||
: LogicalReduction(arg, reduction_axes),
|
||||
m_keep_dims{keep_dims} {}
|
||||
|
@ -2,10 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "ngraph/op/util/multi_subgraph_base.hpp"
|
||||
|
||||
#include "ngraph/graph_util.hpp"
|
||||
#include "ngraph/opsets/opset5.hpp"
|
||||
#include "openvino/op/util/multi_subgraph_base.hpp"
|
||||
|
||||
ov::op::util::MultiSubGraphOp::InputDescription::InputDescription(uint64_t input_index, uint64_t body_parameter_index)
|
||||
: m_input_index(input_index),
|
||||
@ -117,7 +114,7 @@ ov::Input<ov::Node> ov::op::util::MultiSubGraphOp::input_for_value(const Output<
|
||||
}
|
||||
|
||||
void ov::op::util::MultiSubGraphOp::set_invariant_inputs(const Output<Node>& value,
|
||||
const ngraph::ParameterVector& bodies_parameters) {
|
||||
const ov::ParameterVector& bodies_parameters) {
|
||||
auto input_index = input_for_value(value).get_index();
|
||||
for (auto& param : bodies_parameters) {
|
||||
for (size_t body_index = 0; body_index < m_bodies.size(); ++body_index) {
|
||||
|
@ -2,28 +2,28 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "ngraph/op/util/op_types.hpp"
|
||||
#include "openvino/op/util/op_types.hpp"
|
||||
|
||||
#include "ngraph/op/add.hpp"
|
||||
#include "ngraph/op/and.hpp"
|
||||
#include "ngraph/op/constant.hpp"
|
||||
#include "ngraph/op/equal.hpp"
|
||||
#include "ngraph/op/maximum.hpp"
|
||||
#include "ngraph/op/minimum.hpp"
|
||||
#include "ngraph/op/multiply.hpp"
|
||||
#include "ngraph/op/not_equal.hpp"
|
||||
#include "ngraph/op/op.hpp"
|
||||
#include "ngraph/op/or.hpp"
|
||||
#include "ngraph/op/parameter.hpp"
|
||||
#include "ngraph/op/result.hpp"
|
||||
#include "ngraph/op/select.hpp"
|
||||
#include "ngraph/op/squared_difference.hpp"
|
||||
#include "ngraph/op/util/binary_elementwise_arithmetic.hpp"
|
||||
#include "ngraph/op/util/binary_elementwise_comparison.hpp"
|
||||
#include "ngraph/op/util/binary_elementwise_logical.hpp"
|
||||
#include "ngraph/op/util/unary_elementwise_arithmetic.hpp"
|
||||
#include "ngraph/op/xor.hpp"
|
||||
#include "ngraph/type.hpp"
|
||||
#include "openvino/op/add.hpp"
|
||||
#include "openvino/op/constant.hpp"
|
||||
#include "openvino/op/equal.hpp"
|
||||
#include "openvino/op/logical_and.hpp"
|
||||
#include "openvino/op/logical_or.hpp"
|
||||
#include "openvino/op/logical_xor.hpp"
|
||||
#include "openvino/op/maximum.hpp"
|
||||
#include "openvino/op/minimum.hpp"
|
||||
#include "openvino/op/multiply.hpp"
|
||||
#include "openvino/op/not_equal.hpp"
|
||||
#include "openvino/op/parameter.hpp"
|
||||
#include "openvino/op/result.hpp"
|
||||
#include "openvino/op/select.hpp"
|
||||
#include "openvino/op/sink.hpp"
|
||||
#include "openvino/op/squared_difference.hpp"
|
||||
#include "openvino/op/util/binary_elementwise_arithmetic.hpp"
|
||||
#include "openvino/op/util/binary_elementwise_comparison.hpp"
|
||||
#include "openvino/op/util/binary_elementwise_logical.hpp"
|
||||
#include "openvino/op/util/unary_elementwise_arithmetic.hpp"
|
||||
#include "openvino/op/xor.hpp"
|
||||
|
||||
bool ov::op::util::is_unary_elementwise_arithmetic(const ov::Node* node) {
|
||||
return dynamic_cast<const ov::op::util::UnaryElementwiseArithmetic*>(node) != nullptr;
|
||||
@ -42,8 +42,8 @@ bool ov::op::util::is_binary_elementwise_logical(const ov::Node* node) {
|
||||
}
|
||||
|
||||
bool ov::op::util::supports_auto_broadcast(const ov::Node* node) {
|
||||
return dynamic_cast<const ngraph::op::v1::Select*>(node) != nullptr ||
|
||||
dynamic_cast<const ngraph::op::v0::SquaredDifference*>(node) != nullptr ||
|
||||
return dynamic_cast<const ov::op::v1::Select*>(node) != nullptr ||
|
||||
dynamic_cast<const ov::op::v0::SquaredDifference*>(node) != nullptr ||
|
||||
dynamic_cast<const ov::op::util::BinaryElementwiseComparison*>(node) != nullptr ||
|
||||
dynamic_cast<const ov::op::util::BinaryElementwiseLogical*>(node) != nullptr ||
|
||||
dynamic_cast<const ov::op::util::BinaryElementwiseArithmetic*>(node) != nullptr;
|
||||
@ -54,32 +54,32 @@ bool ov::op::util::is_op(const ov::Node* node) {
|
||||
}
|
||||
|
||||
bool ov::op::util::is_parameter(const ov::Node* node) {
|
||||
return dynamic_cast<const ngraph::op::Parameter*>(node) != nullptr;
|
||||
return dynamic_cast<const ov::op::v0::Parameter*>(node) != nullptr;
|
||||
}
|
||||
|
||||
bool ov::op::util::is_output(const ov::Node* node) {
|
||||
return dynamic_cast<const ngraph::op::Result*>(node) != nullptr;
|
||||
return dynamic_cast<const ov::op::v0::Result*>(node) != nullptr;
|
||||
}
|
||||
|
||||
bool ov::op::util::is_sink(const ov::Node* node) {
|
||||
return dynamic_cast<const ngraph::op::Sink*>(node) != nullptr;
|
||||
return dynamic_cast<const ov::op::Sink*>(node) != nullptr;
|
||||
}
|
||||
|
||||
bool ov::op::util::is_constant(const ov::Node* node) {
|
||||
return dynamic_cast<const ngraph::op::Constant*>(node) != nullptr;
|
||||
return dynamic_cast<const ov::op::v0::Constant*>(node) != nullptr;
|
||||
}
|
||||
|
||||
bool ov::op::util::is_commutative(const ov::Node* node) {
|
||||
return dynamic_cast<const ngraph::op::v1::Add*>(node) != nullptr ||
|
||||
dynamic_cast<const ngraph::op::v1::Maximum*>(node) != nullptr ||
|
||||
dynamic_cast<const ngraph::op::v1::Equal*>(node) != nullptr ||
|
||||
dynamic_cast<const ngraph::op::v1::NotEqual*>(node) != nullptr ||
|
||||
dynamic_cast<const ngraph::op::v1::LogicalAnd*>(node) != nullptr ||
|
||||
dynamic_cast<const ngraph::op::v0::Xor*>(node) != nullptr ||
|
||||
dynamic_cast<const ngraph::op::v1::LogicalXor*>(node) != nullptr ||
|
||||
dynamic_cast<const ngraph::op::v1::Minimum*>(node) != nullptr ||
|
||||
dynamic_cast<const ngraph::op::v1::Multiply*>(node) != nullptr ||
|
||||
dynamic_cast<const ngraph::op::v1::LogicalOr*>(node) != nullptr;
|
||||
return dynamic_cast<const ov::op::v1::Add*>(node) != nullptr ||
|
||||
dynamic_cast<const ov::op::v1::Maximum*>(node) != nullptr ||
|
||||
dynamic_cast<const ov::op::v1::Equal*>(node) != nullptr ||
|
||||
dynamic_cast<const ov::op::v1::NotEqual*>(node) != nullptr ||
|
||||
dynamic_cast<const ov::op::v1::LogicalAnd*>(node) != nullptr ||
|
||||
dynamic_cast<const ov::op::v0::Xor*>(node) != nullptr ||
|
||||
dynamic_cast<const ov::op::v1::LogicalXor*>(node) != nullptr ||
|
||||
dynamic_cast<const ov::op::v1::Minimum*>(node) != nullptr ||
|
||||
dynamic_cast<const ov::op::v1::Multiply*>(node) != nullptr ||
|
||||
dynamic_cast<const ov::op::v1::LogicalOr*>(node) != nullptr;
|
||||
}
|
||||
|
||||
bool ov::op::util::is_unary_elementwise_arithmetic(const std::shared_ptr<ov::Node>& node) {
|
||||
|
@ -7,8 +7,6 @@
|
||||
#include "openvino/op/constant.hpp"
|
||||
#include "reduce_shape_inference.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
ov::op::util::ReductionBase::ReductionBase() = default;
|
||||
|
||||
ov::op::util::ReductionBase::ReductionBase(const Output<Node>& arg, const Output<Node>& reduction_axes)
|
||||
|
@ -2,22 +2,21 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "ngraph/op/util/rnn_cell_base.hpp"
|
||||
#include "openvino/op/util/rnn_cell_base.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <locale>
|
||||
|
||||
#include "itt.hpp"
|
||||
#include "ngraph/attribute_visitor.hpp"
|
||||
#include "ngraph/op/add.hpp"
|
||||
#include "ngraph/op/clamp.hpp"
|
||||
#include "ngraph/op/multiply.hpp"
|
||||
#include "ngraph/op/subtract.hpp"
|
||||
#include "ngraph/opsets/opset4.hpp"
|
||||
#include "ngraph/util.hpp"
|
||||
|
||||
using namespace std;
|
||||
#include "openvino/op/add.hpp"
|
||||
#include "openvino/op/clamp.hpp"
|
||||
#include "openvino/op/concat.hpp"
|
||||
#include "openvino/op/constant.hpp"
|
||||
#include "openvino/op/multiply.hpp"
|
||||
#include "openvino/op/split.hpp"
|
||||
#include "openvino/op/subtract.hpp"
|
||||
#include "openvino/util/common_util.hpp"
|
||||
|
||||
std::shared_ptr<ov::Node> ov::op::util::convert_lstm_node_format(const Output<Node>& node,
|
||||
LSTMWeightsFormat from_format,
|
||||
@ -34,13 +33,13 @@ std::shared_ptr<ov::Node> ov::op::util::convert_lstm_node_format(const Output<No
|
||||
const auto& to = gate_order_map.at(to_format);
|
||||
size_t num_gates = 4;
|
||||
|
||||
auto axis_const = std::make_shared<ngraph::opset4::Constant>(element::i64, ngraph::Shape{}, axis);
|
||||
OutputVector splitted_node = std::make_shared<ngraph::opset4::Split>(node, axis_const, num_gates)->outputs();
|
||||
auto axis_const = std::make_shared<ov::op::v0::Constant>(element::i64, ov::Shape{}, axis);
|
||||
OutputVector splitted_node = std::make_shared<ov::op::v1::Split>(node, axis_const, num_gates)->outputs();
|
||||
OutputVector nodes_in_new_format(num_gates);
|
||||
for (size_t i = 0; i < num_gates; ++i) {
|
||||
nodes_in_new_format[to[from[i]]] = splitted_node[i];
|
||||
}
|
||||
return std::make_shared<ngraph::opset4::Concat>(nodes_in_new_format, axis);
|
||||
return std::make_shared<ov::op::v0::Concat>(nodes_in_new_format, axis);
|
||||
}
|
||||
|
||||
std::shared_ptr<ov::Node> ov::op::util::convert_lstm_peepholes_format(const Output<Node>& node,
|
||||
@ -56,22 +55,20 @@ std::shared_ptr<ov::Node> ov::op::util::convert_lstm_peepholes_format(const Outp
|
||||
const auto& to = gate_order_map.at(to_format);
|
||||
size_t num_gates = 3;
|
||||
|
||||
auto axis_const = std::make_shared<ngraph::opset4::Constant>(element::i64, ngraph::Shape{}, axis);
|
||||
OutputVector splitted_node = std::make_shared<ngraph::opset4::Split>(node, axis_const, num_gates)->outputs();
|
||||
auto axis_const = std::make_shared<ov::op::v0::Constant>(element::i64, ov::Shape{}, axis);
|
||||
OutputVector splitted_node = std::make_shared<ov::op::v1::Split>(node, axis_const, num_gates)->outputs();
|
||||
OutputVector nodes_in_new_format(num_gates);
|
||||
for (size_t i = 0; i < num_gates; ++i) {
|
||||
nodes_in_new_format[to[from[i]]] = splitted_node[i];
|
||||
}
|
||||
return std::make_shared<ngraph::opset4::Concat>(nodes_in_new_format, axis);
|
||||
return std::make_shared<ov::op::v0::Concat>(nodes_in_new_format, axis);
|
||||
}
|
||||
|
||||
// Modify input vector in-place and return reference to modified vector.
|
||||
static vector<string> to_lower_case(const vector<string>& vs) {
|
||||
vector<string> res(vs);
|
||||
transform(begin(res), end(res), begin(res), [](string& s) {
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
return ngraph::to_lower(s);
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
static std::vector<std::string> to_lower_case(const std::vector<std::string>& vs) {
|
||||
std::vector<std::string> res(vs);
|
||||
transform(begin(res), end(res), begin(res), [](std::string& s) {
|
||||
return ov::util::to_lower(s);
|
||||
});
|
||||
return res;
|
||||
}
|
||||
@ -81,9 +78,9 @@ ov::op::util::RNNCellBase::RNNCellBase() : m_hidden_size(0), m_clip(0.f) {}
|
||||
ov::op::util::RNNCellBase::RNNCellBase(const OutputVector& args,
|
||||
size_t hidden_size,
|
||||
float clip,
|
||||
const vector<string>& activations,
|
||||
const vector<float>& activations_alpha,
|
||||
const vector<float>& activations_beta)
|
||||
const std::vector<std::string>& activations,
|
||||
const std::vector<float>& activations_alpha,
|
||||
const std::vector<float>& activations_beta)
|
||||
: Op(args),
|
||||
m_hidden_size(hidden_size),
|
||||
m_clip(clip),
|
||||
@ -91,7 +88,7 @@ ov::op::util::RNNCellBase::RNNCellBase(const OutputVector& args,
|
||||
m_activations_alpha(activations_alpha),
|
||||
m_activations_beta(activations_beta) {}
|
||||
|
||||
bool ngraph::op::util::RNNCellBase::visit_attributes(AttributeVisitor& visitor) {
|
||||
bool ov::op::util::RNNCellBase::visit_attributes(AttributeVisitor& visitor) {
|
||||
OV_OP_SCOPE(util_RNNCellBase_visit_attributes);
|
||||
visitor.on_attribute("hidden_size", m_hidden_size);
|
||||
visitor.on_attribute("activations", m_activations);
|
||||
@ -101,7 +98,7 @@ bool ngraph::op::util::RNNCellBase::visit_attributes(AttributeVisitor& visitor)
|
||||
return true;
|
||||
}
|
||||
|
||||
void ngraph::op::util::RNNCellBase::validate_input_rank_dimension(const std::vector<ngraph::PartialShape>& input) {
|
||||
void ov::op::util::RNNCellBase::validate_input_rank_dimension(const std::vector<ov::PartialShape>& input) {
|
||||
enum { X, initial_hidden_state, W, R, B };
|
||||
|
||||
// Verify static ranks for all inputs
|
||||
@ -159,22 +156,22 @@ ov::op::util::ActivationFunction ov::op::util::RNNCellBase::get_activation_funct
|
||||
return afunc;
|
||||
}
|
||||
|
||||
shared_ptr<ov::Node> ov::op::util::RNNCellBase::add(const Output<Node>& lhs, const Output<Node>& rhs) {
|
||||
return {make_shared<ngraph::op::v1::Add>(lhs, rhs)};
|
||||
std::shared_ptr<ov::Node> ov::op::util::RNNCellBase::add(const Output<Node>& lhs, const Output<Node>& rhs) {
|
||||
return {std::make_shared<ov::op::v1::Add>(lhs, rhs)};
|
||||
}
|
||||
|
||||
shared_ptr<ov::Node> ov::op::util::RNNCellBase::sub(const Output<Node>& lhs, const Output<Node>& rhs) {
|
||||
return {make_shared<ngraph::op::v1::Subtract>(lhs, rhs)};
|
||||
std::shared_ptr<ov::Node> ov::op::util::RNNCellBase::sub(const Output<Node>& lhs, const Output<Node>& rhs) {
|
||||
return {std::make_shared<ov::op::v1::Subtract>(lhs, rhs)};
|
||||
}
|
||||
|
||||
shared_ptr<ov::Node> ov::op::util::RNNCellBase::mul(const Output<Node>& lhs, const Output<Node>& rhs) {
|
||||
return {make_shared<ngraph::op::v1::Multiply>(lhs, rhs)};
|
||||
std::shared_ptr<ov::Node> ov::op::util::RNNCellBase::mul(const Output<Node>& lhs, const Output<Node>& rhs) {
|
||||
return {std::make_shared<ov::op::v1::Multiply>(lhs, rhs)};
|
||||
}
|
||||
|
||||
shared_ptr<ov::Node> ov::op::util::RNNCellBase::clip(const Output<Node>& data) const {
|
||||
std::shared_ptr<ov::Node> ov::op::util::RNNCellBase::clip(const Output<Node>& data) const {
|
||||
if (m_clip == 0.f) {
|
||||
return data.get_node_shared_ptr();
|
||||
}
|
||||
|
||||
return make_shared<ngraph::op::Clamp>(data, -m_clip, m_clip);
|
||||
return std::make_shared<ov::op::v0::Clamp>(data, -m_clip, m_clip);
|
||||
}
|
||||
|
@ -2,14 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "ngraph/op/util/scatter_base.hpp"
|
||||
#include "openvino/op/util/scatter_base.hpp"
|
||||
|
||||
#include "itt.hpp"
|
||||
#include "ngraph/op/util/op_types.hpp"
|
||||
#include "ngraph/shape.hpp"
|
||||
#include "ngraph/validation_util.hpp"
|
||||
|
||||
using namespace std;
|
||||
#include "openvino/core/validation_util.hpp"
|
||||
|
||||
ov::op::util::ScatterBase::ScatterBase(const Output<Node>& data,
|
||||
const Output<Node>& indices,
|
||||
@ -76,12 +72,10 @@ void ov::op::util::ScatterBase::validate_and_infer_types() {
|
||||
// Get axis value if possible.
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
if (const auto& axis_const_input = get_constant_from_source(input_value(AXIS))) {
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
bool compatible = true;
|
||||
int64_t axis = axis_const_input->cast_vector<int64_t>().at(0);
|
||||
int64_t data_rank = data_shape.rank().get_length();
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
axis = ngraph::normalize_axis(this, axis, data_rank);
|
||||
axis = ov::normalize_axis(this, axis, data_rank);
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
|
||||
if (indices_shape.rank().is_static() && updates_shape.rank().is_static()) {
|
||||
|
@ -4,11 +4,10 @@
|
||||
|
||||
#include "openvino/op/util/scatter_elements_update_base.hpp"
|
||||
|
||||
#include <scatter_elements_update_shape_inference.hpp>
|
||||
|
||||
#include "bound_evaluate.hpp"
|
||||
#include "itt.hpp"
|
||||
#include "openvino/core/validation_util.hpp"
|
||||
#include "scatter_elements_update_shape_inference.hpp"
|
||||
|
||||
namespace ov {
|
||||
namespace op {
|
||||
@ -109,7 +108,7 @@ bool op::util::ScatterElementsUpdateBase::evaluate_label(TensorLabelVector& outp
|
||||
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
int64_t op::util::ScatterElementsUpdateBase::get_normalized_axis(const HostTensorVector& inputs) const {
|
||||
NGRAPH_CHECK(inputs[3]->get_element_type().is_integral_number(), "axis element type is not integral data type");
|
||||
OPENVINO_ASSERT(inputs[3]->get_element_type().is_integral_number(), "axis element type is not integral data type");
|
||||
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
int64_t axis = host_tensor_2_vector<int64_t>(inputs[3])[0];
|
||||
@ -120,11 +119,11 @@ int64_t op::util::ScatterElementsUpdateBase::get_normalized_axis(const HostTenso
|
||||
if (normalized_axis < 0) {
|
||||
if (input_rank.is_static()) {
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
normalized_axis = ngraph::normalize_axis(this, axis, input_rank);
|
||||
normalized_axis = ov::normalize_axis(this, axis, input_rank);
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
} else {
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
normalized_axis = ngraph::normalize_axis(this, axis, static_cast<int64_t>(inputs[0]->get_shape().size()));
|
||||
normalized_axis = ov::normalize_axis(this, axis, static_cast<int64_t>(inputs[0]->get_shape().size()));
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
}
|
||||
}
|
||||
|
@ -2,15 +2,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "ngraph/op/util/scatter_nd_base.hpp"
|
||||
|
||||
#include <scatter_nd_base_shape_inference.hpp>
|
||||
#include "openvino/op/util/scatter_nd_base.hpp"
|
||||
|
||||
#include "itt.hpp"
|
||||
#include "ngraph/node.hpp"
|
||||
#include "ngraph/shape.hpp"
|
||||
|
||||
using namespace std;
|
||||
#include "scatter_nd_base_shape_inference.hpp"
|
||||
|
||||
constexpr int ov::op::util::ScatterNDBase::INPUTS;
|
||||
constexpr int ov::op::util::ScatterNDBase::INDICES;
|
||||
|
@ -2,31 +2,31 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "ngraph/op/util/sub_graph_base.hpp"
|
||||
#include "openvino/op/util/sub_graph_base.hpp"
|
||||
|
||||
#include "ngraph/graph_util.hpp"
|
||||
#include "ngraph/opsets/opset5.hpp"
|
||||
#include "openvino/op/parameter.hpp"
|
||||
#include "openvino/op/tensor_iterator.hpp"
|
||||
|
||||
ov::op::util::SubGraphOp::SubGraphOp() : MultiSubGraphOp(1) {}
|
||||
|
||||
ov::op::util::SubGraphOp::SubGraphOp(const OutputVector& args) : MultiSubGraphOp(args, 1) {}
|
||||
|
||||
void ov::op::util::SubGraphOp::set_merged_input(const std::shared_ptr<ngraph::op::Parameter>& body_parameter,
|
||||
void ov::op::util::SubGraphOp::set_merged_input(const std::shared_ptr<ov::op::v0::Parameter>& body_parameter,
|
||||
const Output<Node>& initial_value,
|
||||
const Output<Node>& successive_value) {
|
||||
auto body = get_function();
|
||||
|
||||
m_input_descriptions[0].push_back(
|
||||
std::make_shared<ngraph::op::TensorIterator::MergedInputDescription>(input_for_value(initial_value).get_index(),
|
||||
std::make_shared<ov::op::v0::TensorIterator::MergedInputDescription>(input_for_value(initial_value).get_index(),
|
||||
body->get_parameter_index(body_parameter),
|
||||
body->get_result_index(successive_value)));
|
||||
validate_and_infer_types();
|
||||
}
|
||||
|
||||
void ov::op::util::SubGraphOp::set_invariant_input(const std::shared_ptr<ngraph::op::Parameter>& body_parameter,
|
||||
void ov::op::util::SubGraphOp::set_invariant_input(const std::shared_ptr<ov::op::v0::Parameter>& body_parameter,
|
||||
const Output<Node>& value) {
|
||||
auto body = get_function();
|
||||
m_input_descriptions[0].push_back(std::make_shared<ngraph::op::TensorIterator::InvariantInputDescription>(
|
||||
m_input_descriptions[0].push_back(std::make_shared<ov::op::v0::TensorIterator::InvariantInputDescription>(
|
||||
input_for_value(value).get_index(),
|
||||
body->get_parameter_index(body_parameter)));
|
||||
validate_and_infer_types();
|
||||
@ -62,7 +62,7 @@ ov::Output<ov::Node> ov::op::util::SubGraphOp::get_concatenated_slices(const Out
|
||||
return Output<Node>(shared_from_this(), output_index);
|
||||
}
|
||||
|
||||
void ov::op::util::SubGraphOp::set_sliced_input(const std::shared_ptr<ngraph::op::Parameter>& parameter,
|
||||
void ov::op::util::SubGraphOp::set_sliced_input(const std::shared_ptr<ov::op::v0::Parameter>& parameter,
|
||||
const Output<Node>& value,
|
||||
int64_t start,
|
||||
int64_t stride,
|
||||
|
@ -5,11 +5,10 @@
|
||||
#include "openvino/op/util/topk_base.hpp"
|
||||
|
||||
#include <limits>
|
||||
#include <ngraph/validation_util.hpp>
|
||||
#include <topk_shape_inference.hpp>
|
||||
|
||||
#include "itt.hpp"
|
||||
#include "openvino/op/util/precision_sensitive_attribute.hpp"
|
||||
#include "topk_shape_inference.hpp"
|
||||
|
||||
namespace {
|
||||
constexpr auto UNKNOWN_NORMALIZED_AXIS = std::numeric_limits<uint64_t>::max();
|
||||
|
@ -2,10 +2,9 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "ngraph/op/util/unary_elementwise_arithmetic.hpp"
|
||||
#include "openvino/op/util/unary_elementwise_arithmetic.hpp"
|
||||
|
||||
#include "itt.hpp"
|
||||
#include "ngraph/op/util/elementwise_args.hpp"
|
||||
|
||||
ov::op::util::UnaryElementwiseArithmetic::UnaryElementwiseArithmetic() : Op() {}
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "ngraph/node.hpp"
|
||||
#include "ngraph/runtime/host_tensor.hpp"
|
||||
#include "openvino/core/deprecated.hpp"
|
||||
#include "openvino/core/shape.hpp"
|
||||
|
Loading…
Reference in New Issue
Block a user