Moved attribute_adapter, attribute_visitor files to ov namespave (#7179)
* Fixed nGraph build * Fixed nGraph unit tests * Fixed func tests * Fix some operators * Fixed build * Try to fix specialization in different namespace * Try to fix build * Fixed element_type
This commit is contained in:
@@ -40,6 +40,9 @@ private:
|
||||
} // namespace op
|
||||
|
||||
std::ostream &operator<<(std::ostream &s, const ELTWISE_TYPE &type);
|
||||
} // namespace ngraph
|
||||
|
||||
namespace ov {
|
||||
|
||||
template <>
|
||||
class AttributeAdapter<ELTWISE_TYPE>
|
||||
@@ -52,4 +55,5 @@ public:
|
||||
1};
|
||||
const DiscreteTypeInfo &get_type_info() const override { return type_info; }
|
||||
};
|
||||
} // namespace ngraph
|
||||
|
||||
} // namespace ov
|
||||
|
||||
@@ -80,8 +80,11 @@ bool op::Eltwise::visit_attributes(AttributeVisitor &visitor) {
|
||||
visitor.on_attribute("operation", eltwise_type);
|
||||
return true;
|
||||
}
|
||||
std::ostream &operator<<(std::ostream &s, const ELTWISE_TYPE &type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
namespace ngraph {
|
||||
namespace ov {
|
||||
template <> EnumNames<ELTWISE_TYPE> &EnumNames<ELTWISE_TYPE>::get() {
|
||||
static auto enum_names =
|
||||
EnumNames<ELTWISE_TYPE>("ELTWISE_TYPE", {{"sum", ELTWISE_TYPE::Sum},
|
||||
@@ -95,7 +98,4 @@ template <> EnumNames<ELTWISE_TYPE> &EnumNames<ELTWISE_TYPE>::get() {
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<ELTWISE_TYPE>::type_info;
|
||||
|
||||
std::ostream &operator<<(std::ostream &s, const ELTWISE_TYPE &type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
} // namespace ngraph
|
||||
} // namespace ov
|
||||
|
||||
@@ -80,14 +80,18 @@ private:
|
||||
FrameworkNodeAttrs m_attrs;
|
||||
};
|
||||
} // namespace op
|
||||
} // namespace ngraph
|
||||
|
||||
namespace ov {
|
||||
|
||||
template <>
|
||||
class TRANSFORMATIONS_API AttributeAdapter<op::FrameworkNodeAttrs>
|
||||
: public DirectValueAccessor<op::FrameworkNodeAttrs> {
|
||||
class TRANSFORMATIONS_API AttributeAdapter<ngraph::op::FrameworkNodeAttrs>
|
||||
: public DirectValueAccessor<ngraph::op::FrameworkNodeAttrs> {
|
||||
public:
|
||||
AttributeAdapter(op::FrameworkNodeAttrs& value);
|
||||
AttributeAdapter(ngraph::op::FrameworkNodeAttrs& value);
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<FrameworkNodeAttr>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override { return type_info; }
|
||||
};
|
||||
} // namespace ngraph
|
||||
|
||||
} // namespace ov
|
||||
|
||||
@@ -95,8 +95,8 @@ void op::FrameworkNode::validate_and_infer_types() {
|
||||
}
|
||||
}
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<op::FrameworkNodeAttrs>::type_info;
|
||||
constexpr ov::DiscreteTypeInfo ov::AttributeAdapter<op::FrameworkNodeAttrs>::type_info;
|
||||
|
||||
AttributeAdapter<op::FrameworkNodeAttrs>::AttributeAdapter(
|
||||
ov::AttributeAdapter<op::FrameworkNodeAttrs>::AttributeAdapter(
|
||||
op::FrameworkNodeAttrs& value)
|
||||
: DirectValueAccessor<op::FrameworkNodeAttrs>(value) {}
|
||||
|
||||
+3
-3
@@ -620,7 +620,7 @@ TEST(TransformationTests, DummyOpNegativeDifferentStringVector) {
|
||||
EXPECT_THAT(res.message, HasSubstr(" mismatch in value: 'member' : [a, ba] vs [b, ab]"));
|
||||
}
|
||||
|
||||
namespace ngraph {
|
||||
namespace ov {
|
||||
|
||||
struct TestDummyDataTypeTransformationTests_NO_NGRAPH_NAME_COLISION {};
|
||||
|
||||
@@ -643,10 +643,10 @@ public:
|
||||
constexpr DiscreteTypeInfo
|
||||
AttributeAdapter<TestDummyDataTypeTransformationTests_NO_NGRAPH_NAME_COLISION>::type_info;
|
||||
|
||||
} // namespace ngraph
|
||||
} // namespace ov
|
||||
|
||||
TEST(TransformationTests, DummyOpNegativeNotSupportedType) {
|
||||
TestDummyDataTypeTransformationTests_NO_NGRAPH_NAME_COLISION m{};
|
||||
ov::TestDummyDataTypeTransformationTests_NO_NGRAPH_NAME_COLISION m{};
|
||||
const auto& f1 = createDummyFunc(m);
|
||||
const auto& f2 = createDummyFunc(m);
|
||||
|
||||
|
||||
@@ -10,464 +10,27 @@
|
||||
|
||||
#include "ngraph/enum_names.hpp"
|
||||
#include "ngraph/type.hpp"
|
||||
#include "openvino/core/attribute_adapter.hpp"
|
||||
|
||||
///
|
||||
namespace ngraph {
|
||||
class AttributeVisitor;
|
||||
|
||||
/// \brief Provides access to an attribute of type AT as a value accessor type VAT
|
||||
template <typename VAT>
|
||||
class ValueAccessor;
|
||||
using ov::ValueAccessor;
|
||||
|
||||
/// \brief ValueAccessor<void> provides an accessor for values that do not have get/set methonds
|
||||
/// via AttributeVistor.on_adapter.
|
||||
///
|
||||
/// All ValueAccessors must be derived from ValueAccessor<void> so that an AttributeVisitor
|
||||
/// only needs to implement a subset of the on_adapter methods.
|
||||
template <>
|
||||
class NGRAPH_API ValueAccessor<void> {
|
||||
public:
|
||||
/// \brief type info enables identification of the value accessor, as well as is_type and
|
||||
/// as_type.
|
||||
virtual const DiscreteTypeInfo& get_type_info() const = 0;
|
||||
virtual ~ValueAccessor() {}
|
||||
};
|
||||
using ov::DirectValueAccessor;
|
||||
|
||||
/// \brief Provides access to values via get/set methods from an m_value, typically from
|
||||
/// ValueReference
|
||||
///
|
||||
/// The m_buffer holds a VAT, which may be wider than the attribute AT. For example, serializers
|
||||
/// that only
|
||||
/// support int64_t integers would use a ValueAccessor<vector<int64_t>> to reference a
|
||||
/// vector<int8_t> attribute. Destruction moves the value back to the attribute if it was
|
||||
/// changed.
|
||||
/// \tparam VAT The adapter value type; may be wider than the value being accessed.
|
||||
template <typename VAT>
|
||||
class ValueAccessor : public ValueAccessor<void> {
|
||||
public:
|
||||
/// Returns the value
|
||||
virtual const VAT& get() = 0;
|
||||
/// Sets the value
|
||||
virtual void set(const VAT& value) = 0;
|
||||
};
|
||||
|
||||
template <>
|
||||
class ValueAccessor<void*> : public ValueAccessor<void> {
|
||||
public:
|
||||
virtual void* get_ptr() = 0;
|
||||
virtual size_t size() = 0;
|
||||
};
|
||||
|
||||
template <typename AT>
|
||||
class DirectValueAccessor : public ValueAccessor<AT> {
|
||||
public:
|
||||
DirectValueAccessor(AT& ref) : m_ref(ref) {}
|
||||
const AT& get() override {
|
||||
return m_ref;
|
||||
}
|
||||
void set(const AT& value) override {
|
||||
m_ref = value;
|
||||
}
|
||||
|
||||
protected:
|
||||
AT& m_ref;
|
||||
};
|
||||
|
||||
template <typename AT, typename VAT>
|
||||
class IndirectScalarValueAccessor : public ValueAccessor<VAT> {
|
||||
public:
|
||||
IndirectScalarValueAccessor(AT& ref) : m_ref(ref), m_buffer() {}
|
||||
|
||||
const VAT& get() override {
|
||||
if (!m_buffer_valid) {
|
||||
m_buffer = static_cast<VAT>(m_ref);
|
||||
m_buffer_valid = true;
|
||||
}
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
void set(const VAT& value) override {
|
||||
m_ref = static_cast<AT>(value);
|
||||
m_buffer_valid = false;
|
||||
}
|
||||
|
||||
protected:
|
||||
AT& m_ref;
|
||||
VAT m_buffer;
|
||||
bool m_buffer_valid{false};
|
||||
};
|
||||
using ov::IndirectScalarValueAccessor;
|
||||
|
||||
template <typename A, typename B>
|
||||
A copy_from(B& b) {
|
||||
A result(b.size());
|
||||
for (size_t i = 0; i < b.size(); ++i) {
|
||||
result[i] = static_cast<typename std::remove_reference<decltype(result[i])>::type>(b[i]);
|
||||
}
|
||||
return result;
|
||||
return ov::copy_from<A>(b);
|
||||
}
|
||||
|
||||
template <typename AT, typename VAT>
|
||||
class IndirectVectorValueAccessor : public ValueAccessor<VAT> {
|
||||
public:
|
||||
IndirectVectorValueAccessor(AT& ref) : m_ref(ref) {}
|
||||
using ov::IndirectVectorValueAccessor;
|
||||
|
||||
const VAT& get() override {
|
||||
if (!m_buffer_valid) {
|
||||
m_buffer = copy_from<typename std::remove_cv<VAT>::type>(m_ref);
|
||||
m_buffer_valid = true;
|
||||
}
|
||||
return m_buffer;
|
||||
}
|
||||
using ov::AttributeAdapter;
|
||||
using ov::EnumAttributeAdapterBase;
|
||||
|
||||
void set(const VAT& value) override {
|
||||
m_ref = copy_from<AT>(value);
|
||||
m_buffer_valid = false;
|
||||
}
|
||||
using ov::VisitorAdapter;
|
||||
|
||||
operator AT&() {
|
||||
return m_ref;
|
||||
}
|
||||
|
||||
protected:
|
||||
AT& m_ref;
|
||||
VAT m_buffer;
|
||||
bool m_buffer_valid{false};
|
||||
};
|
||||
|
||||
/// \brief An AttributeAdapter "captures" an attribute as an AT& and makes it available as a
|
||||
/// ValueAccessor<VAT>.
|
||||
template <typename AT>
|
||||
class AttributeAdapter {};
|
||||
|
||||
/// \brief Access an enum via a string
|
||||
/// \tparam AT The attribute type enum class
|
||||
template <typename AT>
|
||||
class EnumAttributeAdapterBase : public ValueAccessor<std::string> {
|
||||
public:
|
||||
EnumAttributeAdapterBase(AT& value) : m_ref(value) {}
|
||||
|
||||
const std::string& get() override {
|
||||
return as_string(m_ref);
|
||||
}
|
||||
void set(const std::string& value) override {
|
||||
m_ref = as_enum<AT>(value);
|
||||
}
|
||||
operator AT&() {
|
||||
return m_ref;
|
||||
}
|
||||
|
||||
protected:
|
||||
AT& m_ref;
|
||||
};
|
||||
|
||||
/// Adapters will see visitor
|
||||
class VisitorAdapter : public ValueAccessor<void> {
|
||||
public:
|
||||
virtual bool visit_attributes(AttributeVisitor& visitor) = 0;
|
||||
};
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<float> : public IndirectScalarValueAccessor<float, double> {
|
||||
public:
|
||||
AttributeAdapter(float& value) : IndirectScalarValueAccessor<float, double>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<float>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a double as a double
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<double> : public DirectValueAccessor<double> {
|
||||
public:
|
||||
AttributeAdapter(double& value) : DirectValueAccessor<double>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<double>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a string as a string
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<std::string> : public DirectValueAccessor<std::string> {
|
||||
public:
|
||||
AttributeAdapter(std::string& value) : DirectValueAccessor<std::string>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<string>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a bool as a bool
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<bool> : public DirectValueAccessor<bool> {
|
||||
public:
|
||||
AttributeAdapter(bool& value) : DirectValueAccessor<bool>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<bool>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access an int8_t and an int64_t
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<int8_t> : public IndirectScalarValueAccessor<int8_t, int64_t> {
|
||||
public:
|
||||
AttributeAdapter(int8_t& value) : IndirectScalarValueAccessor<int8_t, int64_t>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<int8_t>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access an int16_t as an int64_t
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<int16_t> : public IndirectScalarValueAccessor<int16_t, int64_t> {
|
||||
public:
|
||||
AttributeAdapter(int16_t& value) : IndirectScalarValueAccessor<int16_t, int64_t>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<int16_t>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access an int32_t as an int64_t
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<int32_t> : public IndirectScalarValueAccessor<int32_t, int64_t> {
|
||||
public:
|
||||
AttributeAdapter(int32_t& value) : IndirectScalarValueAccessor<int32_t, int64_t>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<int32_t>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access an int64_t as an int64_t
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<int64_t> : public DirectValueAccessor<int64_t> {
|
||||
public:
|
||||
AttributeAdapter(int64_t& value) : DirectValueAccessor<int64_t>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<int64_t>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a uint8_t as an int64_t
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<uint8_t> : public IndirectScalarValueAccessor<uint8_t, int64_t> {
|
||||
public:
|
||||
AttributeAdapter(uint8_t& value) : IndirectScalarValueAccessor<uint8_t, int64_t>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<uint8_t>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a uint16_t as an int64_t
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<uint16_t> : public IndirectScalarValueAccessor<uint16_t, int64_t> {
|
||||
public:
|
||||
AttributeAdapter(uint16_t& value) : IndirectScalarValueAccessor<uint16_t, int64_t>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<uint16_t>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a uint32_t as an int64_t
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<uint32_t> : public IndirectScalarValueAccessor<uint32_t, int64_t> {
|
||||
public:
|
||||
AttributeAdapter(uint32_t& value) : IndirectScalarValueAccessor<uint32_t, int64_t>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<uint32_t>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a uint64_t as an int64_t
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<uint64_t> : public IndirectScalarValueAccessor<uint64_t, int64_t> {
|
||||
public:
|
||||
AttributeAdapter(uint64_t& value) : IndirectScalarValueAccessor<uint64_t, int64_t>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<uint64_t>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef __APPLE__
|
||||
// size_t is one of the uint types on _WIN32
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<size_t> : public IndirectScalarValueAccessor<size_t, int64_t> {
|
||||
public:
|
||||
AttributeAdapter(size_t& value) : IndirectScalarValueAccessor<size_t, int64_t>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<size_t>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<std::vector<size_t>>
|
||||
: public IndirectVectorValueAccessor<std::vector<size_t>, std::vector<int64_t>> {
|
||||
public:
|
||||
AttributeAdapter(std::vector<size_t>& value)
|
||||
: IndirectVectorValueAccessor<std::vector<size_t>, std::vector<int64_t>>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<vector<size_t>>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
/// Note: These class bodies cannot be defined with templates because of interactions
|
||||
/// between dllexport and templates on Windows.
|
||||
|
||||
/// \brief Access a vector<int8_t>
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<std::vector<int8_t>> : public DirectValueAccessor<std::vector<int8_t>> {
|
||||
public:
|
||||
AttributeAdapter(std::vector<int8_t>& value) : DirectValueAccessor<std::vector<int8_t>>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<vector<int8_t>>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a vector<int16_t>
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<std::vector<int16_t>> : public DirectValueAccessor<std::vector<int16_t>> {
|
||||
public:
|
||||
AttributeAdapter(std::vector<int16_t>& value) : DirectValueAccessor<std::vector<int16_t>>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<vector<int16_t>>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a vector<int32_t>
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<std::vector<int32_t>> : public DirectValueAccessor<std::vector<int32_t>> {
|
||||
public:
|
||||
AttributeAdapter(std::vector<int32_t>& value) : DirectValueAccessor<std::vector<int32_t>>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<vector<int32_t>>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a vector<int64_t>
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<std::vector<int64_t>> : public DirectValueAccessor<std::vector<int64_t>> {
|
||||
public:
|
||||
AttributeAdapter(std::vector<int64_t>& value) : DirectValueAccessor<std::vector<int64_t>>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<vector<int64_t>>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a vector<uint8_t>
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<std::vector<uint8_t>> : public DirectValueAccessor<std::vector<uint8_t>> {
|
||||
public:
|
||||
AttributeAdapter(std::vector<uint8_t>& value) : DirectValueAccessor<std::vector<uint8_t>>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<vector<uint8_t>>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a vector<uint16_t>
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<std::vector<uint16_t>> : public DirectValueAccessor<std::vector<uint16_t>> {
|
||||
public:
|
||||
AttributeAdapter(std::vector<uint16_t>& value) : DirectValueAccessor<std::vector<uint16_t>>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<vector<uint16_t>>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a vector<uint32_t>
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<std::vector<uint32_t>> : public DirectValueAccessor<std::vector<uint32_t>> {
|
||||
public:
|
||||
AttributeAdapter(std::vector<uint32_t>& value) : DirectValueAccessor<std::vector<uint32_t>>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<vector<uint32_t>>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a vector<uint64_t>
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<std::vector<uint64_t>> : public DirectValueAccessor<std::vector<uint64_t>> {
|
||||
public:
|
||||
AttributeAdapter(std::vector<uint64_t>& value) : DirectValueAccessor<std::vector<uint64_t>>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<vector<uint64_t>>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a vector<float>
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<std::vector<float>> : public DirectValueAccessor<std::vector<float>> {
|
||||
public:
|
||||
AttributeAdapter(std::vector<float>& value) : DirectValueAccessor<std::vector<float>>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<vector<float>>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a vector<double>
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<std::vector<double>> : public DirectValueAccessor<std::vector<double>> {
|
||||
public:
|
||||
AttributeAdapter(std::vector<double>& value) : DirectValueAccessor<std::vector<double>>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<vector<double>>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a vector<string>
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<std::vector<std::string>> : public DirectValueAccessor<std::vector<std::string>> {
|
||||
public:
|
||||
AttributeAdapter(std::vector<std::string>& value) : DirectValueAccessor<std::vector<std::string>>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<vector<string>>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
} // namespace ngraph
|
||||
|
||||
@@ -11,128 +11,8 @@
|
||||
#include "ngraph/partial_shape.hpp"
|
||||
#include "ngraph/type.hpp"
|
||||
#include "ngraph/type/element_type.hpp"
|
||||
#include "openvino/core/attribute_visitor.hpp"
|
||||
|
||||
namespace ov {
|
||||
class Function;
|
||||
}
|
||||
namespace ngraph {
|
||||
template <typename T>
|
||||
class ValueAccessor;
|
||||
class VisitorAdapter;
|
||||
class Node;
|
||||
|
||||
/// \brief Visits the attributes of a node, primarily for serialization-like tasks.
|
||||
///
|
||||
/// Attributes are the node parameters that are always compile-time constants.
|
||||
/// Values computed from the graph topology and attributes during compilation are not
|
||||
/// attributes.
|
||||
///
|
||||
/// Attributes have a wide variety of types, but serialization formats are more restricted.
|
||||
/// We asume serialation easily supports scalar types of bool 64-bit signed, string, and double,
|
||||
/// and has specialized ways to support numeric arrays and raw data+size. The visitor and
|
||||
/// adapter convert between the limited serialization types and the unlimited attribute types.
|
||||
///
|
||||
/// A visitor is passed to an op's visit_attributes method. The visit_attributes method calls
|
||||
/// the template method visitor.on_attribute<AT>(const std::string& name, AT& value) on each
|
||||
/// attribute. The visitor can read or write the attribute's value. The on_attribute
|
||||
/// method creates an AttributeAdapter<AT> for the value and passes it to one of the visitors
|
||||
/// on_adapter methods. The on_adapter methods expect a reference to a ValueAccessor<VAT> or a
|
||||
/// VisitorAdapter. A ValueAccessor<VAT> has get/set methods that can be used to read/write the
|
||||
/// attribute value as type VAT. These methods are triggered by deriving AttributeAdapter<AT>
|
||||
/// from ValueAccessor<VAT>. For more complex cases, such as structs, the on_adapter method for
|
||||
/// VisitorAdapter passes the name and visitor to the adapter, so that the adapter can perform
|
||||
/// additional work such as visiting struct members or sequence values.
|
||||
///
|
||||
/// When a node visits an attribute with structure, the node's on_attribute passes a name for
|
||||
/// the entire attribute, but the struct will have its own methods to be visited. Similarly, a
|
||||
/// vector will have a sequence of members to be visited. The adapter may use the visitor
|
||||
/// methods start_struct/finish_struct and start_vector/next_vector/finish_vector to inidicate
|
||||
/// nexted members.
|
||||
///
|
||||
/// The visitor method get_name_with_context creates a generic nested version of the name.
|
||||
/// Visitors can override according to their serialization requirements.
|
||||
///
|
||||
/// Attributes that are shared_ptr<Node> are special. They must have been already been
|
||||
/// registered with the visitor using register_node, which needs a shared pointer to a node and
|
||||
/// a string ID. The ID string will be used to serialize the node or find the node during
|
||||
/// deserialization.
|
||||
class NGRAPH_API AttributeVisitor {
|
||||
public:
|
||||
virtual ~AttributeVisitor() {}
|
||||
// Must implement these methods
|
||||
/// \brief handles all specialized on_adapter methods implemented by the visitor.
|
||||
///
|
||||
/// The adapter implements get_type_info(), which can be used to determine the adapter
|
||||
/// directly
|
||||
/// or via is_type and as_type on any platform
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<void>& adapter) = 0;
|
||||
// The remaining adapter methods fall back on the void adapter if not implemented
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<void*>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<std::string>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<bool>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<int8_t>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<int16_t>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<int32_t>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<int64_t>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<uint8_t>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<uint16_t>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<uint32_t>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<uint64_t>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<float>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<double>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<std::vector<int8_t>>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<std::vector<int16_t>>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<std::vector<int32_t>>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<std::vector<int64_t>>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<std::vector<uint8_t>>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<std::vector<uint16_t>>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<std::vector<uint32_t>>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<std::vector<uint64_t>>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<std::vector<float>>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<std::vector<double>>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<std::vector<std::string>>& adapter);
|
||||
/// \brief Hook for adapters that need visitor access
|
||||
virtual void on_adapter(const std::string& name, VisitorAdapter& adapter);
|
||||
|
||||
/// \brief Provides API to handle nGraph Function attribute type, accessed as ValueAccessor
|
||||
/// \param name attribute name
|
||||
/// \param adapter reference to a Function ValueAccessor<VAT>
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<std::shared_ptr<ov::Function>>& adapter);
|
||||
|
||||
/// The generic visitor. There must be a definition of AttributeAdapter<T> that can convert
|
||||
/// to a ValueAccessor<U> for one of the on_adpater methods.
|
||||
template <typename AT>
|
||||
void on_attribute(const std::string& name, AT& value) {
|
||||
AttributeAdapter<AT> adapter(value);
|
||||
start_structure(name);
|
||||
on_adapter(get_name_with_context(), adapter);
|
||||
finish_structure();
|
||||
}
|
||||
/// \returns The nested context of visits
|
||||
const std::vector<std::string>& get_context() const {
|
||||
return m_context;
|
||||
}
|
||||
/// \returns context prepended to names
|
||||
virtual std::string get_name_with_context();
|
||||
/// \brief Start visiting a nested structure
|
||||
virtual void start_structure(const std::string& name);
|
||||
/// \brief Finish visiting a nested structure
|
||||
virtual std::string finish_structure();
|
||||
using node_id_t = std::string;
|
||||
static const node_id_t invalid_node_id;
|
||||
/// \brief Associate a node with an id.
|
||||
///
|
||||
/// No node may be used as an attribute unless it has already been registered with an ID.
|
||||
/// References to nodes are visited with a ValueAccessor of their ID.
|
||||
virtual void register_node(const std::shared_ptr<Node>& node, node_id_t id = invalid_node_id);
|
||||
/// Returns the node with the given id, or nullptr if there is no registered node
|
||||
virtual std::shared_ptr<Node> get_registered_node(node_id_t id);
|
||||
/// Returns the id for the node, or -1 if the node is not registered
|
||||
virtual node_id_t get_registered_node_id(const std::shared_ptr<Node>& node);
|
||||
|
||||
protected:
|
||||
std::vector<std::string> m_context;
|
||||
std::unordered_map<std::shared_ptr<Node>, node_id_t> m_node_id_map;
|
||||
std::unordered_map<node_id_t, std::shared_ptr<Node>> m_id_node_map;
|
||||
};
|
||||
using ov::AttributeVisitor;
|
||||
} // namespace ngraph
|
||||
|
||||
@@ -33,10 +33,16 @@ public:
|
||||
NGRAPH_API std::vector<int64_t> to_vector() const;
|
||||
};
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const AxisSet& axis_set);
|
||||
} // namespace ngraph
|
||||
|
||||
namespace ov {
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<AxisSet> : public ValueAccessor<std::vector<int64_t>> {
|
||||
class NGRAPH_API AttributeAdapter<ngraph::AxisSet> : public ValueAccessor<std::vector<int64_t>> {
|
||||
public:
|
||||
AttributeAdapter(AxisSet& value) : m_ref(value) {}
|
||||
AttributeAdapter(ngraph::AxisSet& value) : m_ref(value) {}
|
||||
|
||||
const std::vector<int64_t>& get() override;
|
||||
void set(const std::vector<int64_t>& value) override;
|
||||
@@ -44,16 +50,14 @@ public:
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
operator AxisSet&() {
|
||||
operator ngraph::AxisSet&() {
|
||||
return m_ref;
|
||||
}
|
||||
|
||||
protected:
|
||||
AxisSet& m_ref;
|
||||
ngraph::AxisSet& m_ref;
|
||||
std::vector<int64_t> m_buffer;
|
||||
bool m_buffer_valid{false};
|
||||
};
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const AxisSet& axis_set);
|
||||
} // namespace ngraph
|
||||
} // namespace ov
|
||||
|
||||
@@ -35,10 +35,18 @@ public:
|
||||
NGRAPH_API AxisVector& operator=(AxisVector&& v) noexcept;
|
||||
};
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const AxisVector& axis_vector);
|
||||
} // namespace ngraph
|
||||
|
||||
namespace ov {
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<AxisVector> : public IndirectVectorValueAccessor<AxisVector, std::vector<int64_t>> {
|
||||
class NGRAPH_API AttributeAdapter<ngraph::AxisVector>
|
||||
: public IndirectVectorValueAccessor<ngraph::AxisVector, std::vector<int64_t>> {
|
||||
public:
|
||||
AttributeAdapter(AxisVector& value) : IndirectVectorValueAccessor<AxisVector, std::vector<int64_t>>(value) {}
|
||||
AttributeAdapter(ngraph::AxisVector& value)
|
||||
: IndirectVectorValueAccessor<ngraph::AxisVector, std::vector<int64_t>>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<AxisVector>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
@@ -46,6 +54,4 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const AxisVector& axis_vector);
|
||||
} // namespace ngraph
|
||||
} // namespace ov
|
||||
|
||||
@@ -36,17 +36,21 @@ public:
|
||||
NGRAPH_API Coordinate& operator=(Coordinate&& v) noexcept;
|
||||
};
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const Coordinate& coordinate);
|
||||
} // namespace ngraph
|
||||
|
||||
namespace ov {
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<Coordinate> : public IndirectVectorValueAccessor<Coordinate, std::vector<int64_t>> {
|
||||
class NGRAPH_API AttributeAdapter<ngraph::Coordinate>
|
||||
: public IndirectVectorValueAccessor<ngraph::Coordinate, std::vector<int64_t>> {
|
||||
public:
|
||||
AttributeAdapter(Coordinate& value) : IndirectVectorValueAccessor<Coordinate, std::vector<int64_t>>(value) {}
|
||||
AttributeAdapter(ngraph::Coordinate& value)
|
||||
: IndirectVectorValueAccessor<ngraph::Coordinate, std::vector<int64_t>>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<Coordinate>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const Coordinate& coordinate);
|
||||
} // namespace ngraph
|
||||
} // namespace ov
|
||||
|
||||
@@ -35,14 +35,20 @@ public:
|
||||
NGRAPH_API CoordinateDiff& operator=(CoordinateDiff&& v) noexcept;
|
||||
};
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const CoordinateDiff& coordinate_diff);
|
||||
} // namespace ngraph
|
||||
|
||||
namespace ov {
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<CoordinateDiff>
|
||||
: public IndirectVectorValueAccessor<CoordinateDiff, std::vector<int64_t>>
|
||||
class NGRAPH_API AttributeAdapter<ngraph::CoordinateDiff>
|
||||
: public IndirectVectorValueAccessor<ngraph::CoordinateDiff, std::vector<int64_t>>
|
||||
|
||||
{
|
||||
public:
|
||||
AttributeAdapter(CoordinateDiff& value)
|
||||
: IndirectVectorValueAccessor<CoordinateDiff, std::vector<int64_t>>(value) {}
|
||||
AttributeAdapter(ngraph::CoordinateDiff& value)
|
||||
: IndirectVectorValueAccessor<ngraph::CoordinateDiff, std::vector<int64_t>>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<CoordinateDiff>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
@@ -50,6 +56,4 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const CoordinateDiff& coordinate_diff);
|
||||
} // namespace ngraph
|
||||
} // namespace ov
|
||||
|
||||
@@ -25,14 +25,19 @@ NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& out, const Type& obj);
|
||||
} // namespace reduction
|
||||
|
||||
} // namespace ngraph
|
||||
|
||||
namespace ov {
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<reduction::Type> : public EnumAttributeAdapterBase<reduction::Type> {
|
||||
class NGRAPH_API AttributeAdapter<ngraph::reduction::Type> : public EnumAttributeAdapterBase<ngraph::reduction::Type> {
|
||||
public:
|
||||
AttributeAdapter(reduction::Type& value) : EnumAttributeAdapterBase<reduction::Type>(value) {}
|
||||
AttributeAdapter(ngraph::reduction::Type& value) : EnumAttributeAdapterBase<ngraph::reduction::Type>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<reduction::Type>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
} // namespace ngraph
|
||||
|
||||
} // namespace ov
|
||||
|
||||
@@ -4,67 +4,20 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "ngraph/check.hpp"
|
||||
#include "openvino/core/enum_names.hpp"
|
||||
|
||||
namespace ngraph {
|
||||
/// Uses a pairings defined by EnumTypes::get() to convert between strings
|
||||
/// and enum values.
|
||||
template <typename EnumType>
|
||||
class EnumNames {
|
||||
public:
|
||||
/// Converts strings to enum values
|
||||
static EnumType as_enum(const std::string& name) {
|
||||
auto to_lower = [](const std::string& s) {
|
||||
std::string rc = s;
|
||||
std::transform(rc.begin(), rc.end(), rc.begin(), [](char c) {
|
||||
return static_cast<char>(::tolower(static_cast<int>(c)));
|
||||
});
|
||||
return rc;
|
||||
};
|
||||
for (const auto& p : get().m_string_enums) {
|
||||
if (to_lower(p.first) == to_lower(name)) {
|
||||
return p.second;
|
||||
}
|
||||
}
|
||||
NGRAPH_CHECK(false, "\"", name, "\"", " is not a member of enum ", get().m_enum_name);
|
||||
}
|
||||
|
||||
/// Converts enum values to strings
|
||||
static const std::string& as_string(EnumType e) {
|
||||
for (const auto& p : get().m_string_enums) {
|
||||
if (p.second == e) {
|
||||
return p.first;
|
||||
}
|
||||
}
|
||||
NGRAPH_CHECK(false, " invalid member of enum ", get().m_enum_name);
|
||||
}
|
||||
|
||||
private:
|
||||
/// Creates the mapping.
|
||||
EnumNames(const std::string& enum_name, const std::vector<std::pair<std::string, EnumType>> string_enums)
|
||||
: m_enum_name(enum_name),
|
||||
m_string_enums(string_enums) {}
|
||||
|
||||
/// Must be defined to returns a singleton for each supported enum class
|
||||
static EnumNames<EnumType>& get();
|
||||
|
||||
const std::string m_enum_name;
|
||||
std::vector<std::pair<std::string, EnumType>> m_string_enums;
|
||||
};
|
||||
|
||||
using ov::EnumNames;
|
||||
/// Returns the enum value matching the string
|
||||
template <typename Type, typename Value>
|
||||
typename std::enable_if<std::is_convertible<Value, std::string>::value, Type>::type as_enum(const Value& value) {
|
||||
return EnumNames<Type>::as_enum(value);
|
||||
return ov::as_enum<Type>(value);
|
||||
}
|
||||
|
||||
/// Returns the string matching the enum value
|
||||
template <typename Value>
|
||||
const std::string& as_string(Value value) {
|
||||
return EnumNames<Value>::as_string(value);
|
||||
return ov::as_string(value);
|
||||
}
|
||||
} // namespace ngraph
|
||||
|
||||
@@ -44,7 +44,6 @@ class Input;
|
||||
template <typename NodeType>
|
||||
class Output;
|
||||
|
||||
class AttributeVisitor;
|
||||
class Node;
|
||||
|
||||
namespace runtime {
|
||||
@@ -649,38 +648,6 @@ struct RawNodeOutput {
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Visits a reference to a node that has been registered with the visitor.
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<std::shared_ptr<Node>> : public VisitorAdapter {
|
||||
public:
|
||||
AttributeAdapter(std::shared_ptr<Node>& value);
|
||||
|
||||
bool visit_attributes(AttributeVisitor& visitor) override;
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<std::shared_ptr<Node>>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
|
||||
protected:
|
||||
std::shared_ptr<Node>& m_ref;
|
||||
};
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<NodeVector> : public VisitorAdapter {
|
||||
public:
|
||||
AttributeAdapter(NodeVector& ref);
|
||||
|
||||
bool visit_attributes(AttributeVisitor& visitor) override;
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<NodeVector>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
|
||||
protected:
|
||||
NodeVector& m_ref;
|
||||
};
|
||||
|
||||
using RawNodeOutputMap = std::map<RawNodeOutput, Output<Node>>;
|
||||
|
||||
class NGRAPH_API NodeValidationFailure : public CheckFailure {
|
||||
@@ -705,3 +672,38 @@ void check_new_args_count(const Node* node, T new_args) {
|
||||
}
|
||||
|
||||
} // namespace ngraph
|
||||
|
||||
namespace ov {
|
||||
/// \brief Visits a reference to a node that has been registered with the visitor.
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<std::shared_ptr<ngraph::Node>> : public VisitorAdapter {
|
||||
public:
|
||||
AttributeAdapter(std::shared_ptr<ngraph::Node>& value);
|
||||
|
||||
bool visit_attributes(AttributeVisitor& visitor) override;
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<std::shared_ptr<Node>>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
|
||||
protected:
|
||||
std::shared_ptr<ngraph::Node>& m_ref;
|
||||
};
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<ngraph::NodeVector> : public VisitorAdapter {
|
||||
public:
|
||||
AttributeAdapter(ngraph::NodeVector& ref);
|
||||
|
||||
bool visit_attributes(AttributeVisitor& visitor) override;
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<NodeVector>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
|
||||
protected:
|
||||
ngraph::NodeVector& m_ref;
|
||||
};
|
||||
|
||||
} // namespace ov
|
||||
|
||||
@@ -126,12 +126,16 @@ protected:
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const op::v1::BinaryConvolution::BinaryConvolutionMode& type);
|
||||
|
||||
} // namespace ngraph
|
||||
|
||||
namespace ov {
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<op::v1::BinaryConvolution::BinaryConvolutionMode>
|
||||
: public EnumAttributeAdapterBase<op::v1::BinaryConvolution::BinaryConvolutionMode> {
|
||||
class NGRAPH_API AttributeAdapter<ngraph::op::v1::BinaryConvolution::BinaryConvolutionMode>
|
||||
: public EnumAttributeAdapterBase<ngraph::op::v1::BinaryConvolution::BinaryConvolutionMode> {
|
||||
public:
|
||||
AttributeAdapter(op::v1::BinaryConvolution::BinaryConvolutionMode& value)
|
||||
: EnumAttributeAdapterBase<op::v1::BinaryConvolution::BinaryConvolutionMode>(value) {}
|
||||
AttributeAdapter(ngraph::op::v1::BinaryConvolution::BinaryConvolutionMode& value)
|
||||
: EnumAttributeAdapterBase<ngraph::op::v1::BinaryConvolution::BinaryConvolutionMode>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::v1::BinaryConvolution::BinaryConvolutionMode>",
|
||||
0};
|
||||
@@ -140,4 +144,4 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace ngraph
|
||||
} // namespace ov
|
||||
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
DepthToSpaceMode get_mode() const {
|
||||
return m_mode;
|
||||
}
|
||||
virtual std::shared_ptr<Node> clone_with_new_inputs(const OutputVector& new_args) const override;
|
||||
std::shared_ptr<Node> clone_with_new_inputs(const OutputVector& new_args) const override;
|
||||
void validate_and_infer_types() override;
|
||||
bool evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const override;
|
||||
bool has_evaluate() const override;
|
||||
@@ -62,17 +62,20 @@ using v0::DepthToSpace;
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const op::v0::DepthToSpace::DepthToSpaceMode& type);
|
||||
} // namespace ngraph
|
||||
namespace ov {
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<op::v0::DepthToSpace::DepthToSpaceMode>
|
||||
: public EnumAttributeAdapterBase<op::v0::DepthToSpace::DepthToSpaceMode> {
|
||||
class NGRAPH_API AttributeAdapter<ngraph::op::v0::DepthToSpace::DepthToSpaceMode>
|
||||
: public EnumAttributeAdapterBase<ngraph::op::v0::DepthToSpace::DepthToSpaceMode> {
|
||||
public:
|
||||
AttributeAdapter(op::v0::DepthToSpace::DepthToSpaceMode& value)
|
||||
: EnumAttributeAdapterBase<op::v0::DepthToSpace::DepthToSpaceMode>(value) {}
|
||||
AttributeAdapter(ngraph::op::v0::DepthToSpace::DepthToSpaceMode& value)
|
||||
: EnumAttributeAdapterBase<ngraph::op::v0::DepthToSpace::DepthToSpaceMode>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::v0::DepthToSpace::DepthToSpaceMode>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
} // namespace ngraph
|
||||
|
||||
} // namespace ov
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
|
||||
void validate_and_infer_types() override;
|
||||
|
||||
virtual std::shared_ptr<Node> clone_with_new_inputs(const OutputVector& new_args) const override;
|
||||
std::shared_ptr<Node> clone_with_new_inputs(const OutputVector& new_args) const override;
|
||||
};
|
||||
} // namespace v0
|
||||
using v0::Gelu;
|
||||
@@ -68,15 +68,20 @@ private:
|
||||
};
|
||||
} // namespace v7
|
||||
} // namespace op
|
||||
} // namespace ngraph
|
||||
|
||||
namespace ov {
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<op::GeluApproximationMode>
|
||||
: public EnumAttributeAdapterBase<op::GeluApproximationMode> {
|
||||
class NGRAPH_API AttributeAdapter<ngraph::op::GeluApproximationMode>
|
||||
: public EnumAttributeAdapterBase<ngraph::op::GeluApproximationMode> {
|
||||
public:
|
||||
AttributeAdapter(op::GeluApproximationMode& value) : EnumAttributeAdapterBase<op::GeluApproximationMode>(value) {}
|
||||
AttributeAdapter(ngraph::op::GeluApproximationMode& value)
|
||||
: EnumAttributeAdapterBase<ngraph::op::GeluApproximationMode>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::GeluApproximationMode>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
} // namespace ngraph
|
||||
|
||||
} // namespace ov
|
||||
|
||||
@@ -283,30 +283,42 @@ using v0::InterpolateAttrs;
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const op::v0::Interpolate::InterpolateMode& type);
|
||||
|
||||
//---------------------------------------- v4 --------------------------------------------------
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const op::v4::Interpolate::InterpolateMode& type);
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const op::v4::Interpolate::CoordinateTransformMode& type);
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const op::v4::Interpolate::NearestMode& type);
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const op::v4::Interpolate::ShapeCalcMode& type);
|
||||
|
||||
} // namespace ngraph
|
||||
|
||||
namespace ov {
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<op::v0::Interpolate::InterpolateMode>
|
||||
: public EnumAttributeAdapterBase<op::v0::Interpolate::InterpolateMode> {
|
||||
class NGRAPH_API AttributeAdapter<ngraph::op::v0::Interpolate::InterpolateMode>
|
||||
: public EnumAttributeAdapterBase<ngraph::op::v0::Interpolate::InterpolateMode> {
|
||||
public:
|
||||
AttributeAdapter(op::v0::Interpolate::InterpolateMode& value)
|
||||
: EnumAttributeAdapterBase<op::v0::Interpolate::InterpolateMode>(value) {}
|
||||
AttributeAdapter(ngraph::op::v0::Interpolate::InterpolateMode& value)
|
||||
: EnumAttributeAdapterBase<ngraph::op::v0::Interpolate::InterpolateMode>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::v0::Interpolate::InterpolateMode>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
//---------------------------------------- v4 --------------------------------------------------
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const op::v4::Interpolate::InterpolateMode& type);
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<op::v4::Interpolate::InterpolateMode>
|
||||
: public EnumAttributeAdapterBase<op::v4::Interpolate::InterpolateMode> {
|
||||
class NGRAPH_API AttributeAdapter<ngraph::op::v4::Interpolate::InterpolateMode>
|
||||
: public EnumAttributeAdapterBase<ngraph::op::v4::Interpolate::InterpolateMode> {
|
||||
public:
|
||||
AttributeAdapter(op::v4::Interpolate::InterpolateMode& value)
|
||||
: EnumAttributeAdapterBase<op::v4::Interpolate::InterpolateMode>(value) {}
|
||||
AttributeAdapter(ngraph::op::v4::Interpolate::InterpolateMode& value)
|
||||
: EnumAttributeAdapterBase<ngraph::op::v4::Interpolate::InterpolateMode>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::v4::Interpolate::InterpolateMode>", 4};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
@@ -314,15 +326,12 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const op::v4::Interpolate::CoordinateTransformMode& type);
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<op::v4::Interpolate::CoordinateTransformMode>
|
||||
: public EnumAttributeAdapterBase<op::v4::Interpolate::CoordinateTransformMode> {
|
||||
class NGRAPH_API AttributeAdapter<ngraph::op::v4::Interpolate::CoordinateTransformMode>
|
||||
: public EnumAttributeAdapterBase<ngraph::op::v4::Interpolate::CoordinateTransformMode> {
|
||||
public:
|
||||
AttributeAdapter(op::v4::Interpolate::CoordinateTransformMode& value)
|
||||
: EnumAttributeAdapterBase<op::v4::Interpolate::CoordinateTransformMode>(value) {}
|
||||
AttributeAdapter(ngraph::op::v4::Interpolate::CoordinateTransformMode& value)
|
||||
: EnumAttributeAdapterBase<ngraph::op::v4::Interpolate::CoordinateTransformMode>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::v4::Interpolate::CoordinateTransformMode>", 4};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
@@ -330,15 +339,12 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const op::v4::Interpolate::NearestMode& type);
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<op::v4::Interpolate::NearestMode>
|
||||
: public EnumAttributeAdapterBase<op::v4::Interpolate::NearestMode> {
|
||||
class NGRAPH_API AttributeAdapter<ngraph::op::v4::Interpolate::NearestMode>
|
||||
: public EnumAttributeAdapterBase<ngraph::op::v4::Interpolate::NearestMode> {
|
||||
public:
|
||||
AttributeAdapter(op::v4::Interpolate::NearestMode& value)
|
||||
: EnumAttributeAdapterBase<op::v4::Interpolate::NearestMode>(value) {}
|
||||
AttributeAdapter(ngraph::op::v4::Interpolate::NearestMode& value)
|
||||
: EnumAttributeAdapterBase<ngraph::op::v4::Interpolate::NearestMode>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::v4::Interpolate::NearestMode>", 4};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
@@ -346,19 +352,16 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const op::v4::Interpolate::ShapeCalcMode& type);
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<op::v4::Interpolate::ShapeCalcMode>
|
||||
: public EnumAttributeAdapterBase<op::v4::Interpolate::ShapeCalcMode> {
|
||||
class NGRAPH_API AttributeAdapter<ngraph::op::v4::Interpolate::ShapeCalcMode>
|
||||
: public EnumAttributeAdapterBase<ngraph::op::v4::Interpolate::ShapeCalcMode> {
|
||||
public:
|
||||
AttributeAdapter(op::v4::Interpolate::ShapeCalcMode& value)
|
||||
: EnumAttributeAdapterBase<op::v4::Interpolate::ShapeCalcMode>(value) {}
|
||||
AttributeAdapter(ngraph::op::v4::Interpolate::ShapeCalcMode& value)
|
||||
: EnumAttributeAdapterBase<ngraph::op::v4::Interpolate::ShapeCalcMode>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::v4::Interpolate::ShapeCalcMode>", 4};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
} // namespace ngraph
|
||||
} // namespace ov
|
||||
|
||||
@@ -75,17 +75,21 @@ private:
|
||||
};
|
||||
} // namespace v5
|
||||
} // namespace op
|
||||
} // namespace ngraph
|
||||
|
||||
namespace ov {
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<op::v5::Loop::SpecialBodyPorts>
|
||||
: public DirectValueAccessor<op::v5::Loop::SpecialBodyPorts> {
|
||||
class NGRAPH_API AttributeAdapter<ngraph::op::v5::Loop::SpecialBodyPorts>
|
||||
: public DirectValueAccessor<ngraph::op::v5::Loop::SpecialBodyPorts> {
|
||||
public:
|
||||
AttributeAdapter(op::v5::Loop::SpecialBodyPorts& value)
|
||||
: DirectValueAccessor<op::v5::Loop::SpecialBodyPorts>(value) {}
|
||||
AttributeAdapter(ngraph::op::v5::Loop::SpecialBodyPorts& value)
|
||||
: DirectValueAccessor<ngraph::op::v5::Loop::SpecialBodyPorts>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::v5::Loop::SpecialBodyPorts>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
} // namespace ngraph
|
||||
|
||||
} // namespace ov
|
||||
|
||||
@@ -192,9 +192,9 @@ public:
|
||||
float clip = 0.f,
|
||||
bool input_forget = false);
|
||||
|
||||
virtual void validate_and_infer_types() override;
|
||||
void validate_and_infer_types() override;
|
||||
bool visit_attributes(AttributeVisitor& visitor) override;
|
||||
virtual std::shared_ptr<Node> clone_with_new_inputs(const OutputVector& new_args) const override;
|
||||
std::shared_ptr<Node> clone_with_new_inputs(const OutputVector& new_args) const override;
|
||||
|
||||
bool get_input_forget() const {
|
||||
return m_input_forget;
|
||||
@@ -383,15 +383,21 @@ private:
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const op::LSTMWeightsFormat& type);
|
||||
} // namespace ngraph
|
||||
|
||||
namespace ov {
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<op::LSTMWeightsFormat> : public EnumAttributeAdapterBase<op::LSTMWeightsFormat> {
|
||||
class NGRAPH_API AttributeAdapter<ngraph::op::LSTMWeightsFormat>
|
||||
: public EnumAttributeAdapterBase<ngraph::op::LSTMWeightsFormat> {
|
||||
public:
|
||||
AttributeAdapter(op::LSTMWeightsFormat& value) : EnumAttributeAdapterBase<op::LSTMWeightsFormat>(value) {}
|
||||
AttributeAdapter(ngraph::op::LSTMWeightsFormat& value)
|
||||
: EnumAttributeAdapterBase<ngraph::op::LSTMWeightsFormat>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::LSTMWeightsFormat>", 1};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
} // namespace ngraph
|
||||
|
||||
} // namespace ov
|
||||
|
||||
@@ -74,17 +74,21 @@ protected:
|
||||
} // namespace op
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const op::v8::MatrixNms::DecayFunction& type);
|
||||
} // namespace ngraph
|
||||
|
||||
namespace ov {
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<op::v8::MatrixNms::DecayFunction>
|
||||
: public EnumAttributeAdapterBase<op::v8::MatrixNms::DecayFunction> {
|
||||
class NGRAPH_API AttributeAdapter<ngraph::op::v8::MatrixNms::DecayFunction>
|
||||
: public EnumAttributeAdapterBase<ngraph::op::v8::MatrixNms::DecayFunction> {
|
||||
public:
|
||||
AttributeAdapter(op::v8::MatrixNms::DecayFunction& value)
|
||||
: EnumAttributeAdapterBase<op::v8::MatrixNms::DecayFunction>(value) {}
|
||||
AttributeAdapter(ngraph::op::v8::MatrixNms::DecayFunction& value)
|
||||
: EnumAttributeAdapterBase<ngraph::op::v8::MatrixNms::DecayFunction>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::v8::MatrixNms::DecayFunction>", 1};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
} // namespace ngraph
|
||||
|
||||
} // namespace ov
|
||||
|
||||
@@ -41,11 +41,11 @@ public:
|
||||
///
|
||||
MVN(const Output<Node>& data, AxisSet reduction_axes, bool normalize_variance = true, double eps = 1e-9);
|
||||
|
||||
virtual void validate_and_infer_types() override;
|
||||
void validate_and_infer_types() override;
|
||||
|
||||
bool visit_attributes(AttributeVisitor& visitor) override;
|
||||
|
||||
virtual std::shared_ptr<Node> clone_with_new_inputs(const OutputVector& new_args) const override;
|
||||
std::shared_ptr<Node> clone_with_new_inputs(const OutputVector& new_args) const override;
|
||||
|
||||
double get_eps() const {
|
||||
return m_eps;
|
||||
@@ -129,15 +129,19 @@ private:
|
||||
};
|
||||
} // namespace v6
|
||||
} // namespace op
|
||||
} // namespace ngraph
|
||||
|
||||
namespace ov {
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<op::MVNEpsMode> : public EnumAttributeAdapterBase<op::MVNEpsMode> {
|
||||
class NGRAPH_API AttributeAdapter<ngraph::op::MVNEpsMode> : public EnumAttributeAdapterBase<ngraph::op::MVNEpsMode> {
|
||||
public:
|
||||
AttributeAdapter(op::MVNEpsMode& value) : EnumAttributeAdapterBase<op::MVNEpsMode>(value) {}
|
||||
AttributeAdapter(ngraph::op::MVNEpsMode& value) : EnumAttributeAdapterBase<ngraph::op::MVNEpsMode>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::MVNEpsMode>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
} // namespace ngraph
|
||||
|
||||
} // namespace ov
|
||||
|
||||
@@ -366,12 +366,21 @@ protected:
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const op::v1::NonMaxSuppression::BoxEncodingType& type);
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const op::v3::NonMaxSuppression::BoxEncodingType& type);
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const op::v5::NonMaxSuppression::BoxEncodingType& type);
|
||||
} // namespace ngraph
|
||||
|
||||
namespace ov {
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<op::v1::NonMaxSuppression::BoxEncodingType>
|
||||
: public EnumAttributeAdapterBase<op::v1::NonMaxSuppression::BoxEncodingType> {
|
||||
class NGRAPH_API AttributeAdapter<ngraph::op::v1::NonMaxSuppression::BoxEncodingType>
|
||||
: public EnumAttributeAdapterBase<ngraph::op::v1::NonMaxSuppression::BoxEncodingType> {
|
||||
public:
|
||||
AttributeAdapter(op::v1::NonMaxSuppression::BoxEncodingType& value)
|
||||
: EnumAttributeAdapterBase<op::v1::NonMaxSuppression::BoxEncodingType>(value) {}
|
||||
AttributeAdapter(ngraph::op::v1::NonMaxSuppression::BoxEncodingType& value)
|
||||
: EnumAttributeAdapterBase<ngraph::op::v1::NonMaxSuppression::BoxEncodingType>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::v1::NonMaxSuppression::BoxEncodingType>", 1};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
@@ -379,15 +388,12 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const op::v3::NonMaxSuppression::BoxEncodingType& type);
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<op::v3::NonMaxSuppression::BoxEncodingType>
|
||||
: public EnumAttributeAdapterBase<op::v3::NonMaxSuppression::BoxEncodingType> {
|
||||
class NGRAPH_API AttributeAdapter<ngraph::op::v3::NonMaxSuppression::BoxEncodingType>
|
||||
: public EnumAttributeAdapterBase<ngraph::op::v3::NonMaxSuppression::BoxEncodingType> {
|
||||
public:
|
||||
AttributeAdapter(op::v3::NonMaxSuppression::BoxEncodingType& value)
|
||||
: EnumAttributeAdapterBase<op::v3::NonMaxSuppression::BoxEncodingType>(value) {}
|
||||
AttributeAdapter(ngraph::op::v3::NonMaxSuppression::BoxEncodingType& value)
|
||||
: EnumAttributeAdapterBase<ngraph::op::v3::NonMaxSuppression::BoxEncodingType>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::v3::NonMaxSuppression::BoxEncodingType>", 1};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
@@ -395,19 +401,17 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const op::v5::NonMaxSuppression::BoxEncodingType& type);
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<op::v5::NonMaxSuppression::BoxEncodingType>
|
||||
: public EnumAttributeAdapterBase<op::v5::NonMaxSuppression::BoxEncodingType> {
|
||||
class NGRAPH_API AttributeAdapter<ngraph::op::v5::NonMaxSuppression::BoxEncodingType>
|
||||
: public EnumAttributeAdapterBase<ngraph::op::v5::NonMaxSuppression::BoxEncodingType> {
|
||||
public:
|
||||
AttributeAdapter(op::v5::NonMaxSuppression::BoxEncodingType& value)
|
||||
: EnumAttributeAdapterBase<op::v5::NonMaxSuppression::BoxEncodingType>(value) {}
|
||||
AttributeAdapter(ngraph::op::v5::NonMaxSuppression::BoxEncodingType& value)
|
||||
: EnumAttributeAdapterBase<ngraph::op::v5::NonMaxSuppression::BoxEncodingType>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::v5::NonMaxSuppression::BoxEncodingType>", 1};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
} // namespace ngraph
|
||||
|
||||
} // namespace ov
|
||||
|
||||
@@ -59,11 +59,14 @@ protected:
|
||||
using v0::Parameter;
|
||||
} // namespace op
|
||||
using ParameterVector = std::vector<std::shared_ptr<op::Parameter>>;
|
||||
} // namespace ngraph
|
||||
|
||||
namespace ov {
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<ParameterVector> : public VisitorAdapter {
|
||||
class NGRAPH_API AttributeAdapter<ngraph::ParameterVector> : public VisitorAdapter {
|
||||
public:
|
||||
AttributeAdapter(ParameterVector& ref);
|
||||
AttributeAdapter(ngraph::ParameterVector& ref);
|
||||
|
||||
bool visit_attributes(AttributeVisitor& visitor) override;
|
||||
|
||||
@@ -73,6 +76,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
ParameterVector& m_ref;
|
||||
ngraph::ParameterVector& m_ref;
|
||||
};
|
||||
} // namespace ngraph
|
||||
|
||||
} // namespace ov
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
bool visit_attributes(AttributeVisitor& visitor) override;
|
||||
void validate_and_infer_types() override;
|
||||
|
||||
virtual std::shared_ptr<Node> clone_with_new_inputs(const OutputVector& new_args) const override;
|
||||
std::shared_ptr<Node> clone_with_new_inputs(const OutputVector& new_args) const override;
|
||||
|
||||
void set_needs_default_layout(bool val) {
|
||||
m_needs_default_layout = val;
|
||||
@@ -45,11 +45,14 @@ private:
|
||||
using v0::Result;
|
||||
} // namespace op
|
||||
using ResultVector = std::vector<std::shared_ptr<op::Result>>;
|
||||
} // namespace ngraph
|
||||
|
||||
namespace ov {
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<ResultVector> : public VisitorAdapter {
|
||||
class NGRAPH_API AttributeAdapter<ngraph::ResultVector> : public VisitorAdapter {
|
||||
public:
|
||||
AttributeAdapter(ResultVector& ref);
|
||||
AttributeAdapter(ngraph::ResultVector& ref);
|
||||
|
||||
bool visit_attributes(AttributeVisitor& visitor) override;
|
||||
|
||||
@@ -59,6 +62,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
ResultVector& m_ref;
|
||||
ngraph::ResultVector& m_ref;
|
||||
};
|
||||
} // namespace ngraph
|
||||
|
||||
} // namespace ov
|
||||
|
||||
@@ -29,7 +29,7 @@ public:
|
||||
bool visit_attributes(AttributeVisitor& visitor) override;
|
||||
void validate_and_infer_types() override;
|
||||
|
||||
virtual std::shared_ptr<Node> clone_with_new_inputs(const OutputVector& new_args) const override;
|
||||
std::shared_ptr<Node> clone_with_new_inputs(const OutputVector& new_args) const override;
|
||||
|
||||
/// \return The second input data interpretation mode.
|
||||
Mode get_mode() const {
|
||||
@@ -60,15 +60,21 @@ private:
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const op::v1::Reverse::Mode& type);
|
||||
} // namespace ngraph
|
||||
|
||||
namespace ov {
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<op::v1::Reverse::Mode> : public EnumAttributeAdapterBase<op::v1::Reverse::Mode> {
|
||||
class NGRAPH_API AttributeAdapter<ngraph::op::v1::Reverse::Mode>
|
||||
: public EnumAttributeAdapterBase<ngraph::op::v1::Reverse::Mode> {
|
||||
public:
|
||||
AttributeAdapter(op::v1::Reverse::Mode& value) : EnumAttributeAdapterBase<op::v1::Reverse::Mode>(value) {}
|
||||
AttributeAdapter(ngraph::op::v1::Reverse::Mode& value)
|
||||
: EnumAttributeAdapterBase<ngraph::op::v1::Reverse::Mode>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::v1::Reverse::Mode>", 1};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
} // namespace ngraph
|
||||
|
||||
} // namespace ov
|
||||
|
||||
@@ -48,9 +48,9 @@ public:
|
||||
const float spatial_scale,
|
||||
const PoolingMode mode);
|
||||
|
||||
virtual void validate_and_infer_types() override;
|
||||
void validate_and_infer_types() override;
|
||||
bool visit_attributes(AttributeVisitor& visitor) override;
|
||||
virtual std::shared_ptr<Node> clone_with_new_inputs(const OutputVector& new_args) const override;
|
||||
std::shared_ptr<Node> clone_with_new_inputs(const OutputVector& new_args) const override;
|
||||
|
||||
int get_pooled_h() const {
|
||||
return m_pooled_h;
|
||||
@@ -85,17 +85,21 @@ using v3::ROIAlign;
|
||||
} // namespace op
|
||||
|
||||
std::ostream& operator<<(std::ostream& s, const op::v3::ROIAlign::PoolingMode& mode);
|
||||
} // namespace ngraph
|
||||
|
||||
namespace ov {
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<op::v3::ROIAlign::PoolingMode>
|
||||
: public EnumAttributeAdapterBase<op::v3::ROIAlign::PoolingMode> {
|
||||
class NGRAPH_API AttributeAdapter<ngraph::op::v3::ROIAlign::PoolingMode>
|
||||
: public EnumAttributeAdapterBase<ngraph::op::v3::ROIAlign::PoolingMode> {
|
||||
public:
|
||||
AttributeAdapter(op::v3::ROIAlign::PoolingMode& value)
|
||||
: EnumAttributeAdapterBase<op::v3::ROIAlign::PoolingMode>(value) {}
|
||||
AttributeAdapter(ngraph::op::v3::ROIAlign::PoolingMode& value)
|
||||
: EnumAttributeAdapterBase<ngraph::op::v3::ROIAlign::PoolingMode>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::v3::ROIAlign::PoolingMode>", 3};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
} // namespace ngraph
|
||||
|
||||
} // namespace ov
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
bool visit_attributes(AttributeVisitor& visitor) override;
|
||||
void validate_and_infer_types() override;
|
||||
|
||||
virtual std::shared_ptr<Node> clone_with_new_inputs(const OutputVector& new_args) const override;
|
||||
std::shared_ptr<Node> clone_with_new_inputs(const OutputVector& new_args) const override;
|
||||
|
||||
bool evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const override;
|
||||
bool has_evaluate() const override;
|
||||
@@ -50,16 +50,21 @@ private:
|
||||
} // namespace op
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const op::v5::Round::RoundMode& type);
|
||||
} // namespace ngraph
|
||||
|
||||
namespace ov {
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<op::v5::Round::RoundMode>
|
||||
: public EnumAttributeAdapterBase<op::v5::Round::RoundMode> {
|
||||
class NGRAPH_API AttributeAdapter<ngraph::op::v5::Round::RoundMode>
|
||||
: public EnumAttributeAdapterBase<ngraph::op::v5::Round::RoundMode> {
|
||||
public:
|
||||
AttributeAdapter(op::v5::Round::RoundMode& value) : EnumAttributeAdapterBase<op::v5::Round::RoundMode>(value) {}
|
||||
AttributeAdapter(ngraph::op::v5::Round::RoundMode& value)
|
||||
: EnumAttributeAdapterBase<ngraph::op::v5::Round::RoundMode>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::v5::Round::RoundMode>", 5};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
} // namespace ngraph
|
||||
|
||||
} // namespace ov
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
return m_mode;
|
||||
}
|
||||
void validate_and_infer_types() override;
|
||||
virtual std::shared_ptr<Node> clone_with_new_inputs(const OutputVector& new_args) const override;
|
||||
std::shared_ptr<Node> clone_with_new_inputs(const OutputVector& new_args) const override;
|
||||
|
||||
bool evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const override;
|
||||
bool has_evaluate() const override;
|
||||
@@ -61,17 +61,21 @@ using v0::SpaceToDepth;
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const op::v0::SpaceToDepth::SpaceToDepthMode& type);
|
||||
} // namespace ngraph
|
||||
|
||||
namespace ov {
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<op::v0::SpaceToDepth::SpaceToDepthMode>
|
||||
: public EnumAttributeAdapterBase<op::v0::SpaceToDepth::SpaceToDepthMode> {
|
||||
class NGRAPH_API AttributeAdapter<ngraph::op::v0::SpaceToDepth::SpaceToDepthMode>
|
||||
: public EnumAttributeAdapterBase<ngraph::op::v0::SpaceToDepth::SpaceToDepthMode> {
|
||||
public:
|
||||
AttributeAdapter(op::v0::SpaceToDepth::SpaceToDepthMode& value)
|
||||
: EnumAttributeAdapterBase<op::v0::SpaceToDepth::SpaceToDepthMode>(value) {}
|
||||
AttributeAdapter(ngraph::op::v0::SpaceToDepth::SpaceToDepthMode& value)
|
||||
: EnumAttributeAdapterBase<ngraph::op::v0::SpaceToDepth::SpaceToDepthMode>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::v0::SpaceToDepth::SpaceToDepthMode>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
} // namespace ngraph
|
||||
|
||||
} // namespace ov
|
||||
|
||||
@@ -18,20 +18,7 @@ enum class PadMode { CONSTANT = 0, EDGE, REFLECT, SYMMETRIC };
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const PadMode& type);
|
||||
} // namespace op
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<op::PadMode> : public EnumAttributeAdapterBase<op::PadMode> {
|
||||
public:
|
||||
AttributeAdapter(op::PadMode& value) : EnumAttributeAdapterBase<op::PadMode>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::PadMode>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
namespace op {
|
||||
/// \brief Padding Type used for `Convolution` and `Pooling`
|
||||
///
|
||||
/// Follows ONNX padding type definitions
|
||||
@@ -57,20 +44,7 @@ enum class PadType {
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const PadType& type);
|
||||
} // namespace op
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<op::PadType> : public EnumAttributeAdapterBase<op::PadType> {
|
||||
public:
|
||||
AttributeAdapter(op::PadType& value) : EnumAttributeAdapterBase<op::PadType>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::PadType>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
namespace op {
|
||||
/// \brief Rounding Type used for `Pooling` operators.
|
||||
enum class RoundingType {
|
||||
FLOOR = 0,
|
||||
@@ -79,20 +53,7 @@ enum class RoundingType {
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const RoundingType& type);
|
||||
} // namespace op
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<op::RoundingType> : public EnumAttributeAdapterBase<op::RoundingType> {
|
||||
public:
|
||||
AttributeAdapter(op::RoundingType& value) : EnumAttributeAdapterBase<op::RoundingType>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::RoundingType>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
namespace op {
|
||||
/// \brief Specifies the algorithm to use for implicit broadcasting of a tensor
|
||||
/// to align with another tensor
|
||||
///
|
||||
@@ -140,8 +101,6 @@ enum class AutoBroadcastType {
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const AutoBroadcastType& type);
|
||||
} // namespace op
|
||||
namespace op {
|
||||
/// \brief BroadcastType specifies rules used for mapping of input tensor axes to output
|
||||
/// shape axes.
|
||||
///
|
||||
@@ -162,31 +121,7 @@ enum class BroadcastType { NONE, EXPLICIT = NONE, NUMPY, PDPD, BIDIRECTIONAL };
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const BroadcastType& type);
|
||||
} // namespace op
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<op::AutoBroadcastType> : public EnumAttributeAdapterBase<op::AutoBroadcastType> {
|
||||
public:
|
||||
AttributeAdapter(op::AutoBroadcastType& value) : EnumAttributeAdapterBase<op::AutoBroadcastType>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::AutoBroadcastType>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<op::BroadcastType> : public EnumAttributeAdapterBase<op::BroadcastType> {
|
||||
public:
|
||||
AttributeAdapter(op::BroadcastType& value) : EnumAttributeAdapterBase<op::BroadcastType>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::BroadcastType>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
namespace op {
|
||||
/// \brief Specifies how eps is combined with L2 value
|
||||
enum class EpsMode {
|
||||
// Add bias to norm
|
||||
@@ -197,20 +132,7 @@ enum class EpsMode {
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const EpsMode& type);
|
||||
} // namespace op
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<op::EpsMode> : public EnumAttributeAdapterBase<op::EpsMode> {
|
||||
public:
|
||||
AttributeAdapter(op::EpsMode& value) : EnumAttributeAdapterBase<op::EpsMode>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::EpsMode>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
namespace op {
|
||||
enum class TopKSortType {
|
||||
// Returned values are not sorte
|
||||
NONE,
|
||||
@@ -222,20 +144,7 @@ enum class TopKSortType {
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const TopKSortType& type);
|
||||
} // namespace op
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<op::TopKSortType> : public EnumAttributeAdapterBase<op::TopKSortType> {
|
||||
public:
|
||||
AttributeAdapter(op::TopKSortType& value) : EnumAttributeAdapterBase<op::TopKSortType>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::TopKSortType>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
namespace op {
|
||||
enum class TopKMode {
|
||||
MAX,
|
||||
MIN,
|
||||
@@ -243,20 +152,7 @@ enum class TopKMode {
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const TopKMode& type);
|
||||
} // namespace op
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<op::TopKMode> : public EnumAttributeAdapterBase<op::TopKMode> {
|
||||
public:
|
||||
AttributeAdapter(op::TopKMode& value) : EnumAttributeAdapterBase<op::TopKMode>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::TopKMode>", 1};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
namespace op {
|
||||
/// \brief Implicit broadcast specification
|
||||
struct NGRAPH_API AutoBroadcastSpec {
|
||||
AutoBroadcastSpec() : m_type(AutoBroadcastType::NONE), m_axis(0) {}
|
||||
@@ -280,24 +176,7 @@ struct NGRAPH_API AutoBroadcastSpec {
|
||||
private:
|
||||
AutoBroadcastType type_from_string(const std::string& type) const;
|
||||
};
|
||||
} // namespace op
|
||||
|
||||
template <>
|
||||
class AttributeAdapter<op::AutoBroadcastSpec> : public VisitorAdapter {
|
||||
public:
|
||||
AttributeAdapter(op::AutoBroadcastSpec& value) : m_ref(value) {}
|
||||
bool visit_attributes(AttributeVisitor& visitor) override;
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::AutoBroadcastSpec>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
|
||||
protected:
|
||||
op::AutoBroadcastSpec& m_ref;
|
||||
};
|
||||
|
||||
namespace op {
|
||||
/// \brief Implicit broadcast specification
|
||||
struct NGRAPH_API BroadcastModeSpec {
|
||||
BroadcastModeSpec() : m_type(BroadcastType::NUMPY), m_axis(0) {}
|
||||
@@ -312,24 +191,7 @@ struct NGRAPH_API BroadcastModeSpec {
|
||||
return a.m_type == m_type && a.m_axis == m_axis;
|
||||
}
|
||||
};
|
||||
} // namespace op
|
||||
|
||||
template <>
|
||||
class AttributeAdapter<op::BroadcastModeSpec> : public VisitorAdapter {
|
||||
public:
|
||||
AttributeAdapter(op::BroadcastModeSpec& value) : m_ref(value) {}
|
||||
bool visit_attributes(AttributeVisitor& visitor) override;
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::BroadcastModeSpec>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
|
||||
protected:
|
||||
op::BroadcastModeSpec& m_ref;
|
||||
};
|
||||
|
||||
namespace op {
|
||||
///
|
||||
/// \brief This class defines possible recurrent sequence directions.
|
||||
///
|
||||
@@ -338,17 +200,142 @@ enum class RecurrentSequenceDirection { FORWARD, REVERSE, BIDIRECTIONAL };
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const RecurrentSequenceDirection& direction);
|
||||
} // namespace op
|
||||
} // namespace ngraph
|
||||
|
||||
namespace ov {
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<ngraph::op::PadMode> : public EnumAttributeAdapterBase<ngraph::op::PadMode> {
|
||||
public:
|
||||
AttributeAdapter(ngraph::op::PadMode& value) : EnumAttributeAdapterBase<ngraph::op::PadMode>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::PadMode>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<op::RecurrentSequenceDirection>
|
||||
: public EnumAttributeAdapterBase<op::RecurrentSequenceDirection> {
|
||||
class NGRAPH_API AttributeAdapter<ngraph::op::PadType> : public EnumAttributeAdapterBase<ngraph::op::PadType> {
|
||||
public:
|
||||
AttributeAdapter(op::RecurrentSequenceDirection& value)
|
||||
: EnumAttributeAdapterBase<op::RecurrentSequenceDirection>(value) {}
|
||||
AttributeAdapter(ngraph::op::PadType& value) : EnumAttributeAdapterBase<ngraph::op::PadType>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::PadType>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<ngraph::op::RoundingType>
|
||||
: public EnumAttributeAdapterBase<ngraph::op::RoundingType> {
|
||||
public:
|
||||
AttributeAdapter(ngraph::op::RoundingType& value) : EnumAttributeAdapterBase<ngraph::op::RoundingType>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::RoundingType>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<ngraph::op::AutoBroadcastType>
|
||||
: public EnumAttributeAdapterBase<ngraph::op::AutoBroadcastType> {
|
||||
public:
|
||||
AttributeAdapter(ngraph::op::AutoBroadcastType& value)
|
||||
: EnumAttributeAdapterBase<ngraph::op::AutoBroadcastType>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::AutoBroadcastType>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<ngraph::op::BroadcastType>
|
||||
: public EnumAttributeAdapterBase<ngraph::op::BroadcastType> {
|
||||
public:
|
||||
AttributeAdapter(ngraph::op::BroadcastType& value) : EnumAttributeAdapterBase<ngraph::op::BroadcastType>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::BroadcastType>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<ngraph::op::EpsMode> : public EnumAttributeAdapterBase<ngraph::op::EpsMode> {
|
||||
public:
|
||||
AttributeAdapter(ngraph::op::EpsMode& value) : EnumAttributeAdapterBase<ngraph::op::EpsMode>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::EpsMode>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<ngraph::op::TopKSortType>
|
||||
: public EnumAttributeAdapterBase<ngraph::op::TopKSortType> {
|
||||
public:
|
||||
AttributeAdapter(ngraph::op::TopKSortType& value) : EnumAttributeAdapterBase<ngraph::op::TopKSortType>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::TopKSortType>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<ngraph::op::TopKMode> : public EnumAttributeAdapterBase<ngraph::op::TopKMode> {
|
||||
public:
|
||||
AttributeAdapter(ngraph::op::TopKMode& value) : EnumAttributeAdapterBase<ngraph::op::TopKMode>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::TopKMode>", 1};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
class AttributeAdapter<ngraph::op::AutoBroadcastSpec> : public VisitorAdapter {
|
||||
public:
|
||||
AttributeAdapter(ngraph::op::AutoBroadcastSpec& value) : m_ref(value) {}
|
||||
bool visit_attributes(AttributeVisitor& visitor) override;
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::AutoBroadcastSpec>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
|
||||
protected:
|
||||
ngraph::op::AutoBroadcastSpec& m_ref;
|
||||
};
|
||||
|
||||
template <>
|
||||
class AttributeAdapter<ngraph::op::BroadcastModeSpec> : public VisitorAdapter {
|
||||
public:
|
||||
AttributeAdapter(ngraph::op::BroadcastModeSpec& value) : m_ref(value) {}
|
||||
bool visit_attributes(AttributeVisitor& visitor) override;
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::BroadcastModeSpec>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
|
||||
protected:
|
||||
ngraph::op::BroadcastModeSpec& m_ref;
|
||||
};
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<ngraph::op::RecurrentSequenceDirection>
|
||||
: public EnumAttributeAdapterBase<ngraph::op::RecurrentSequenceDirection> {
|
||||
public:
|
||||
AttributeAdapter(ngraph::op::RecurrentSequenceDirection& value)
|
||||
: EnumAttributeAdapterBase<ngraph::op::RecurrentSequenceDirection>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::RecurrentSequenceDirection>", 1};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
} // namespace ngraph
|
||||
} // namespace ov
|
||||
|
||||
@@ -295,6 +295,9 @@ using MultiSubgraphOutputDescriptionVector = util::MultiSubGraphOp::MultiSubgrap
|
||||
|
||||
} // namespace util
|
||||
} // namespace op
|
||||
} // namespace ngraph
|
||||
|
||||
namespace ov {
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<std::vector<std::shared_ptr<ngraph::op::util::MultiSubGraphOp::InputDescription>>>
|
||||
@@ -317,4 +320,5 @@ public:
|
||||
|
||||
NGRAPH_RTTI_DECLARATION;
|
||||
};
|
||||
} // namespace ngraph
|
||||
|
||||
} // namespace ov
|
||||
|
||||
@@ -75,17 +75,21 @@ protected:
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const op::util::NmsBase::SortResultType& type);
|
||||
} // namespace ngraph
|
||||
|
||||
namespace ov {
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<op::util::NmsBase::SortResultType>
|
||||
: public EnumAttributeAdapterBase<op::util::NmsBase::SortResultType> {
|
||||
class NGRAPH_API AttributeAdapter<ngraph::op::util::NmsBase::SortResultType>
|
||||
: public EnumAttributeAdapterBase<ngraph::op::util::NmsBase::SortResultType> {
|
||||
public:
|
||||
AttributeAdapter(op::util::NmsBase::SortResultType& value)
|
||||
: EnumAttributeAdapterBase<op::util::NmsBase::SortResultType>(value) {}
|
||||
AttributeAdapter(ngraph::op::util::NmsBase::SortResultType& value)
|
||||
: EnumAttributeAdapterBase<ngraph::op::util::NmsBase::SortResultType>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::util::NmsBase::SortResultType>", 1};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
} // namespace ngraph
|
||||
|
||||
} // namespace ov
|
||||
|
||||
@@ -40,16 +40,21 @@ private:
|
||||
};
|
||||
using VariablePtr = std::shared_ptr<Variable>;
|
||||
using VariableVector = std::vector<VariablePtr>;
|
||||
} // namespace ngraph
|
||||
|
||||
namespace ov {
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<std::shared_ptr<Variable>> : public DirectValueAccessor<std::shared_ptr<Variable>> {
|
||||
class NGRAPH_API AttributeAdapter<std::shared_ptr<ngraph::Variable>>
|
||||
: public DirectValueAccessor<std::shared_ptr<ngraph::Variable>> {
|
||||
public:
|
||||
explicit AttributeAdapter(std::shared_ptr<Variable>& value)
|
||||
: DirectValueAccessor<std::shared_ptr<Variable>>(value) {}
|
||||
explicit AttributeAdapter(std::shared_ptr<ngraph::Variable>& value)
|
||||
: DirectValueAccessor<std::shared_ptr<ngraph::Variable>>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<std::shared_ptr<Variable>>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
} // namespace ngraph
|
||||
|
||||
} // namespace ov
|
||||
|
||||
@@ -63,15 +63,19 @@ protected:
|
||||
size_t m_byte_size;
|
||||
};
|
||||
} // namespace runtime
|
||||
} // namespace ngraph
|
||||
|
||||
namespace ov {
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<std::shared_ptr<runtime::AlignedBuffer>>
|
||||
: public DirectValueAccessor<std::shared_ptr<runtime::AlignedBuffer>> {
|
||||
class NGRAPH_API AttributeAdapter<std::shared_ptr<ngraph::runtime::AlignedBuffer>>
|
||||
: public DirectValueAccessor<std::shared_ptr<ngraph::runtime::AlignedBuffer>> {
|
||||
public:
|
||||
AttributeAdapter(std::shared_ptr<runtime::AlignedBuffer>& value);
|
||||
AttributeAdapter(std::shared_ptr<ngraph::runtime::AlignedBuffer>& value);
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<std::shared_ptr<runtime::AlignedBuffer>>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
} // namespace ngraph
|
||||
|
||||
} // namespace ov
|
||||
|
||||
@@ -35,18 +35,6 @@ public:
|
||||
NGRAPH_API Shape& operator=(Shape&& v) noexcept;
|
||||
};
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<Shape> : public IndirectVectorValueAccessor<Shape, std::vector<int64_t>>
|
||||
|
||||
{
|
||||
public:
|
||||
AttributeAdapter(Shape& value) : IndirectVectorValueAccessor<Shape, std::vector<int64_t>>(value) {}
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<Shape>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// Number of elements in spanned by a shape
|
||||
template <typename SHAPE_TYPE>
|
||||
size_t shape_size(const SHAPE_TYPE& shape) {
|
||||
@@ -92,3 +80,19 @@ inline bool is_vector(const SHAPE_TYPE& shape) {
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const Shape& shape);
|
||||
} // namespace ngraph
|
||||
|
||||
namespace ov {
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<ngraph::Shape>
|
||||
: public IndirectVectorValueAccessor<ngraph::Shape, std::vector<int64_t>>
|
||||
|
||||
{
|
||||
public:
|
||||
AttributeAdapter(ngraph::Shape& value) : IndirectVectorValueAccessor<ngraph::Shape, std::vector<int64_t>>(value) {}
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<Shape>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
} // namespace ov
|
||||
|
||||
@@ -33,18 +33,24 @@ public:
|
||||
NGRAPH_API Strides& operator=(Strides&& v) noexcept;
|
||||
};
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const Strides& strides);
|
||||
} // namespace ngraph
|
||||
|
||||
namespace ov {
|
||||
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<Strides> : public IndirectVectorValueAccessor<Strides, std::vector<int64_t>>
|
||||
class NGRAPH_API AttributeAdapter<ngraph::Strides>
|
||||
: public IndirectVectorValueAccessor<ngraph::Strides, std::vector<int64_t>>
|
||||
|
||||
{
|
||||
public:
|
||||
AttributeAdapter(Strides& value) : IndirectVectorValueAccessor<Strides, std::vector<int64_t>>(value) {}
|
||||
AttributeAdapter(ngraph::Strides& value)
|
||||
: IndirectVectorValueAccessor<ngraph::Strides, std::vector<int64_t>>(value) {}
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<Strides>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
NGRAPH_API
|
||||
std::ostream& operator<<(std::ostream& s, const Strides& strides);
|
||||
} // namespace ngraph
|
||||
} // namespace ov
|
||||
|
||||
@@ -0,0 +1,474 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
#include "openvino/core/core_visibility.hpp"
|
||||
#include "openvino/core/enum_names.hpp"
|
||||
#include "openvino/core/type.hpp"
|
||||
|
||||
///
|
||||
namespace ov {
|
||||
class AttributeVisitor;
|
||||
|
||||
/// \brief Provides access to an attribute of type AT as a value accessor type VAT
|
||||
template <typename VAT>
|
||||
class ValueAccessor;
|
||||
|
||||
/// \brief ValueAccessor<void> provides an accessor for values that do not have get/set methonds
|
||||
/// via AttributeVistor.on_adapter.
|
||||
///
|
||||
/// All ValueAccessors must be derived from ValueAccessor<void> so that an AttributeVisitor
|
||||
/// only needs to implement a subset of the on_adapter methods.
|
||||
template <>
|
||||
class OPENVINO_API ValueAccessor<void> {
|
||||
public:
|
||||
/// \brief type info enables identification of the value accessor, as well as is_type and
|
||||
/// as_type.
|
||||
virtual const DiscreteTypeInfo& get_type_info() const = 0;
|
||||
virtual ~ValueAccessor() = default;
|
||||
};
|
||||
|
||||
/// \brief Provides access to values via get/set methods from an m_value, typically from
|
||||
/// ValueReference
|
||||
///
|
||||
/// The m_buffer holds a VAT, which may be wider than the attribute AT. For example, serializers
|
||||
/// that only
|
||||
/// support int64_t integers would use a ValueAccessor<vector<int64_t>> to reference a
|
||||
/// vector<int8_t> attribute. Destruction moves the value back to the attribute if it was
|
||||
/// changed.
|
||||
/// \tparam VAT The adapter value type; may be wider than the value being accessed.
|
||||
template <typename VAT>
|
||||
class ValueAccessor : public ValueAccessor<void> {
|
||||
public:
|
||||
/// Returns the value
|
||||
virtual const VAT& get() = 0;
|
||||
/// Sets the value
|
||||
virtual void set(const VAT& value) = 0;
|
||||
};
|
||||
|
||||
template <>
|
||||
class ValueAccessor<void*> : public ValueAccessor<void> {
|
||||
public:
|
||||
virtual void* get_ptr() = 0;
|
||||
virtual size_t size() = 0;
|
||||
};
|
||||
|
||||
template <typename AT>
|
||||
class DirectValueAccessor : public ValueAccessor<AT> {
|
||||
public:
|
||||
DirectValueAccessor(AT& ref) : m_ref(ref) {}
|
||||
const AT& get() override {
|
||||
return m_ref;
|
||||
}
|
||||
void set(const AT& value) override {
|
||||
m_ref = value;
|
||||
}
|
||||
|
||||
protected:
|
||||
AT& m_ref;
|
||||
};
|
||||
|
||||
template <typename AT, typename VAT>
|
||||
class IndirectScalarValueAccessor : public ValueAccessor<VAT> {
|
||||
public:
|
||||
IndirectScalarValueAccessor(AT& ref) : m_ref(ref), m_buffer() {}
|
||||
|
||||
const VAT& get() override {
|
||||
if (!m_buffer_valid) {
|
||||
m_buffer = static_cast<VAT>(m_ref);
|
||||
m_buffer_valid = true;
|
||||
}
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
void set(const VAT& value) override {
|
||||
m_ref = static_cast<AT>(value);
|
||||
m_buffer_valid = false;
|
||||
}
|
||||
|
||||
protected:
|
||||
AT& m_ref;
|
||||
VAT m_buffer;
|
||||
bool m_buffer_valid{false};
|
||||
};
|
||||
|
||||
template <typename A, typename B>
|
||||
A copy_from(B& b) {
|
||||
A result(b.size());
|
||||
for (size_t i = 0; i < b.size(); ++i) {
|
||||
result[i] = static_cast<typename std::remove_reference<decltype(result[i])>::type>(b[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename AT, typename VAT>
|
||||
class IndirectVectorValueAccessor : public ValueAccessor<VAT> {
|
||||
public:
|
||||
IndirectVectorValueAccessor(AT& ref) : m_ref(ref) {}
|
||||
|
||||
const VAT& get() override {
|
||||
if (!m_buffer_valid) {
|
||||
m_buffer = ov::copy_from<typename std::remove_cv<VAT>::type>(m_ref);
|
||||
m_buffer_valid = true;
|
||||
}
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
void set(const VAT& value) override {
|
||||
m_ref = copy_from<AT>(value);
|
||||
m_buffer_valid = false;
|
||||
}
|
||||
|
||||
operator AT&() {
|
||||
return m_ref;
|
||||
}
|
||||
|
||||
protected:
|
||||
AT& m_ref;
|
||||
VAT m_buffer;
|
||||
bool m_buffer_valid{false};
|
||||
};
|
||||
|
||||
/// \brief An AttributeAdapter "captures" an attribute as an AT& and makes it available as a
|
||||
/// ValueAccessor<VAT>.
|
||||
template <typename AT>
|
||||
class AttributeAdapter {};
|
||||
|
||||
/// \brief Access an enum via a string
|
||||
/// \tparam AT The attribute type enum class
|
||||
template <typename AT>
|
||||
class EnumAttributeAdapterBase : public ValueAccessor<std::string> {
|
||||
public:
|
||||
EnumAttributeAdapterBase(AT& value) : m_ref(value) {}
|
||||
|
||||
const std::string& get() override {
|
||||
return as_string(m_ref);
|
||||
}
|
||||
void set(const std::string& value) override {
|
||||
m_ref = as_enum<AT>(value);
|
||||
}
|
||||
operator AT&() {
|
||||
return m_ref;
|
||||
}
|
||||
|
||||
protected:
|
||||
AT& m_ref;
|
||||
};
|
||||
|
||||
/// Adapters will see visitor
|
||||
class VisitorAdapter : public ValueAccessor<void> {
|
||||
public:
|
||||
virtual bool visit_attributes(AttributeVisitor& visitor) = 0;
|
||||
};
|
||||
|
||||
template <>
|
||||
class OPENVINO_API AttributeAdapter<float> : public IndirectScalarValueAccessor<float, double> {
|
||||
public:
|
||||
AttributeAdapter(float& value) : IndirectScalarValueAccessor<float, double>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<float>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a double as a double
|
||||
template <>
|
||||
class OPENVINO_API AttributeAdapter<double> : public DirectValueAccessor<double> {
|
||||
public:
|
||||
AttributeAdapter(double& value) : DirectValueAccessor<double>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<double>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a string as a string
|
||||
template <>
|
||||
class OPENVINO_API AttributeAdapter<std::string> : public DirectValueAccessor<std::string> {
|
||||
public:
|
||||
AttributeAdapter(std::string& value) : DirectValueAccessor<std::string>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<string>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a bool as a bool
|
||||
template <>
|
||||
class OPENVINO_API AttributeAdapter<bool> : public DirectValueAccessor<bool> {
|
||||
public:
|
||||
AttributeAdapter(bool& value) : DirectValueAccessor<bool>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<bool>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access an int8_t and an int64_t
|
||||
template <>
|
||||
class OPENVINO_API AttributeAdapter<int8_t> : public IndirectScalarValueAccessor<int8_t, int64_t> {
|
||||
public:
|
||||
AttributeAdapter(int8_t& value) : IndirectScalarValueAccessor<int8_t, int64_t>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<int8_t>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access an int16_t as an int64_t
|
||||
template <>
|
||||
class OPENVINO_API AttributeAdapter<int16_t> : public IndirectScalarValueAccessor<int16_t, int64_t> {
|
||||
public:
|
||||
AttributeAdapter(int16_t& value) : IndirectScalarValueAccessor<int16_t, int64_t>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<int16_t>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access an int32_t as an int64_t
|
||||
template <>
|
||||
class OPENVINO_API AttributeAdapter<int32_t> : public IndirectScalarValueAccessor<int32_t, int64_t> {
|
||||
public:
|
||||
AttributeAdapter(int32_t& value) : IndirectScalarValueAccessor<int32_t, int64_t>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<int32_t>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access an int64_t as an int64_t
|
||||
template <>
|
||||
class OPENVINO_API AttributeAdapter<int64_t> : public DirectValueAccessor<int64_t> {
|
||||
public:
|
||||
AttributeAdapter(int64_t& value) : DirectValueAccessor<int64_t>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<int64_t>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a uint8_t as an int64_t
|
||||
template <>
|
||||
class OPENVINO_API AttributeAdapter<uint8_t> : public IndirectScalarValueAccessor<uint8_t, int64_t> {
|
||||
public:
|
||||
AttributeAdapter(uint8_t& value) : IndirectScalarValueAccessor<uint8_t, int64_t>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<uint8_t>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a uint16_t as an int64_t
|
||||
template <>
|
||||
class OPENVINO_API AttributeAdapter<uint16_t> : public IndirectScalarValueAccessor<uint16_t, int64_t> {
|
||||
public:
|
||||
AttributeAdapter(uint16_t& value) : IndirectScalarValueAccessor<uint16_t, int64_t>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<uint16_t>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a uint32_t as an int64_t
|
||||
template <>
|
||||
class OPENVINO_API AttributeAdapter<uint32_t> : public IndirectScalarValueAccessor<uint32_t, int64_t> {
|
||||
public:
|
||||
AttributeAdapter(uint32_t& value) : IndirectScalarValueAccessor<uint32_t, int64_t>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<uint32_t>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a uint64_t as an int64_t
|
||||
template <>
|
||||
class OPENVINO_API AttributeAdapter<uint64_t> : public IndirectScalarValueAccessor<uint64_t, int64_t> {
|
||||
public:
|
||||
AttributeAdapter(uint64_t& value) : IndirectScalarValueAccessor<uint64_t, int64_t>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<uint64_t>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef __APPLE__
|
||||
// size_t is one of the uint types on _WIN32
|
||||
template <>
|
||||
class OPENVINO_API AttributeAdapter<size_t> : public IndirectScalarValueAccessor<size_t, int64_t> {
|
||||
public:
|
||||
AttributeAdapter(size_t& value) : IndirectScalarValueAccessor<size_t, int64_t>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<size_t>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
class OPENVINO_API AttributeAdapter<std::vector<size_t>>
|
||||
: public IndirectVectorValueAccessor<std::vector<size_t>, std::vector<int64_t>> {
|
||||
public:
|
||||
AttributeAdapter(std::vector<size_t>& value)
|
||||
: IndirectVectorValueAccessor<std::vector<size_t>, std::vector<int64_t>>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<vector<size_t>>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
/// Note: These class bodies cannot be defined with templates because of interactions
|
||||
/// between dllexport and templates on Windows.
|
||||
|
||||
/// \brief Access a vector<int8_t>
|
||||
template <>
|
||||
class OPENVINO_API AttributeAdapter<std::vector<int8_t>> : public DirectValueAccessor<std::vector<int8_t>> {
|
||||
public:
|
||||
AttributeAdapter(std::vector<int8_t>& value) : DirectValueAccessor<std::vector<int8_t>>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<vector<int8_t>>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a vector<int16_t>
|
||||
template <>
|
||||
class OPENVINO_API AttributeAdapter<std::vector<int16_t>> : public DirectValueAccessor<std::vector<int16_t>> {
|
||||
public:
|
||||
AttributeAdapter(std::vector<int16_t>& value) : DirectValueAccessor<std::vector<int16_t>>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<vector<int16_t>>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a vector<int32_t>
|
||||
template <>
|
||||
class OPENVINO_API AttributeAdapter<std::vector<int32_t>> : public DirectValueAccessor<std::vector<int32_t>> {
|
||||
public:
|
||||
AttributeAdapter(std::vector<int32_t>& value) : DirectValueAccessor<std::vector<int32_t>>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<vector<int32_t>>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a vector<int64_t>
|
||||
template <>
|
||||
class OPENVINO_API AttributeAdapter<std::vector<int64_t>> : public DirectValueAccessor<std::vector<int64_t>> {
|
||||
public:
|
||||
AttributeAdapter(std::vector<int64_t>& value) : DirectValueAccessor<std::vector<int64_t>>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<vector<int64_t>>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a vector<uint8_t>
|
||||
template <>
|
||||
class OPENVINO_API AttributeAdapter<std::vector<uint8_t>> : public DirectValueAccessor<std::vector<uint8_t>> {
|
||||
public:
|
||||
AttributeAdapter(std::vector<uint8_t>& value) : DirectValueAccessor<std::vector<uint8_t>>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<vector<uint8_t>>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a vector<uint16_t>
|
||||
template <>
|
||||
class OPENVINO_API AttributeAdapter<std::vector<uint16_t>> : public DirectValueAccessor<std::vector<uint16_t>> {
|
||||
public:
|
||||
AttributeAdapter(std::vector<uint16_t>& value) : DirectValueAccessor<std::vector<uint16_t>>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<vector<uint16_t>>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a vector<uint32_t>
|
||||
template <>
|
||||
class OPENVINO_API AttributeAdapter<std::vector<uint32_t>> : public DirectValueAccessor<std::vector<uint32_t>> {
|
||||
public:
|
||||
AttributeAdapter(std::vector<uint32_t>& value) : DirectValueAccessor<std::vector<uint32_t>>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<vector<uint32_t>>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a vector<uint64_t>
|
||||
template <>
|
||||
class OPENVINO_API AttributeAdapter<std::vector<uint64_t>> : public DirectValueAccessor<std::vector<uint64_t>> {
|
||||
public:
|
||||
AttributeAdapter(std::vector<uint64_t>& value) : DirectValueAccessor<std::vector<uint64_t>>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<vector<uint64_t>>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a vector<float>
|
||||
template <>
|
||||
class OPENVINO_API AttributeAdapter<std::vector<float>> : public DirectValueAccessor<std::vector<float>> {
|
||||
public:
|
||||
AttributeAdapter(std::vector<float>& value) : DirectValueAccessor<std::vector<float>>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<vector<float>>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a vector<double>
|
||||
template <>
|
||||
class OPENVINO_API AttributeAdapter<std::vector<double>> : public DirectValueAccessor<std::vector<double>> {
|
||||
public:
|
||||
AttributeAdapter(std::vector<double>& value) : DirectValueAccessor<std::vector<double>>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<vector<double>>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief Access a vector<string>
|
||||
template <>
|
||||
class OPENVINO_API AttributeAdapter<std::vector<std::string>> : public DirectValueAccessor<std::vector<std::string>> {
|
||||
public:
|
||||
AttributeAdapter(std::vector<std::string>& value) : DirectValueAccessor<std::vector<std::string>>(value) {}
|
||||
|
||||
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<vector<string>>", 0};
|
||||
const DiscreteTypeInfo& get_type_info() const override {
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
} // namespace ov
|
||||
@@ -0,0 +1,140 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
|
||||
#include "openvino/core/partial_shape.hpp"
|
||||
#include "openvino/core/type.hpp"
|
||||
#include "openvino/core/type/element_type.hpp"
|
||||
|
||||
namespace ngraph {
|
||||
class Node;
|
||||
}
|
||||
namespace ov {
|
||||
class Function;
|
||||
template <typename T>
|
||||
class ValueAccessor;
|
||||
template <typename T>
|
||||
class AttributeAdapter;
|
||||
class VisitorAdapter;
|
||||
|
||||
/// \brief Visits the attributes of a node, primarily for serialization-like tasks.
|
||||
///
|
||||
/// Attributes are the node parameters that are always compile-time constants.
|
||||
/// Values computed from the graph topology and attributes during compilation are not
|
||||
/// attributes.
|
||||
///
|
||||
/// Attributes have a wide variety of types, but serialization formats are more restricted.
|
||||
/// We asume serialation easily supports scalar types of bool 64-bit signed, string, and double,
|
||||
/// and has specialized ways to support numeric arrays and raw data+size. The visitor and
|
||||
/// adapter convert between the limited serialization types and the unlimited attribute types.
|
||||
///
|
||||
/// A visitor is passed to an op's visit_attributes method. The visit_attributes method calls
|
||||
/// the template method visitor.on_attribute<AT>(const std::string& name, AT& value) on each
|
||||
/// attribute. The visitor can read or write the attribute's value. The on_attribute
|
||||
/// method creates an AttributeAdapter<AT> for the value and passes it to one of the visitors
|
||||
/// on_adapter methods. The on_adapter methods expect a reference to a ValueAccessor<VAT> or a
|
||||
/// VisitorAdapter. A ValueAccessor<VAT> has get/set methods that can be used to read/write the
|
||||
/// attribute value as type VAT. These methods are triggered by deriving AttributeAdapter<AT>
|
||||
/// from ValueAccessor<VAT>. For more complex cases, such as structs, the on_adapter method for
|
||||
/// VisitorAdapter passes the name and visitor to the adapter, so that the adapter can perform
|
||||
/// additional work such as visiting struct members or sequence values.
|
||||
///
|
||||
/// When a node visits an attribute with structure, the node's on_attribute passes a name for
|
||||
/// the entire attribute, but the struct will have its own methods to be visited. Similarly, a
|
||||
/// vector will have a sequence of members to be visited. The adapter may use the visitor
|
||||
/// methods start_struct/finish_struct and start_vector/next_vector/finish_vector to inidicate
|
||||
/// nexted members.
|
||||
///
|
||||
/// The visitor method get_name_with_context creates a generic nested version of the name.
|
||||
/// Visitors can override according to their serialization requirements.
|
||||
///
|
||||
/// Attributes that are shared_ptr<Node> are special. They must have been already been
|
||||
/// registered with the visitor using register_node, which needs a shared pointer to a node and
|
||||
/// a string ID. The ID string will be used to serialize the node or find the node during
|
||||
/// deserialization.
|
||||
class OPENVINO_API AttributeVisitor {
|
||||
public:
|
||||
virtual ~AttributeVisitor() = default;
|
||||
// Must implement these methods
|
||||
/// \brief handles all specialized on_adapter methods implemented by the visitor.
|
||||
///
|
||||
/// The adapter implements get_type_info(), which can be used to determine the adapter
|
||||
/// directly
|
||||
/// or via is_type and as_type on any platform
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<void>& adapter) = 0;
|
||||
// The remaining adapter methods fall back on the void adapter if not implemented
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<void*>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<std::string>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<bool>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<int8_t>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<int16_t>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<int32_t>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<int64_t>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<uint8_t>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<uint16_t>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<uint32_t>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<uint64_t>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<float>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<double>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<std::vector<int8_t>>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<std::vector<int16_t>>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<std::vector<int32_t>>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<std::vector<int64_t>>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<std::vector<uint8_t>>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<std::vector<uint16_t>>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<std::vector<uint32_t>>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<std::vector<uint64_t>>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<std::vector<float>>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<std::vector<double>>& adapter);
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<std::vector<std::string>>& adapter);
|
||||
/// \brief Hook for adapters that need visitor access
|
||||
virtual void on_adapter(const std::string& name, VisitorAdapter& adapter);
|
||||
|
||||
/// \brief Provides API to handle nGraph Function attribute type, accessed as ValueAccessor
|
||||
/// \param name attribute name
|
||||
/// \param adapter reference to a Function ValueAccessor<VAT>
|
||||
virtual void on_adapter(const std::string& name, ValueAccessor<std::shared_ptr<ov::Function>>& adapter);
|
||||
|
||||
/// The generic visitor. There must be a definition of AttributeAdapter<T> that can convert
|
||||
/// to a ValueAccessor<U> for one of the on_adpater methods.
|
||||
template <typename AT>
|
||||
void on_attribute(const std::string& name, AT& value) {
|
||||
AttributeAdapter<AT> adapter(value);
|
||||
start_structure(name);
|
||||
on_adapter(get_name_with_context(), adapter);
|
||||
finish_structure();
|
||||
}
|
||||
/// \returns The nested context of visits
|
||||
const std::vector<std::string>& get_context() const {
|
||||
return m_context;
|
||||
}
|
||||
/// \returns context prepended to names
|
||||
virtual std::string get_name_with_context();
|
||||
/// \brief Start visiting a nested structure
|
||||
virtual void start_structure(const std::string& name);
|
||||
/// \brief Finish visiting a nested structure
|
||||
virtual std::string finish_structure();
|
||||
using node_id_t = std::string;
|
||||
static const node_id_t invalid_node_id;
|
||||
/// \brief Associate a node with an id.
|
||||
///
|
||||
/// No node may be used as an attribute unless it has already been registered with an ID.
|
||||
/// References to nodes are visited with a ValueAccessor of their ID.
|
||||
virtual void register_node(const std::shared_ptr<ngraph::Node>& node, node_id_t id = invalid_node_id);
|
||||
/// Returns the node with the given id, or nullptr if there is no registered node
|
||||
virtual std::shared_ptr<ngraph::Node> get_registered_node(node_id_t id);
|
||||
/// Returns the id for the node, or -1 if the node is not registered
|
||||
virtual node_id_t get_registered_node_id(const std::shared_ptr<ngraph::Node>& node);
|
||||
|
||||
protected:
|
||||
std::vector<std::string> m_context;
|
||||
std::unordered_map<std::shared_ptr<ngraph::Node>, node_id_t> m_node_id_map;
|
||||
std::unordered_map<node_id_t, std::shared_ptr<ngraph::Node>> m_id_node_map;
|
||||
};
|
||||
} // namespace ov
|
||||
@@ -0,0 +1,70 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "ngraph/check.hpp"
|
||||
|
||||
namespace ov {
|
||||
/// Uses a pairings defined by EnumTypes::get() to convert between strings
|
||||
/// and enum values.
|
||||
template <typename EnumType>
|
||||
class EnumNames {
|
||||
public:
|
||||
/// Converts strings to enum values
|
||||
static EnumType as_enum(const std::string& name) {
|
||||
auto to_lower = [](const std::string& s) {
|
||||
std::string rc = s;
|
||||
std::transform(rc.begin(), rc.end(), rc.begin(), [](char c) {
|
||||
return static_cast<char>(::tolower(static_cast<int>(c)));
|
||||
});
|
||||
return rc;
|
||||
};
|
||||
for (const auto& p : get().m_string_enums) {
|
||||
if (to_lower(p.first) == to_lower(name)) {
|
||||
return p.second;
|
||||
}
|
||||
}
|
||||
NGRAPH_CHECK(false, "\"", name, "\"", " is not a member of enum ", get().m_enum_name);
|
||||
}
|
||||
|
||||
/// Converts enum values to strings
|
||||
static const std::string& as_string(EnumType e) {
|
||||
for (const auto& p : get().m_string_enums) {
|
||||
if (p.second == e) {
|
||||
return p.first;
|
||||
}
|
||||
}
|
||||
NGRAPH_CHECK(false, " invalid member of enum ", get().m_enum_name);
|
||||
}
|
||||
|
||||
private:
|
||||
/// Creates the mapping.
|
||||
EnumNames(const std::string& enum_name, const std::vector<std::pair<std::string, EnumType>> string_enums)
|
||||
: m_enum_name(enum_name),
|
||||
m_string_enums(string_enums) {}
|
||||
|
||||
/// Must be defined to returns a singleton for each supported enum class
|
||||
static EnumNames<EnumType>& get();
|
||||
|
||||
const std::string m_enum_name;
|
||||
std::vector<std::pair<std::string, EnumType>> m_string_enums;
|
||||
};
|
||||
|
||||
/// Returns the enum value matching the string
|
||||
template <typename Type, typename Value>
|
||||
typename std::enable_if<std::is_convertible<Value, std::string>::value, Type>::type as_enum(const Value& value) {
|
||||
return EnumNames<Type>::as_enum(value);
|
||||
}
|
||||
|
||||
/// Returns the string matching the enum value
|
||||
template <typename Value>
|
||||
const std::string& as_string(Value value) {
|
||||
return EnumNames<Value>::as_string(value);
|
||||
}
|
||||
} // namespace ov
|
||||
@@ -272,8 +272,6 @@ private:
|
||||
ngraph::VariableVector m_variables;
|
||||
};
|
||||
|
||||
} // namespace ov
|
||||
namespace ngraph {
|
||||
template <>
|
||||
class NGRAPH_API AttributeAdapter<std::shared_ptr<ov::Function>>
|
||||
: public DirectValueAccessor<std::shared_ptr<ov::Function>> {
|
||||
@@ -286,4 +284,4 @@ public:
|
||||
return type_info;
|
||||
}
|
||||
};
|
||||
} // namespace ngraph
|
||||
} // namespace ov
|
||||
|
||||
@@ -375,9 +375,6 @@ PartialShape operator+(const PartialShape& s1, const PartialShape& s2);
|
||||
OPENVINO_API
|
||||
std::ostream& operator<<(std::ostream& str, const PartialShape& shape);
|
||||
|
||||
} // namespace ov
|
||||
namespace ngraph {
|
||||
|
||||
template <>
|
||||
class OPENVINO_API AttributeAdapter<ov::PartialShape> : public ValueAccessor<std::vector<int64_t>> {
|
||||
public:
|
||||
@@ -398,4 +395,4 @@ protected:
|
||||
std::vector<int64_t> m_buffer;
|
||||
bool m_buffer_valid{false};
|
||||
};
|
||||
} // namespace ngraph
|
||||
} // namespace ov
|
||||
|
||||
@@ -165,10 +165,6 @@ OPENVINO_API
|
||||
std::ostream& operator<<(std::ostream& out, const ov::element::Type& obj);
|
||||
} // namespace element
|
||||
|
||||
} // namespace ov
|
||||
|
||||
namespace ngraph {
|
||||
|
||||
template <>
|
||||
class OPENVINO_API AttributeAdapter<ov::element::Type_t> : public EnumAttributeAdapterBase<ov::element::Type_t> {
|
||||
public:
|
||||
@@ -199,4 +195,4 @@ public:
|
||||
protected:
|
||||
ov::element::Type& m_ref;
|
||||
};
|
||||
} // namespace ngraph
|
||||
} // namespace ov
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
|
||||
namespace ngraph {
|
||||
namespace ov {
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<float>::type_info;
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<double>::type_info;
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<string>::type_info;
|
||||
@@ -47,4 +47,4 @@ constexpr DiscreteTypeInfo AttributeAdapter<vector<uint64_t>>::type_info;
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<vector<float>>::type_info;
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<vector<double>>::type_info;
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<vector<string>>::type_info;
|
||||
} // namespace ngraph
|
||||
} // namespace ov
|
||||
|
||||
@@ -9,135 +9,134 @@
|
||||
#include "ngraph/node.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
|
||||
void AttributeVisitor::start_structure(const string& name) {
|
||||
void ov::AttributeVisitor::start_structure(const string& name) {
|
||||
m_context.push_back(name);
|
||||
}
|
||||
|
||||
string AttributeVisitor::finish_structure() {
|
||||
string ov::AttributeVisitor::finish_structure() {
|
||||
string result = m_context.back();
|
||||
m_context.pop_back();
|
||||
return result;
|
||||
}
|
||||
|
||||
string AttributeVisitor::get_name_with_context() {
|
||||
string ov::AttributeVisitor::get_name_with_context() {
|
||||
ostringstream result;
|
||||
string sep = "";
|
||||
for (auto c : m_context) {
|
||||
for (const auto& c : m_context) {
|
||||
result << sep << c;
|
||||
sep = ".";
|
||||
}
|
||||
return result.str();
|
||||
}
|
||||
|
||||
void AttributeVisitor::on_adapter(const std::string& name, VisitorAdapter& adapter) {
|
||||
void ov::AttributeVisitor::on_adapter(const std::string& name, VisitorAdapter& adapter) {
|
||||
adapter.visit_attributes(*this);
|
||||
}
|
||||
|
||||
void AttributeVisitor::on_adapter(const std::string& name, ValueAccessor<void*>& adapter) {
|
||||
void ov::AttributeVisitor::on_adapter(const std::string& name, ValueAccessor<void*>& adapter) {
|
||||
on_adapter(name, static_cast<ValueAccessor<void>&>(adapter));
|
||||
}
|
||||
|
||||
void AttributeVisitor::on_adapter(const string& name, ValueAccessor<string>& adapter) {
|
||||
void ov::AttributeVisitor::on_adapter(const string& name, ValueAccessor<string>& adapter) {
|
||||
on_adapter(name, static_cast<ValueAccessor<void>&>(adapter));
|
||||
};
|
||||
|
||||
void AttributeVisitor::on_adapter(const string& name, ValueAccessor<bool>& adapter) {
|
||||
void ov::AttributeVisitor::on_adapter(const string& name, ValueAccessor<bool>& adapter) {
|
||||
on_adapter(name, static_cast<ValueAccessor<void>&>(adapter));
|
||||
};
|
||||
|
||||
void AttributeVisitor::on_adapter(const string& name, ValueAccessor<int8_t>& adapter) {
|
||||
void ov::AttributeVisitor::on_adapter(const string& name, ValueAccessor<int8_t>& adapter) {
|
||||
on_adapter(name, static_cast<ValueAccessor<void>&>(adapter));
|
||||
}
|
||||
|
||||
void AttributeVisitor::on_adapter(const string& name, ValueAccessor<int16_t>& adapter) {
|
||||
void ov::AttributeVisitor::on_adapter(const string& name, ValueAccessor<int16_t>& adapter) {
|
||||
on_adapter(name, static_cast<ValueAccessor<void>&>(adapter));
|
||||
}
|
||||
|
||||
void AttributeVisitor::on_adapter(const string& name, ValueAccessor<int32_t>& adapter) {
|
||||
void ov::AttributeVisitor::on_adapter(const string& name, ValueAccessor<int32_t>& adapter) {
|
||||
on_adapter(name, static_cast<ValueAccessor<void>&>(adapter));
|
||||
}
|
||||
|
||||
void AttributeVisitor::on_adapter(const string& name, ValueAccessor<int64_t>& adapter) {
|
||||
void ov::AttributeVisitor::on_adapter(const string& name, ValueAccessor<int64_t>& adapter) {
|
||||
on_adapter(name, static_cast<ValueAccessor<void>&>(adapter));
|
||||
}
|
||||
|
||||
void AttributeVisitor::on_adapter(const string& name, ValueAccessor<uint8_t>& adapter) {
|
||||
void ov::AttributeVisitor::on_adapter(const string& name, ValueAccessor<uint8_t>& adapter) {
|
||||
on_adapter(name, static_cast<ValueAccessor<void>&>(adapter));
|
||||
}
|
||||
|
||||
void AttributeVisitor::on_adapter(const string& name, ValueAccessor<uint16_t>& adapter) {
|
||||
void ov::AttributeVisitor::on_adapter(const string& name, ValueAccessor<uint16_t>& adapter) {
|
||||
on_adapter(name, static_cast<ValueAccessor<void>&>(adapter));
|
||||
}
|
||||
|
||||
void AttributeVisitor::on_adapter(const string& name, ValueAccessor<uint32_t>& adapter) {
|
||||
void ov::AttributeVisitor::on_adapter(const string& name, ValueAccessor<uint32_t>& adapter) {
|
||||
on_adapter(name, static_cast<ValueAccessor<void>&>(adapter));
|
||||
}
|
||||
|
||||
void AttributeVisitor::on_adapter(const string& name, ValueAccessor<uint64_t>& adapter) {
|
||||
void ov::AttributeVisitor::on_adapter(const string& name, ValueAccessor<uint64_t>& adapter) {
|
||||
on_adapter(name, static_cast<ValueAccessor<void>&>(adapter));
|
||||
}
|
||||
|
||||
void AttributeVisitor::on_adapter(const string& name, ValueAccessor<float>& adapter) {
|
||||
void ov::AttributeVisitor::on_adapter(const string& name, ValueAccessor<float>& adapter) {
|
||||
on_adapter(name, static_cast<ValueAccessor<void>&>(adapter));
|
||||
}
|
||||
|
||||
void AttributeVisitor::on_adapter(const string& name, ValueAccessor<double>& adapter) {
|
||||
void ov::AttributeVisitor::on_adapter(const string& name, ValueAccessor<double>& adapter) {
|
||||
on_adapter(name, static_cast<ValueAccessor<void>&>(adapter));
|
||||
}
|
||||
|
||||
void AttributeVisitor::on_adapter(const string& name, ValueAccessor<std::vector<int8_t>>& adapter) {
|
||||
void ov::AttributeVisitor::on_adapter(const string& name, ValueAccessor<std::vector<int8_t>>& adapter) {
|
||||
on_adapter(name, static_cast<ValueAccessor<void>&>(adapter));
|
||||
}
|
||||
|
||||
void AttributeVisitor::on_adapter(const string& name, ValueAccessor<std::vector<int16_t>>& adapter) {
|
||||
void ov::AttributeVisitor::on_adapter(const string& name, ValueAccessor<std::vector<int16_t>>& adapter) {
|
||||
on_adapter(name, static_cast<ValueAccessor<void>&>(adapter));
|
||||
}
|
||||
|
||||
void AttributeVisitor::on_adapter(const string& name, ValueAccessor<std::vector<int32_t>>& adapter) {
|
||||
void ov::AttributeVisitor::on_adapter(const string& name, ValueAccessor<std::vector<int32_t>>& adapter) {
|
||||
on_adapter(name, static_cast<ValueAccessor<void>&>(adapter));
|
||||
}
|
||||
|
||||
void AttributeVisitor::on_adapter(const string& name, ValueAccessor<std::vector<int64_t>>& adapter) {
|
||||
void ov::AttributeVisitor::on_adapter(const string& name, ValueAccessor<std::vector<int64_t>>& adapter) {
|
||||
on_adapter(name, static_cast<ValueAccessor<void>&>(adapter));
|
||||
}
|
||||
|
||||
void AttributeVisitor::on_adapter(const string& name, ValueAccessor<std::vector<uint8_t>>& adapter) {
|
||||
void ov::AttributeVisitor::on_adapter(const string& name, ValueAccessor<std::vector<uint8_t>>& adapter) {
|
||||
on_adapter(name, static_cast<ValueAccessor<void>&>(adapter));
|
||||
}
|
||||
|
||||
void AttributeVisitor::on_adapter(const string& name, ValueAccessor<std::vector<uint16_t>>& adapter) {
|
||||
void ov::AttributeVisitor::on_adapter(const string& name, ValueAccessor<std::vector<uint16_t>>& adapter) {
|
||||
on_adapter(name, static_cast<ValueAccessor<void>&>(adapter));
|
||||
}
|
||||
|
||||
void AttributeVisitor::on_adapter(const string& name, ValueAccessor<std::vector<uint32_t>>& adapter) {
|
||||
void ov::AttributeVisitor::on_adapter(const string& name, ValueAccessor<std::vector<uint32_t>>& adapter) {
|
||||
on_adapter(name, static_cast<ValueAccessor<void>&>(adapter));
|
||||
}
|
||||
|
||||
void AttributeVisitor::on_adapter(const string& name, ValueAccessor<std::vector<uint64_t>>& adapter) {
|
||||
void ov::AttributeVisitor::on_adapter(const string& name, ValueAccessor<std::vector<uint64_t>>& adapter) {
|
||||
on_adapter(name, static_cast<ValueAccessor<void>&>(adapter));
|
||||
}
|
||||
|
||||
void AttributeVisitor::on_adapter(const string& name, ValueAccessor<std::vector<float>>& adapter) {
|
||||
void ov::AttributeVisitor::on_adapter(const string& name, ValueAccessor<std::vector<float>>& adapter) {
|
||||
on_adapter(name, static_cast<ValueAccessor<void>&>(adapter));
|
||||
}
|
||||
|
||||
void AttributeVisitor::on_adapter(const string& name, ValueAccessor<std::vector<double>>& adapter) {
|
||||
void ov::AttributeVisitor::on_adapter(const string& name, ValueAccessor<std::vector<double>>& adapter) {
|
||||
on_adapter(name, static_cast<ValueAccessor<void>&>(adapter));
|
||||
}
|
||||
|
||||
void AttributeVisitor::on_adapter(const string& name, ValueAccessor<std::vector<string>>& adapter) {
|
||||
void ov::AttributeVisitor::on_adapter(const string& name, ValueAccessor<std::vector<string>>& adapter) {
|
||||
on_adapter(name, static_cast<ValueAccessor<void>&>(adapter));
|
||||
}
|
||||
|
||||
void AttributeVisitor::on_adapter(const string& name, ValueAccessor<std::shared_ptr<ngraph::Function>>& adapter) {
|
||||
void ov::AttributeVisitor::on_adapter(const string& name, ValueAccessor<std::shared_ptr<ngraph::Function>>& adapter) {
|
||||
on_adapter(name, static_cast<ValueAccessor<void>&>(adapter));
|
||||
}
|
||||
|
||||
const AttributeVisitor::node_id_t AttributeVisitor::invalid_node_id = "";
|
||||
const ov::AttributeVisitor::node_id_t ov::AttributeVisitor::invalid_node_id = "";
|
||||
|
||||
void AttributeVisitor::register_node(const std::shared_ptr<Node>& node, node_id_t id) {
|
||||
void ov::AttributeVisitor::register_node(const std::shared_ptr<ngraph::Node>& node, node_id_t id) {
|
||||
if (id == invalid_node_id) {
|
||||
id = node->get_friendly_name();
|
||||
}
|
||||
@@ -145,12 +144,13 @@ void AttributeVisitor::register_node(const std::shared_ptr<Node>& node, node_id_
|
||||
m_node_id_map[node] = id;
|
||||
}
|
||||
|
||||
std::shared_ptr<Node> AttributeVisitor::get_registered_node(node_id_t id) {
|
||||
std::shared_ptr<ngraph::Node> ov::AttributeVisitor::get_registered_node(node_id_t id) {
|
||||
auto it = m_id_node_map.find(id);
|
||||
return it == m_id_node_map.end() ? shared_ptr<Node>() : it->second;
|
||||
return it == m_id_node_map.end() ? shared_ptr<ngraph::Node>() : it->second;
|
||||
}
|
||||
|
||||
AttributeVisitor::node_id_t AttributeVisitor::get_registered_node_id(const std::shared_ptr<Node>& node) {
|
||||
ov::AttributeVisitor::node_id_t ov::AttributeVisitor::get_registered_node_id(
|
||||
const std::shared_ptr<ngraph::Node>& node) {
|
||||
auto it = m_node_id_map.find(node);
|
||||
return it == m_node_id_map.end() ? invalid_node_id : it->second;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ std::ostream& ngraph::operator<<(std::ostream& s, const AxisSet& axis_set) {
|
||||
return s;
|
||||
}
|
||||
|
||||
const std::vector<int64_t>& ngraph::AttributeAdapter<ngraph::AxisSet>::get() {
|
||||
const std::vector<int64_t>& ov::AttributeAdapter<ngraph::AxisSet>::get() {
|
||||
if (!m_buffer_valid) {
|
||||
m_buffer.clear();
|
||||
for (auto elt : m_ref) {
|
||||
@@ -48,12 +48,12 @@ const std::vector<int64_t>& ngraph::AttributeAdapter<ngraph::AxisSet>::get() {
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
void ngraph::AttributeAdapter<ngraph::AxisSet>::set(const std::vector<int64_t>& value) {
|
||||
m_ref = AxisSet();
|
||||
void ov::AttributeAdapter<ngraph::AxisSet>::set(const std::vector<int64_t>& value) {
|
||||
m_ref = ngraph::AxisSet();
|
||||
for (auto elt : value) {
|
||||
m_ref.insert(elt);
|
||||
}
|
||||
m_buffer_valid = false;
|
||||
}
|
||||
|
||||
constexpr ngraph::DiscreteTypeInfo ngraph::AttributeAdapter<ngraph::AxisSet>::type_info;
|
||||
constexpr ov::DiscreteTypeInfo ov::AttributeAdapter<ngraph::AxisSet>::type_info;
|
||||
|
||||
@@ -35,4 +35,4 @@ ngraph::AxisVector& ngraph::AxisVector::operator=(AxisVector&& v) noexcept {
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr ngraph::DiscreteTypeInfo ngraph::AttributeAdapter<ngraph::AxisVector>::type_info;
|
||||
constexpr ov::DiscreteTypeInfo ov::AttributeAdapter<ngraph::AxisVector>::type_info;
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include "ngraph/util.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
|
||||
std::ostream& ngraph::operator<<(std::ostream& s, const Coordinate& coordinate) {
|
||||
s << "Coordinate{";
|
||||
@@ -41,4 +40,4 @@ ngraph::Coordinate& ngraph::Coordinate::operator=(Coordinate&& v) noexcept {
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr ngraph::DiscreteTypeInfo ngraph::AttributeAdapter<ngraph::Coordinate>::type_info;
|
||||
constexpr ov::DiscreteTypeInfo ov::AttributeAdapter<ngraph::Coordinate>::type_info;
|
||||
|
||||
@@ -40,4 +40,4 @@ ngraph::CoordinateDiff& ngraph::CoordinateDiff::operator=(CoordinateDiff&& v) no
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr ngraph::DiscreteTypeInfo ngraph::AttributeAdapter<ngraph::CoordinateDiff>::type_info;
|
||||
constexpr ov::DiscreteTypeInfo ov::AttributeAdapter<ngraph::CoordinateDiff>::type_info;
|
||||
|
||||
@@ -7,22 +7,19 @@
|
||||
#include "ngraph/log.hpp"
|
||||
#include "ngraph/type.hpp"
|
||||
|
||||
using namespace ngraph;
|
||||
|
||||
namespace ngraph {
|
||||
namespace ov {
|
||||
template <>
|
||||
EnumNames<reduction::Type>& EnumNames<reduction::Type>::get() {
|
||||
static auto enum_names = EnumNames<reduction::Type>("reduction::Type",
|
||||
{{"SUM", reduction::Type::SUM},
|
||||
{"PROD", reduction::Type::PROD},
|
||||
{"MIN", reduction::Type::MIN},
|
||||
{"MAX", reduction::Type::MAX}});
|
||||
EnumNames<ngraph::reduction::Type>& EnumNames<ngraph::reduction::Type>::get() {
|
||||
static auto enum_names = ov::EnumNames<ngraph::reduction::Type>("reduction::Type",
|
||||
{{"SUM", ngraph::reduction::Type::SUM},
|
||||
{"PROD", ngraph::reduction::Type::PROD},
|
||||
{"MIN", ngraph::reduction::Type::MIN},
|
||||
{"MAX", ngraph::reduction::Type::MAX}});
|
||||
return enum_names;
|
||||
}
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<ngraph::reduction::Type>::type_info;
|
||||
} // namespace ov
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<reduction::Type>::type_info;
|
||||
} // namespace ngraph
|
||||
|
||||
std::ostream& reduction::operator<<(std::ostream& out, const reduction::Type& obj) {
|
||||
std::ostream& ngraph::reduction::operator<<(std::ostream& out, const ngraph::reduction::Type& obj) {
|
||||
return out << as_string(obj);
|
||||
}
|
||||
|
||||
@@ -835,6 +835,7 @@ bool Node::constant_fold(OutputVector& output_values, const OutputVector& input_
|
||||
return false;
|
||||
}
|
||||
|
||||
namespace ov {
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<shared_ptr<Node>>::type_info;
|
||||
|
||||
AttributeAdapter<std::shared_ptr<Node>>::AttributeAdapter(std::shared_ptr<Node>& value) : m_ref(value) {}
|
||||
@@ -874,3 +875,4 @@ bool AttributeAdapter<NodeVector>::visit_attributes(AttributeVisitor& visitor) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} // namespace ov
|
||||
|
||||
@@ -117,7 +117,7 @@ bool op::v1::BinaryConvolution::visit_attributes(AttributeVisitor& visitor) {
|
||||
return true;
|
||||
}
|
||||
|
||||
namespace ngraph {
|
||||
namespace ov {
|
||||
template <>
|
||||
NGRAPH_API EnumNames<op::v1::BinaryConvolution::BinaryConvolutionMode>&
|
||||
EnumNames<op::v1::BinaryConvolution::BinaryConvolutionMode>::get() {
|
||||
@@ -128,11 +128,11 @@ EnumNames<op::v1::BinaryConvolution::BinaryConvolutionMode>::get() {
|
||||
}
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<op::v1::BinaryConvolution::BinaryConvolutionMode>::type_info;
|
||||
} // namespace ov
|
||||
|
||||
std::ostream& operator<<(std::ostream& s, const op::v1::BinaryConvolution::BinaryConvolutionMode& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
} // namespace ngraph
|
||||
|
||||
op::v1::BinaryConvolution::BinaryConvolutionMode op::v1::BinaryConvolution::mode_from_string(
|
||||
const std::string& mode) const {
|
||||
|
||||
@@ -113,7 +113,11 @@ bool op::DepthToSpace::has_evaluate() const {
|
||||
return !get_input_partial_shape(0).is_dynamic();
|
||||
}
|
||||
|
||||
namespace ngraph {
|
||||
std::ostream& ngraph::operator<<(std::ostream& s, const op::DepthToSpace::DepthToSpaceMode& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
namespace ov {
|
||||
template <>
|
||||
NGRAPH_API EnumNames<op::DepthToSpace::DepthToSpaceMode>& EnumNames<op::DepthToSpace::DepthToSpaceMode>::get() {
|
||||
static auto enum_names = EnumNames<op::DepthToSpace::DepthToSpaceMode>(
|
||||
@@ -124,8 +128,4 @@ NGRAPH_API EnumNames<op::DepthToSpace::DepthToSpaceMode>& EnumNames<op::DepthToS
|
||||
}
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<op::DepthToSpace::DepthToSpaceMode>::type_info;
|
||||
|
||||
std::ostream& operator<<(std::ostream& s, const op::DepthToSpace::DepthToSpaceMode& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
} // namespace ngraph
|
||||
} // namespace ov
|
||||
|
||||
@@ -51,7 +51,7 @@ void op::v0::Gelu::validate_and_infer_types() {
|
||||
|
||||
// ------------------------------ V7 ------------------------------
|
||||
|
||||
namespace ngraph {
|
||||
namespace ov {
|
||||
template <>
|
||||
NGRAPH_API EnumNames<op::GeluApproximationMode>& EnumNames<op::GeluApproximationMode>::get() {
|
||||
static auto enum_names = EnumNames<op::GeluApproximationMode>(
|
||||
@@ -61,11 +61,10 @@ NGRAPH_API EnumNames<op::GeluApproximationMode>& EnumNames<op::GeluApproximation
|
||||
}
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<op::GeluApproximationMode>::type_info;
|
||||
|
||||
} // namespace ov
|
||||
std::ostream& op::operator<<(std::ostream& s, const op::GeluApproximationMode& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
} // namespace ngraph
|
||||
|
||||
NGRAPH_RTTI_DEFINITION(op::v7::Gelu, "Gelu", 7);
|
||||
|
||||
|
||||
@@ -69,7 +69,11 @@ shared_ptr<Node> op::v0::Interpolate::clone_with_new_inputs(const OutputVector&
|
||||
return make_shared<op::v0::Interpolate>(new_args.at(0), new_args.at(1), m_attrs);
|
||||
}
|
||||
|
||||
namespace ngraph {
|
||||
std::ostream& ngraph::operator<<(std::ostream& s, const op::v0::Interpolate::InterpolateMode& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
namespace ov {
|
||||
template <>
|
||||
EnumNames<op::v0::Interpolate::InterpolateMode>& EnumNames<op::v0::Interpolate::InterpolateMode>::get() {
|
||||
static auto enum_names =
|
||||
@@ -83,10 +87,7 @@ EnumNames<op::v0::Interpolate::InterpolateMode>& EnumNames<op::v0::Interpolate::
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<op::v0::Interpolate::InterpolateMode>::type_info;
|
||||
|
||||
std::ostream& operator<<(std::ostream& s, const op::v0::Interpolate::InterpolateMode& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
} // namespace ngraph
|
||||
} // namespace ov
|
||||
|
||||
// Interpolate v4
|
||||
|
||||
@@ -479,7 +480,23 @@ bool op::v4::Interpolate::has_evaluate() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
namespace ngraph {
|
||||
std::ostream& ngraph::operator<<(std::ostream& s, const op::v4::Interpolate::InterpolateMode& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
std::ostream& ngraph::operator<<(std::ostream& s, const op::v4::Interpolate::ShapeCalcMode& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
std::ostream& ngraph::operator<<(std::ostream& s, const op::v4::Interpolate::CoordinateTransformMode& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
std::ostream& ngraph::operator<<(std::ostream& s, const op::v4::Interpolate::NearestMode& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
namespace ov {
|
||||
template <>
|
||||
NGRAPH_API EnumNames<op::v4::Interpolate::InterpolateMode>& EnumNames<op::v4::Interpolate::InterpolateMode>::get() {
|
||||
static auto enum_names = EnumNames<op::v4::Interpolate::InterpolateMode>(
|
||||
@@ -493,10 +510,6 @@ NGRAPH_API EnumNames<op::v4::Interpolate::InterpolateMode>& EnumNames<op::v4::In
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<op::v4::Interpolate::InterpolateMode>::type_info;
|
||||
|
||||
std::ostream& operator<<(std::ostream& s, const op::v4::Interpolate::InterpolateMode& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
template <>
|
||||
NGRAPH_API EnumNames<op::v4::Interpolate::ShapeCalcMode>& EnumNames<op::v4::Interpolate::ShapeCalcMode>::get() {
|
||||
static auto enum_names = EnumNames<op::v4::Interpolate::ShapeCalcMode>(
|
||||
@@ -507,10 +520,6 @@ NGRAPH_API EnumNames<op::v4::Interpolate::ShapeCalcMode>& EnumNames<op::v4::Inte
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<op::v4::Interpolate::ShapeCalcMode>::type_info;
|
||||
|
||||
std::ostream& operator<<(std::ostream& s, const op::v4::Interpolate::ShapeCalcMode& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
template <>
|
||||
NGRAPH_API EnumNames<op::v4::Interpolate::CoordinateTransformMode>&
|
||||
EnumNames<op::v4::Interpolate::CoordinateTransformMode>::get() {
|
||||
@@ -526,10 +535,6 @@ EnumNames<op::v4::Interpolate::CoordinateTransformMode>::get() {
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<op::v4::Interpolate::CoordinateTransformMode>::type_info;
|
||||
|
||||
std::ostream& operator<<(std::ostream& s, const op::v4::Interpolate::CoordinateTransformMode& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
template <>
|
||||
NGRAPH_API EnumNames<op::v4::Interpolate::NearestMode>& EnumNames<op::v4::Interpolate::NearestMode>::get() {
|
||||
static auto enum_names = EnumNames<op::v4::Interpolate::NearestMode>(
|
||||
@@ -543,8 +548,4 @@ NGRAPH_API EnumNames<op::v4::Interpolate::NearestMode>& EnumNames<op::v4::Interp
|
||||
}
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<op::v4::Interpolate::NearestMode>::type_info;
|
||||
|
||||
std::ostream& operator<<(std::ostream& s, const op::v4::Interpolate::NearestMode& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
} // namespace ngraph
|
||||
} // namespace ov
|
||||
|
||||
@@ -306,6 +306,6 @@ op::v5::Loop::Loop(const op::v5::Loop& other) : SubGraphOp() {
|
||||
other.clone_to(*this, other.input_values());
|
||||
}
|
||||
|
||||
namespace ngraph {
|
||||
namespace ov {
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<op::v5::Loop::SpecialBodyPorts>::type_info;
|
||||
}
|
||||
|
||||
@@ -333,7 +333,7 @@ shared_ptr<Node> op::v0::LSTMCell::clone_with_new_inputs(const OutputVector& new
|
||||
}
|
||||
}
|
||||
|
||||
namespace ngraph {
|
||||
namespace ov {
|
||||
template <>
|
||||
EnumNames<op::LSTMWeightsFormat>& EnumNames<op::LSTMWeightsFormat>::get() {
|
||||
static auto enum_names = EnumNames<op::LSTMWeightsFormat>("op::LSTMWeightsFormat",
|
||||
@@ -347,10 +347,11 @@ EnumNames<op::LSTMWeightsFormat>& EnumNames<op::LSTMWeightsFormat>::get() {
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<op::LSTMWeightsFormat>::type_info;
|
||||
|
||||
} // namespace ov
|
||||
|
||||
std::ostream& operator<<(std::ostream& s, const op::LSTMWeightsFormat& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
} // namespace ngraph
|
||||
|
||||
op::v4::LSTMCell::LSTMCell() {
|
||||
m_activations = {"sigmoid", "tanh", "tanh"};
|
||||
|
||||
@@ -64,7 +64,11 @@ bool ngraph::op::v8::MatrixNms::visit_attributes(AttributeVisitor& visitor) {
|
||||
return true;
|
||||
}
|
||||
|
||||
namespace ngraph {
|
||||
std::ostream& ngraph::operator<<(std::ostream& s, const op::v8::MatrixNms::DecayFunction& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
namespace ov {
|
||||
template <>
|
||||
NGRAPH_API EnumNames<op::v8::MatrixNms::DecayFunction>& EnumNames<op::v8::MatrixNms::DecayFunction>::get() {
|
||||
static auto enum_names =
|
||||
@@ -76,7 +80,4 @@ NGRAPH_API EnumNames<op::v8::MatrixNms::DecayFunction>& EnumNames<op::v8::Matrix
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<op::v8::MatrixNms::DecayFunction>::type_info;
|
||||
|
||||
std::ostream& operator<<(std::ostream& s, const op::v8::MatrixNms::DecayFunction& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
} // namespace ngraph
|
||||
} // namespace ov
|
||||
|
||||
@@ -70,7 +70,7 @@ bool op::v0::MVN::visit_attributes(AttributeVisitor& visitor) {
|
||||
|
||||
// ------------------------------ V6 ------------------------------
|
||||
|
||||
namespace ngraph {
|
||||
namespace ov {
|
||||
template <>
|
||||
NGRAPH_API EnumNames<op::MVNEpsMode>& EnumNames<op::MVNEpsMode>::get() {
|
||||
static auto enum_names = EnumNames<op::MVNEpsMode>(
|
||||
@@ -81,10 +81,11 @@ NGRAPH_API EnumNames<op::MVNEpsMode>& EnumNames<op::MVNEpsMode>::get() {
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<op::MVNEpsMode>::type_info;
|
||||
|
||||
} // namespace ov
|
||||
|
||||
std::ostream& op::operator<<(std::ostream& s, const op::MVNEpsMode& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
} // namespace ngraph
|
||||
|
||||
NGRAPH_RTTI_DEFINITION(op::v6::MVN, "MVN", 6);
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ int64_t op::v1::NonMaxSuppression::max_boxes_output_from_input() const {
|
||||
return max_output_boxes;
|
||||
}
|
||||
|
||||
namespace ngraph {
|
||||
namespace ov {
|
||||
template <>
|
||||
EnumNames<op::v1::NonMaxSuppression::BoxEncodingType>& EnumNames<op::v1::NonMaxSuppression::BoxEncodingType>::get() {
|
||||
static auto enum_names = EnumNames<op::v1::NonMaxSuppression::BoxEncodingType>(
|
||||
@@ -186,10 +186,11 @@ EnumNames<op::v1::NonMaxSuppression::BoxEncodingType>& EnumNames<op::v1::NonMaxS
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<op::v1::NonMaxSuppression::BoxEncodingType>::type_info;
|
||||
|
||||
std::ostream& operator<<(std::ostream& s, const op::v1::NonMaxSuppression::BoxEncodingType& type) {
|
||||
} // namespace ov
|
||||
|
||||
std::ostream& ngraph::operator<<(std::ostream& s, const op::v1::NonMaxSuppression::BoxEncodingType& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
} // namespace ngraph
|
||||
|
||||
// ------------------------------ V3 ------------------------------
|
||||
|
||||
@@ -360,7 +361,7 @@ int64_t op::v3::NonMaxSuppression::max_boxes_output_from_input() const {
|
||||
return max_output_boxes;
|
||||
}
|
||||
|
||||
namespace ngraph {
|
||||
namespace ov {
|
||||
template <>
|
||||
EnumNames<op::v3::NonMaxSuppression::BoxEncodingType>& EnumNames<op::v3::NonMaxSuppression::BoxEncodingType>::get() {
|
||||
static auto enum_names = EnumNames<op::v3::NonMaxSuppression::BoxEncodingType>(
|
||||
@@ -372,10 +373,11 @@ EnumNames<op::v3::NonMaxSuppression::BoxEncodingType>& EnumNames<op::v3::NonMaxS
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<op::v3::NonMaxSuppression::BoxEncodingType>::type_info;
|
||||
|
||||
std::ostream& operator<<(std::ostream& s, const op::v3::NonMaxSuppression::BoxEncodingType& type) {
|
||||
} // namespace ov
|
||||
|
||||
std::ostream& ngraph::operator<<(std::ostream& s, const op::v3::NonMaxSuppression::BoxEncodingType& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
} // namespace ngraph
|
||||
|
||||
// ------------------------------ V4 ------------------------------
|
||||
|
||||
@@ -813,7 +815,11 @@ void op::v5::NonMaxSuppression::validate_and_infer_types() {
|
||||
set_output_type(2, m_output_type, Shape{1});
|
||||
}
|
||||
|
||||
namespace ngraph {
|
||||
std::ostream& ngraph::operator<<(std::ostream& s, const op::v5::NonMaxSuppression::BoxEncodingType& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
namespace ov {
|
||||
template <>
|
||||
EnumNames<op::v5::NonMaxSuppression::BoxEncodingType>& EnumNames<op::v5::NonMaxSuppression::BoxEncodingType>::get() {
|
||||
static auto enum_names = EnumNames<op::v5::NonMaxSuppression::BoxEncodingType>(
|
||||
@@ -825,7 +831,4 @@ EnumNames<op::v5::NonMaxSuppression::BoxEncodingType>& EnumNames<op::v5::NonMaxS
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<op::v5::NonMaxSuppression::BoxEncodingType>::type_info;
|
||||
|
||||
std::ostream& operator<<(std::ostream& s, const op::v5::NonMaxSuppression::BoxEncodingType& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
} // namespace ngraph
|
||||
} // namespace ov
|
||||
|
||||
@@ -48,11 +48,11 @@ void op::Parameter::set_is_relevant_to_shapes(bool is_relevant) {
|
||||
m_is_relevant_to_shapes = is_relevant;
|
||||
}
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<ParameterVector>::type_info;
|
||||
constexpr DiscreteTypeInfo ov::AttributeAdapter<ParameterVector>::type_info;
|
||||
|
||||
AttributeAdapter<ParameterVector>::AttributeAdapter(ParameterVector& ref) : m_ref(ref) {}
|
||||
ov::AttributeAdapter<ParameterVector>::AttributeAdapter(ParameterVector& ref) : m_ref(ref) {}
|
||||
|
||||
bool AttributeAdapter<ParameterVector>::visit_attributes(AttributeVisitor& visitor) {
|
||||
bool ov::AttributeAdapter<ParameterVector>::visit_attributes(AttributeVisitor& visitor) {
|
||||
size_t size = m_ref.size();
|
||||
visitor.on_attribute("size", size);
|
||||
if (size != m_ref.size()) {
|
||||
|
||||
@@ -62,11 +62,11 @@ bool op::Result::constant_fold(OutputVector& output_values, const OutputVector&
|
||||
return false;
|
||||
}
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<ResultVector>::type_info;
|
||||
constexpr DiscreteTypeInfo ov::AttributeAdapter<ResultVector>::type_info;
|
||||
|
||||
AttributeAdapter<ResultVector>::AttributeAdapter(ResultVector& ref) : m_ref(ref) {}
|
||||
ov::AttributeAdapter<ResultVector>::AttributeAdapter(ResultVector& ref) : m_ref(ref) {}
|
||||
|
||||
bool AttributeAdapter<ResultVector>::visit_attributes(AttributeVisitor& visitor) {
|
||||
bool ov::AttributeAdapter<ResultVector>::visit_attributes(AttributeVisitor& visitor) {
|
||||
size_t size = m_ref.size();
|
||||
visitor.on_attribute("size", size);
|
||||
if (size != m_ref.size()) {
|
||||
|
||||
@@ -197,7 +197,11 @@ bool op::v1::Reverse::has_evaluate() const {
|
||||
}
|
||||
}
|
||||
|
||||
namespace ngraph {
|
||||
std::ostream& ngraph::operator<<(std::ostream& s, const op::v1::Reverse::Mode& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
namespace ov {
|
||||
template <>
|
||||
EnumNames<op::v1::Reverse::Mode>& EnumNames<op::v1::Reverse::Mode>::get() {
|
||||
static auto enum_names = EnumNames<op::v1::Reverse::Mode>(
|
||||
@@ -207,8 +211,4 @@ EnumNames<op::v1::Reverse::Mode>& EnumNames<op::v1::Reverse::Mode>::get() {
|
||||
}
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<op::v1::Reverse::Mode>::type_info;
|
||||
|
||||
std::ostream& operator<<(std::ostream& s, const op::v1::Reverse::Mode& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
} // namespace ngraph
|
||||
} // namespace ov
|
||||
|
||||
@@ -161,7 +161,7 @@ shared_ptr<Node> op::v3::ROIAlign::clone_with_new_inputs(const OutputVector& new
|
||||
m_mode);
|
||||
}
|
||||
|
||||
namespace ngraph {
|
||||
namespace ov {
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<op::v3::ROIAlign::PoolingMode>::type_info;
|
||||
|
||||
template <>
|
||||
@@ -172,10 +172,11 @@ NGRAPH_API EnumNames<op::v3::ROIAlign::PoolingMode>& EnumNames<op::v3::ROIAlign:
|
||||
return enum_names;
|
||||
}
|
||||
|
||||
} // namespace ov
|
||||
|
||||
std::ostream& operator<<(std::ostream& s, const op::v3::ROIAlign::PoolingMode& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
} // namespace ngraph
|
||||
|
||||
namespace roi_alinop {
|
||||
template <element::Type_t ET>
|
||||
|
||||
@@ -113,7 +113,11 @@ bool op::v5::Round::has_evaluate() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
namespace ngraph {
|
||||
std::ostream& ngraph::operator<<(std::ostream& s, const op::v5::Round::RoundMode& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
namespace ov {
|
||||
template <>
|
||||
EnumNames<op::v5::Round::RoundMode>& EnumNames<op::v5::Round::RoundMode>::get() {
|
||||
static auto enum_names =
|
||||
@@ -124,8 +128,4 @@ EnumNames<op::v5::Round::RoundMode>& EnumNames<op::v5::Round::RoundMode>::get()
|
||||
}
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<op::v5::Round::RoundMode>::type_info;
|
||||
|
||||
std::ostream& operator<<(std::ostream& s, const op::v5::Round::RoundMode& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
} // namespace ngraph
|
||||
} // namespace ov
|
||||
|
||||
@@ -116,7 +116,11 @@ bool ngraph::op::v0::SpaceToDepth::has_evaluate() const {
|
||||
return !get_input_partial_shape(0).is_dynamic();
|
||||
}
|
||||
|
||||
namespace ngraph {
|
||||
std::ostream& ngraph::operator<<(std::ostream& s, const op::v0::SpaceToDepth::SpaceToDepthMode& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
namespace ov {
|
||||
template <>
|
||||
NGRAPH_API EnumNames<op::v0::SpaceToDepth::SpaceToDepthMode>& EnumNames<op::v0::SpaceToDepth::SpaceToDepthMode>::get() {
|
||||
static auto enum_names = EnumNames<op::v0::SpaceToDepth::SpaceToDepthMode>(
|
||||
@@ -127,8 +131,4 @@ NGRAPH_API EnumNames<op::v0::SpaceToDepth::SpaceToDepthMode>& EnumNames<op::v0::
|
||||
}
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<op::v0::SpaceToDepth::SpaceToDepthMode>::type_info;
|
||||
|
||||
std::ostream& operator<<(std::ostream& s, const op::v0::SpaceToDepth::SpaceToDepthMode& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
} // namespace ngraph
|
||||
} // namespace ov
|
||||
|
||||
@@ -11,127 +11,173 @@
|
||||
#include "ngraph/check.hpp"
|
||||
#include "ngraph/enum_names.hpp"
|
||||
|
||||
using namespace ngraph;
|
||||
namespace ov {
|
||||
|
||||
const op::AutoBroadcastSpec op::AutoBroadcastSpec::NUMPY(AutoBroadcastType::NUMPY, 0);
|
||||
const op::AutoBroadcastSpec op::AutoBroadcastSpec::NONE{AutoBroadcastType::NONE, 0};
|
||||
|
||||
namespace ngraph {
|
||||
template <>
|
||||
NGRAPH_API EnumNames<op::PadMode>& EnumNames<op::PadMode>::get() {
|
||||
static auto enum_names = EnumNames<op::PadMode>("op::PadMode",
|
||||
{{"constant", op::PadMode::CONSTANT},
|
||||
{"edge", op::PadMode::EDGE},
|
||||
{"reflect", op::PadMode::REFLECT},
|
||||
{"symmetric", op::PadMode::SYMMETRIC}});
|
||||
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}});
|
||||
return enum_names;
|
||||
}
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<op::PadMode>::type_info;
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<ngraph::op::PadMode>::type_info;
|
||||
|
||||
std::ostream& op::operator<<(std::ostream& s, const op::PadMode& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
template <>
|
||||
NGRAPH_API EnumNames<op::PadType>& EnumNames<op::PadType>::get() {
|
||||
static auto enum_names = EnumNames<op::PadType>("op::PadType",
|
||||
{{"explicit", op::PadType::EXPLICIT},
|
||||
{"same_lower", op::PadType::SAME_LOWER},
|
||||
{"same_upper", op::PadType::SAME_UPPER},
|
||||
{"valid", op::PadType::VALID}});
|
||||
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}});
|
||||
return enum_names;
|
||||
}
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<op::PadType>::type_info;
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<ngraph::op::PadType>::type_info;
|
||||
|
||||
std::ostream& op::operator<<(std::ostream& s, const op::PadType& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
template <>
|
||||
NGRAPH_API EnumNames<op::RoundingType>& EnumNames<op::RoundingType>::get() {
|
||||
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;
|
||||
}
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<ngraph::op::RoundingType>::type_info;
|
||||
|
||||
template <>
|
||||
NGRAPH_API EnumNames<ngraph::op::AutoBroadcastType>& EnumNames<ngraph::op::AutoBroadcastType>::get() {
|
||||
static auto enum_names =
|
||||
EnumNames<op::RoundingType>("op::RoundingType",
|
||||
{{"floor", op::RoundingType::FLOOR}, {"ceil", op::RoundingType::CEIL}});
|
||||
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}});
|
||||
return enum_names;
|
||||
}
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<op::RoundingType>::type_info;
|
||||
|
||||
std::ostream& op::operator<<(std::ostream& s, const op::RoundingType& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<ngraph::op::AutoBroadcastType>::type_info;
|
||||
|
||||
template <>
|
||||
NGRAPH_API EnumNames<op::AutoBroadcastType>& EnumNames<op::AutoBroadcastType>::get() {
|
||||
static auto enum_names = EnumNames<op::AutoBroadcastType>("op::AutoBroadcastType",
|
||||
{{"none", op::AutoBroadcastType::NONE},
|
||||
{"explicit", op::AutoBroadcastType::EXPLICIT},
|
||||
{"numpy", op::AutoBroadcastType::NUMPY},
|
||||
{"pdpd", op::AutoBroadcastType::PDPD}});
|
||||
return enum_names;
|
||||
}
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<op::AutoBroadcastType>::type_info;
|
||||
|
||||
template <>
|
||||
NGRAPH_API EnumNames<op::BroadcastType>& EnumNames<op::BroadcastType>::get() {
|
||||
static auto enum_names = EnumNames<op::BroadcastType>("op::BroadcastType",
|
||||
{{"none", op::BroadcastType::NONE},
|
||||
{"numpy", op::BroadcastType::NUMPY},
|
||||
{"explicit", op::BroadcastType::EXPLICIT},
|
||||
{"pdpd", op::BroadcastType::PDPD},
|
||||
{"bidirectional", op::BroadcastType::BIDIRECTIONAL}});
|
||||
return enum_names;
|
||||
}
|
||||
|
||||
std::ostream& op::operator<<(std::ostream& s, const op::BroadcastType& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<op::BroadcastType>::type_info;
|
||||
|
||||
std::ostream& op::operator<<(std::ostream& s, const op::AutoBroadcastType& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
template <>
|
||||
NGRAPH_API EnumNames<op::EpsMode>& EnumNames<op::EpsMode>::get() {
|
||||
NGRAPH_API EnumNames<ngraph::op::BroadcastType>& EnumNames<ngraph::op::BroadcastType>::get() {
|
||||
static auto enum_names =
|
||||
EnumNames<op::EpsMode>("op::EpsMode", {{"add", op::EpsMode::ADD}, {"max", op::EpsMode::MAX}});
|
||||
EnumNames<ngraph::op::BroadcastType>("ngraph::op::BroadcastType",
|
||||
{{"none", ngraph::op::BroadcastType::NONE},
|
||||
{"numpy", ngraph::op::BroadcastType::NUMPY},
|
||||
{"explicit", ngraph::op::BroadcastType::EXPLICIT},
|
||||
{"pdpd", ngraph::op::BroadcastType::PDPD},
|
||||
{"bidirectional", ngraph::op::BroadcastType::BIDIRECTIONAL}});
|
||||
return enum_names;
|
||||
}
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<op::EpsMode>::type_info;
|
||||
|
||||
std::ostream& op::operator<<(std::ostream& s, const op::EpsMode& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<ngraph::op::BroadcastType>::type_info;
|
||||
template <>
|
||||
NGRAPH_API EnumNames<op::TopKSortType>& EnumNames<op::TopKSortType>::get() {
|
||||
static auto enum_names = EnumNames<op::TopKSortType>("op::TopKSortType",
|
||||
{{"none", op::TopKSortType::NONE},
|
||||
{"index", op::TopKSortType::SORT_INDICES},
|
||||
{"value", op::TopKSortType::SORT_VALUES}});
|
||||
return enum_names;
|
||||
}
|
||||
template <>
|
||||
NGRAPH_API EnumNames<op::TopKMode>& EnumNames<op::TopKMode>::get() {
|
||||
NGRAPH_API EnumNames<ngraph::op::EpsMode>& EnumNames<ngraph::op::EpsMode>::get() {
|
||||
static auto enum_names =
|
||||
EnumNames<op::TopKMode>("op::TopKMode", {{"min", op::TopKMode::MIN}, {"max", op::TopKMode::MAX}});
|
||||
EnumNames<ngraph::op::EpsMode>("ngraph::op::EpsMode",
|
||||
{{"add", ngraph::op::EpsMode::ADD}, {"max", ngraph::op::EpsMode::MAX}});
|
||||
return enum_names;
|
||||
}
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<op::TopKSortType>::type_info;
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<op::TopKMode>::type_info;
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<ngraph::op::EpsMode>::type_info;
|
||||
|
||||
std::ostream& op::operator<<(std::ostream& s, const op::TopKSortType& type) {
|
||||
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}});
|
||||
return enum_names;
|
||||
}
|
||||
template <>
|
||||
NGRAPH_API EnumNames<ngraph::op::TopKMode>& EnumNames<ngraph::op::TopKMode>::get() {
|
||||
static auto enum_names =
|
||||
EnumNames<ngraph::op::TopKMode>("ngraph::op::TopKMode",
|
||||
{{"min", ngraph::op::TopKMode::MIN}, {"max", ngraph::op::TopKMode::MAX}});
|
||||
return enum_names;
|
||||
}
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<ngraph::op::TopKSortType>::type_info;
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<ngraph::op::TopKMode>::type_info;
|
||||
|
||||
bool AttributeAdapter<ngraph::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) {
|
||||
visitor.on_attribute("auto_broadcast_axis", m_ref.m_axis);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<ngraph::op::AutoBroadcastSpec>::type_info;
|
||||
|
||||
bool AttributeAdapter<ngraph::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) {
|
||||
visitor.start_structure(name);
|
||||
visitor.on_attribute("axis", m_ref.m_axis);
|
||||
visitor.finish_structure();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<ngraph::op::BroadcastModeSpec>::type_info;
|
||||
|
||||
NGRAPH_API
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<ngraph::op::RecurrentSequenceDirection>::type_info;
|
||||
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}});
|
||||
return enum_names;
|
||||
}
|
||||
} // namespace ov
|
||||
|
||||
const ngraph::op::AutoBroadcastSpec ngraph::op::AutoBroadcastSpec::NUMPY(AutoBroadcastType::NUMPY, 0);
|
||||
const ngraph::op::AutoBroadcastSpec ngraph::op::AutoBroadcastSpec::NONE{AutoBroadcastType::NONE, 0};
|
||||
|
||||
std::ostream& ngraph::op::operator<<(std::ostream& s, const ngraph::op::PadMode& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
std::ostream& op::operator<<(std::ostream& s, const op::TopKMode& type) {
|
||||
std::ostream& ngraph::op::operator<<(std::ostream& s, const ngraph::op::PadType& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
op::AutoBroadcastType op::AutoBroadcastSpec::type_from_string(const std::string& type) const {
|
||||
std::ostream& ngraph::op::operator<<(std::ostream& s, const ngraph::op::RoundingType& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
std::ostream& ngraph::op::operator<<(std::ostream& s, const ngraph::op::BroadcastType& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
std::ostream& ngraph::op::operator<<(std::ostream& s, const ngraph::op::AutoBroadcastType& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
std::ostream& ngraph::op::operator<<(std::ostream& s, const ngraph::op::EpsMode& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
std::ostream& ngraph::op::operator<<(std::ostream& s, const ngraph::op::TopKSortType& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
std::ostream& ngraph::op::operator<<(std::ostream& s, const ngraph::op::TopKMode& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
ngraph::op::AutoBroadcastType ngraph::op::AutoBroadcastSpec::type_from_string(const std::string& type) const {
|
||||
auto lowercase_type = type;
|
||||
std::transform(lowercase_type.begin(), lowercase_type.end(), lowercase_type.begin(), [](char c) {
|
||||
return std::tolower(c);
|
||||
@@ -147,47 +193,6 @@ op::AutoBroadcastType op::AutoBroadcastSpec::type_from_string(const std::string&
|
||||
return allowed_values.at(lowercase_type);
|
||||
}
|
||||
|
||||
bool AttributeAdapter<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 == op::AutoBroadcastType::PDPD) {
|
||||
visitor.on_attribute("auto_broadcast_axis", m_ref.m_axis);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<op::AutoBroadcastSpec>::type_info;
|
||||
|
||||
bool AttributeAdapter<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 == op::BroadcastType::PDPD) {
|
||||
visitor.start_structure(name);
|
||||
visitor.on_attribute("axis", m_ref.m_axis);
|
||||
visitor.finish_structure();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<op::BroadcastModeSpec>::type_info;
|
||||
|
||||
NGRAPH_API
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<op::RecurrentSequenceDirection>::type_info;
|
||||
|
||||
std::ostream& op::operator<<(std::ostream& s, const op::RecurrentSequenceDirection& direction) {
|
||||
std::ostream& ngraph::op::operator<<(std::ostream& s, const ngraph::op::RecurrentSequenceDirection& direction) {
|
||||
return s << as_string(direction);
|
||||
}
|
||||
template <>
|
||||
NGRAPH_API EnumNames<op::RecurrentSequenceDirection>& EnumNames<op::RecurrentSequenceDirection>::get() {
|
||||
static auto enum_names =
|
||||
EnumNames<op::RecurrentSequenceDirection>("op::RecurrentSequenceDirection",
|
||||
{{"forward", op::RecurrentSequenceDirection::FORWARD},
|
||||
{"reverse", op::RecurrentSequenceDirection::REVERSE},
|
||||
{"bidirectional", op::RecurrentSequenceDirection::BIDIRECTIONAL}});
|
||||
return enum_names;
|
||||
}
|
||||
} // namespace ngraph
|
||||
|
||||
@@ -153,7 +153,7 @@ Output<Node> op::util::MultiSubGraphOp::set_body_outputs(const ResultVector& bod
|
||||
return Output<Node>(shared_from_this(), output_index);
|
||||
}
|
||||
|
||||
namespace ngraph {
|
||||
namespace ov {
|
||||
NGRAPH_RTTI_DEFINITION(AttributeAdapter<std::vector<std::shared_ptr<op::util::MultiSubGraphOp::InputDescription>>>,
|
||||
"AttributeAdapter<std::vector<std::shared_ptr<ngraph::op::util::"
|
||||
"MultiSubGraphOp::InputDescription>>>",
|
||||
@@ -163,4 +163,4 @@ NGRAPH_RTTI_DEFINITION(AttributeAdapter<std::vector<std::shared_ptr<op::util::Mu
|
||||
"AttributeAdapter<std::vector<std::shared_ptr<ngraph::op::util::"
|
||||
"MultiSubGraphOp::OutputDescription>>>",
|
||||
0);
|
||||
} // namespace ngraph
|
||||
} // namespace ov
|
||||
|
||||
@@ -145,7 +145,11 @@ void op::util::NmsBase::validate_and_infer_types() {
|
||||
}
|
||||
}
|
||||
|
||||
namespace ngraph {
|
||||
std::ostream& ngraph::operator<<(std::ostream& s, const op::util::NmsBase::SortResultType& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
|
||||
namespace ov {
|
||||
template <>
|
||||
NGRAPH_API EnumNames<op::util::NmsBase::SortResultType>& EnumNames<op::util::NmsBase::SortResultType>::get() {
|
||||
static auto enum_names =
|
||||
@@ -157,8 +161,4 @@ NGRAPH_API EnumNames<op::util::NmsBase::SortResultType>& EnumNames<op::util::Nms
|
||||
}
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<op::util::NmsBase::SortResultType>::type_info;
|
||||
|
||||
std::ostream& operator<<(std::ostream& s, const op::util::NmsBase::SortResultType& type) {
|
||||
return s << as_string(type);
|
||||
}
|
||||
} // namespace ngraph
|
||||
} // namespace ov
|
||||
|
||||
@@ -4,6 +4,4 @@
|
||||
|
||||
#include <ngraph/op/util/variable.hpp>
|
||||
|
||||
namespace ngraph {
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<std::shared_ptr<Variable>>::type_info;
|
||||
}
|
||||
constexpr ov::DiscreteTypeInfo ov::AttributeAdapter<std::shared_ptr<ngraph::Variable>>::type_info;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "ngraph/partial_shape.hpp"
|
||||
#include "openvino/core/partial_shape.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include "ngraph/check.hpp"
|
||||
|
||||
using namespace ngraph;
|
||||
using namespace ov;
|
||||
|
||||
PartialShape::PartialShape() : PartialShape(std::initializer_list<Dimension>{}) {}
|
||||
|
||||
@@ -20,7 +20,7 @@ PartialShape::PartialShape(const std::vector<Dimension::value_type>& dimensions)
|
||||
: m_rank_is_static(true),
|
||||
m_dimensions(dimensions.begin(), dimensions.end()) {}
|
||||
|
||||
PartialShape::PartialShape(const Shape& shape)
|
||||
PartialShape::PartialShape(const ngraph::Shape& shape)
|
||||
: m_rank_is_static(true),
|
||||
m_shape_type(ShapeType::SHAPE_IS_STATIC),
|
||||
m_dimensions(shape.begin(), shape.end()) {}
|
||||
@@ -33,7 +33,7 @@ PartialShape::PartialShape(std::vector<Dimension> dimensions)
|
||||
: m_rank_is_static(true),
|
||||
m_dimensions(std::move(dimensions)) {}
|
||||
|
||||
bool ngraph::PartialShape::is_static() const {
|
||||
bool PartialShape::is_static() const {
|
||||
ShapeType shape_type = m_shape_type;
|
||||
|
||||
if (m_shape_type == ShapeType::SHAPE_IS_UNKNOWN || m_shape_type == ShapeType::SHAPE_IS_UPDATED) {
|
||||
@@ -52,7 +52,7 @@ bool ngraph::PartialShape::is_static() const {
|
||||
return shape_type == ShapeType::SHAPE_IS_STATIC;
|
||||
}
|
||||
|
||||
bool ngraph::PartialShape::operator==(const PartialShape& partial_shape) const {
|
||||
bool PartialShape::operator==(const PartialShape& partial_shape) const {
|
||||
if (rank() != partial_shape.rank()) {
|
||||
return false;
|
||||
}
|
||||
@@ -67,15 +67,15 @@ bool ngraph::PartialShape::operator==(const PartialShape& partial_shape) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ngraph::PartialShape::operator!=(const PartialShape& partial_shape) const {
|
||||
bool PartialShape::operator!=(const PartialShape& partial_shape) const {
|
||||
return !(*this == partial_shape);
|
||||
}
|
||||
|
||||
Shape ngraph::PartialShape::get_max_shape() const {
|
||||
ngraph::Shape PartialShape::get_max_shape() const {
|
||||
if (rank().is_dynamic()) {
|
||||
return Shape();
|
||||
return ngraph::Shape();
|
||||
} else {
|
||||
Shape shape;
|
||||
ngraph::Shape shape;
|
||||
for (auto dimension : m_dimensions) {
|
||||
shape.push_back(dimension.get_interval().get_max_val());
|
||||
}
|
||||
@@ -83,11 +83,11 @@ Shape ngraph::PartialShape::get_max_shape() const {
|
||||
}
|
||||
}
|
||||
|
||||
Shape ngraph::PartialShape::get_min_shape() const {
|
||||
ngraph::Shape PartialShape::get_min_shape() const {
|
||||
if (rank().is_dynamic()) {
|
||||
return Shape();
|
||||
return ngraph::Shape();
|
||||
} else {
|
||||
Shape shape;
|
||||
ngraph::Shape shape;
|
||||
for (auto dimension : m_dimensions) {
|
||||
shape.push_back(dimension.get_interval().get_min_val());
|
||||
}
|
||||
@@ -95,9 +95,9 @@ Shape ngraph::PartialShape::get_min_shape() const {
|
||||
}
|
||||
}
|
||||
|
||||
Shape ngraph::PartialShape::get_shape() const {
|
||||
ngraph::Shape PartialShape::get_shape() const {
|
||||
NGRAPH_CHECK(rank().is_static(), "get_shape() must be called on a static shape");
|
||||
Shape shape;
|
||||
ngraph::Shape shape;
|
||||
for (auto dimension : m_dimensions) {
|
||||
auto min_val = dimension.get_interval().get_min_val();
|
||||
auto max_val = dimension.get_interval().get_max_val();
|
||||
@@ -234,7 +234,7 @@ bool PartialShape::merge_rank(Rank r) {
|
||||
}
|
||||
}
|
||||
|
||||
Shape PartialShape::to_shape() const {
|
||||
ngraph::Shape PartialShape::to_shape() const {
|
||||
if (is_dynamic()) {
|
||||
throw std::invalid_argument("to_shape was called on a dynamic shape.");
|
||||
}
|
||||
@@ -269,11 +269,11 @@ bool PartialShape::merge_into(PartialShape& dst, const PartialShape& src) {
|
||||
|
||||
bool PartialShape::broadcast_merge_into(PartialShape& dst,
|
||||
const PartialShape& src,
|
||||
const op::AutoBroadcastSpec& autob) {
|
||||
const ngraph::op::AutoBroadcastSpec& autob) {
|
||||
switch (autob.m_type) {
|
||||
case op::AutoBroadcastType::NONE:
|
||||
case ngraph::op::AutoBroadcastType::NONE:
|
||||
return true;
|
||||
case op::AutoBroadcastType::NUMPY: {
|
||||
case ngraph::op::AutoBroadcastType::NUMPY: {
|
||||
if (dst.rank().is_dynamic() || src.rank().is_dynamic()) {
|
||||
dst = PartialShape::dynamic();
|
||||
return true;
|
||||
@@ -293,7 +293,7 @@ bool PartialShape::broadcast_merge_into(PartialShape& dst,
|
||||
return success;
|
||||
}
|
||||
}
|
||||
case op::AutoBroadcastType::PDPD: {
|
||||
case ngraph::op::AutoBroadcastType::PDPD: {
|
||||
if (dst.rank().is_dynamic() || src.rank().is_dynamic()) {
|
||||
return true;
|
||||
} else {
|
||||
@@ -357,7 +357,7 @@ Dimension& PartialShape::operator[](size_t i) {
|
||||
return m_dimensions[i];
|
||||
}
|
||||
|
||||
const std::vector<int64_t>& ngraph::AttributeAdapter<ngraph::PartialShape>::get() {
|
||||
const std::vector<int64_t>& ov::AttributeAdapter<PartialShape>::get() {
|
||||
if (!m_buffer_valid) {
|
||||
m_buffer.clear();
|
||||
if (m_ref.rank().is_dynamic()) {
|
||||
@@ -373,7 +373,7 @@ const std::vector<int64_t>& ngraph::AttributeAdapter<ngraph::PartialShape>::get(
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
void ngraph::AttributeAdapter<ngraph::PartialShape>::set(const std::vector<int64_t>& value) {
|
||||
void ov::AttributeAdapter<PartialShape>::set(const std::vector<int64_t>& value) {
|
||||
m_ref = PartialShape();
|
||||
if (value.size() == 1 && value[0] == -2) {
|
||||
m_ref = PartialShape::dynamic();
|
||||
@@ -387,4 +387,4 @@ void ngraph::AttributeAdapter<ngraph::PartialShape>::set(const std::vector<int64
|
||||
m_buffer_valid = false;
|
||||
}
|
||||
|
||||
NGRAPH_API constexpr DiscreteTypeInfo AttributeAdapter<PartialShape>::type_info;
|
||||
NGRAPH_API constexpr DiscreteTypeInfo ov::AttributeAdapter<PartialShape>::type_info;
|
||||
|
||||
@@ -56,9 +56,9 @@ runtime::AlignedBuffer& runtime::AlignedBuffer::operator=(AlignedBuffer&& other)
|
||||
return *this;
|
||||
}
|
||||
|
||||
namespace ngraph {
|
||||
namespace ov {
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<shared_ptr<runtime::AlignedBuffer>>::type_info;
|
||||
|
||||
AttributeAdapter<shared_ptr<runtime::AlignedBuffer>>::AttributeAdapter(shared_ptr<runtime::AlignedBuffer>& value)
|
||||
: DirectValueAccessor<shared_ptr<runtime::AlignedBuffer>>(value) {}
|
||||
} // namespace ngraph
|
||||
} // namespace ov
|
||||
|
||||
@@ -38,4 +38,4 @@ ngraph::Shape& ngraph::Shape::operator=(Shape&& v) noexcept {
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<Shape>::type_info;
|
||||
constexpr DiscreteTypeInfo ov::AttributeAdapter<Shape>::type_info;
|
||||
|
||||
@@ -36,4 +36,4 @@ ngraph::Strides& ngraph::Strides::operator=(Strides&& v) noexcept {
|
||||
return *this;
|
||||
}
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<Strides>::type_info;
|
||||
constexpr DiscreteTypeInfo ov::AttributeAdapter<Strides>::type_info;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include "ngraph/type/element_type.hpp"
|
||||
#include "openvino/core/type/element_type.hpp"
|
||||
|
||||
#include <cmath>
|
||||
#include <functional>
|
||||
@@ -147,7 +147,7 @@ Type from<bool>() {
|
||||
return Type_t::boolean;
|
||||
}
|
||||
template <>
|
||||
Type from<ngraph::float16>() {
|
||||
Type from<ov::float16>() {
|
||||
return Type_t::f16;
|
||||
}
|
||||
template <>
|
||||
@@ -191,7 +191,7 @@ Type from<uint64_t>() {
|
||||
return Type_t::u64;
|
||||
}
|
||||
template <>
|
||||
Type from<ngraph::bfloat16>() {
|
||||
Type from<ov::bfloat16>() {
|
||||
return Type_t::bf16;
|
||||
}
|
||||
} // namespace element
|
||||
@@ -276,38 +276,38 @@ size_t compiler_byte_size(ov::element::Type_t et) {
|
||||
std::to_string(static_cast<int>(et)));
|
||||
}
|
||||
|
||||
namespace ngraph {
|
||||
namespace ov {
|
||||
template <>
|
||||
NGRAPH_API EnumNames<ov::element::Type_t>& EnumNames<ov::element::Type_t>::get() {
|
||||
static auto enum_names = EnumNames<ov::element::Type_t>("ov::element::Type_t",
|
||||
{{"undefined", ov::element::Type_t::undefined},
|
||||
{"dynamic", ov::element::Type_t::dynamic},
|
||||
{"boolean", ov::element::Type_t::boolean},
|
||||
{"bf16", ov::element::Type_t::bf16},
|
||||
{"f16", ov::element::Type_t::f16},
|
||||
{"f32", ov::element::Type_t::f32},
|
||||
{"f64", ov::element::Type_t::f64},
|
||||
{"i4", ov::element::Type_t::i4},
|
||||
{"i8", ov::element::Type_t::i8},
|
||||
{"i16", ov::element::Type_t::i16},
|
||||
{"i32", ov::element::Type_t::i32},
|
||||
{"i64", ov::element::Type_t::i64},
|
||||
{"u1", ov::element::Type_t::u1},
|
||||
{"u4", ov::element::Type_t::u4},
|
||||
{"u8", ov::element::Type_t::u8},
|
||||
{"u16", ov::element::Type_t::u16},
|
||||
{"u32", ov::element::Type_t::u32},
|
||||
{"u64", ov::element::Type_t::u64}});
|
||||
NGRAPH_API EnumNames<element::Type_t>& EnumNames<element::Type_t>::get() {
|
||||
static auto enum_names = EnumNames<element::Type_t>("element::Type_t",
|
||||
{{"undefined", element::Type_t::undefined},
|
||||
{"dynamic", element::Type_t::dynamic},
|
||||
{"boolean", element::Type_t::boolean},
|
||||
{"bf16", element::Type_t::bf16},
|
||||
{"f16", element::Type_t::f16},
|
||||
{"f32", element::Type_t::f32},
|
||||
{"f64", element::Type_t::f64},
|
||||
{"i4", element::Type_t::i4},
|
||||
{"i8", element::Type_t::i8},
|
||||
{"i16", element::Type_t::i16},
|
||||
{"i32", element::Type_t::i32},
|
||||
{"i64", element::Type_t::i64},
|
||||
{"u1", element::Type_t::u1},
|
||||
{"u4", element::Type_t::u4},
|
||||
{"u8", element::Type_t::u8},
|
||||
{"u16", element::Type_t::u16},
|
||||
{"u32", element::Type_t::u32},
|
||||
{"u64", element::Type_t::u64}});
|
||||
return enum_names;
|
||||
}
|
||||
} // namespace ngraph
|
||||
|
||||
constexpr ngraph::DiscreteTypeInfo ngraph::AttributeAdapter<ov::element::Type_t>::type_info;
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<element::Type_t>::type_info;
|
||||
|
||||
const std::string& ngraph::AttributeAdapter<ov::element::Type>::get() {
|
||||
return as_string(static_cast<ov::element::Type_t>(m_ref));
|
||||
const std::string& AttributeAdapter<element::Type>::get() {
|
||||
return as_string(static_cast<element::Type_t>(m_ref));
|
||||
}
|
||||
|
||||
void ngraph::AttributeAdapter<ov::element::Type>::set(const std::string& value) {
|
||||
m_ref = as_enum<ov::element::Type_t>(value);
|
||||
void AttributeAdapter<element::Type>::set(const std::string& value) {
|
||||
m_ref = as_enum<element::Type_t>(value);
|
||||
}
|
||||
} // namespace ov
|
||||
|
||||
@@ -18,7 +18,7 @@ using ngraph::test::ValueMap;
|
||||
|
||||
enum class TuringModel { XL400, XL1200 };
|
||||
|
||||
namespace ngraph {
|
||||
namespace ov {
|
||||
template <>
|
||||
EnumNames<TuringModel>& EnumNames<TuringModel>::get() {
|
||||
static auto enum_names =
|
||||
@@ -74,7 +74,7 @@ protected:
|
||||
};
|
||||
|
||||
constexpr DiscreteTypeInfo AttributeAdapter<Position>::type_info;
|
||||
} // namespace ngraph
|
||||
} // namespace ov
|
||||
|
||||
// Given a Turing machine program and data, return scalar 1 if the program would
|
||||
// complete, 1 if it would not.
|
||||
@@ -110,7 +110,7 @@ public:
|
||||
const std::vector<int32_t>& vec_int32_t,
|
||||
const std::vector<int64_t>& vec_int64_t,
|
||||
const std::vector<size_t>& vec_size_t,
|
||||
const Position& position,
|
||||
const ov::Position& position,
|
||||
const shared_ptr<Node>& node,
|
||||
const NodeVector& node_vector,
|
||||
const ParameterVector& parameter_vector,
|
||||
@@ -240,7 +240,7 @@ public:
|
||||
const vector<size_t>& get_vec_size_t() const {
|
||||
return m_vec_size_t;
|
||||
}
|
||||
const Position& get_position() const {
|
||||
const ov::Position& get_position() const {
|
||||
return m_position;
|
||||
}
|
||||
const shared_ptr<Node>& get_node() const {
|
||||
@@ -362,7 +362,7 @@ protected:
|
||||
vector<int32_t> m_vec_int32_t;
|
||||
vector<int64_t> m_vec_int64_t;
|
||||
vector<size_t> m_vec_size_t;
|
||||
Position m_position;
|
||||
ov::Position m_position;
|
||||
shared_ptr<Node> m_node;
|
||||
NodeVector m_node_vector;
|
||||
ParameterVector m_parameter_vector;
|
||||
@@ -406,7 +406,7 @@ TEST(attributes, user_op) {
|
||||
vector<int32_t>{1, 2, 4, 8},
|
||||
vector<int64_t>{1, 2, 4, 8},
|
||||
vector<size_t>{1, 3, 8, 4, 2},
|
||||
Position{1.3f, 5.1f, 2.3f},
|
||||
ov::Position{1.3f, 5.1f, 2.3f},
|
||||
data,
|
||||
NodeVector{program, result, data},
|
||||
ParameterVector{data, data, program},
|
||||
|
||||
Reference in New Issue
Block a user