Graph comparator to ngraph util (#7729)

* Moved FrameworkNode to nGraph

* Moved graph comparator to ngraph test util

* Fixed build

* Try to fix centos

* Fix export target

* Moved engine utils to separate library

* Removed ONNX util from common library

* Fixed build

* Fixed code style
This commit is contained in:
Ilya Churaev 2021-10-01 07:24:28 +03:00 committed by GitHub
parent f675df625c
commit faeaf045a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
203 changed files with 1954 additions and 2035 deletions

View File

@ -1,99 +0,0 @@
// Copyright (C) 2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include <vector>
#include <transformations_visibility.hpp>
#include "ngraph/op/op.hpp"
#include "ngraph/strides.hpp"
#include "ngraph/partial_shape.hpp"
namespace ngraph {
namespace op {
class TRANSFORMATIONS_API FrameworkNodeAttrs {
public:
using attrs_t = std::unordered_map<std::string, std::string>;
void set_opset_name(const std::string& opset_name) { m_opset_name = opset_name; }
void set_type_name(const std::string& type_name) { m_type_name = type_name; }
const std::string& get_opset_name() const { return m_opset_name; }
const std::string& get_type_name() const { return m_type_name; }
attrs_t::iterator begin() { return m_attrs.begin(); }
attrs_t::iterator end() { return m_attrs.end(); }
attrs_t::const_iterator begin() const { return m_attrs.begin(); }
attrs_t::const_iterator end() const { return m_attrs.end(); }
std::string operator[](const std::string & key) { return m_attrs[key]; }
std::string at(const std::string & key) const { return m_attrs.at(key); }
bool operator== (const FrameworkNodeAttrs & other) const {
return m_type_name == other.m_type_name && m_opset_name == other.m_opset_name && m_attrs == m_attrs;
}
private:
std::string m_type_name;
std::string m_opset_name;
std::unordered_map<std::string, std::string> m_attrs;
};
class TRANSFORMATIONS_API FrameworkNode : public Op {
public:
OPENVINO_OP("FrameworkNode", "util");
BWDCMP_RTTI_DECLARATION;
FrameworkNode() = default;
explicit FrameworkNode(const OutputVector& inputs, size_t output_size = 1);
void validate_and_infer_types() override;
bool visit_attributes(AttributeVisitor& visitor) override {
visitor.on_attribute("framework_node_attrs", m_attrs);
return true;
}
const FrameworkNodeAttrs & get_attrs() const { return m_attrs; }
void set_attrs(const FrameworkNodeAttrs & attrs) { m_attrs = attrs; }
std::shared_ptr<Node>
clone_with_new_inputs(const OutputVector& new_args) const override;
void cache_output_descriptor();
private:
std::vector<std::tuple<ngraph::PartialShape, ngraph::element::Type>> m_inputs_desc;
std::vector<std::tuple<ngraph::PartialShape, ngraph::element::Type>> m_output_desc;
FrameworkNodeAttrs m_attrs;
};
} // namespace op
} // namespace ngraph
namespace ov {
template <>
class TRANSFORMATIONS_API AttributeAdapter<ngraph::op::FrameworkNodeAttrs>
: public DirectValueAccessor<ngraph::op::FrameworkNodeAttrs> {
public:
AttributeAdapter(ngraph::op::FrameworkNodeAttrs& value);
OPENVINO_RTTI("AttributeAdapter<FrameworkNodeAttr>");
};
} // namespace ov

View File

@ -15,7 +15,7 @@
#include "ngraph/ops.hpp" #include "ngraph/ops.hpp"
#include "ngraph/opsets/opset.hpp" #include "ngraph/opsets/opset.hpp"
#include "ngraph/opsets/opset1.hpp" #include "ngraph/opsets/opset1.hpp"
#include "ngraph_ops/framework_node.hpp" #include "openvino/op/util/framework_node.hpp"
#include "ngraph_ops/type_relaxed.hpp" #include "ngraph_ops/type_relaxed.hpp"
#include "pugixml.hpp" #include "pugixml.hpp"
#include "transformations/serialize.hpp" #include "transformations/serialize.hpp"
@ -65,7 +65,7 @@ std::string translate_type_name(const std::string& name) {
size_t hash_combine(const void* v, int64_t size) { size_t hash_combine(const void* v, int64_t size) {
constexpr auto cel_size = sizeof(size_t); constexpr auto cel_size = sizeof(size_t);
size_t seed = static_cast<size_t>(size); auto seed = static_cast<size_t>(size);
const auto data = static_cast<const size_t*>(v); const auto data = static_cast<const size_t*>(v);
const auto d_end = std::next(data, size / cel_size); const auto d_end = std::next(data, size / cel_size);
// The constant value used as a magic number has been // The constant value used as a magic number has been
@ -272,7 +272,7 @@ class XmlSerializer : public ngraph::AttributeVisitor {
std::vector<std::string> output; std::vector<std::string> output;
for (pugi::xml_node node : xml_node.child("body").child("layers")) { for (pugi::xml_node node : xml_node.child("body").child("layers")) {
if (!map_type.compare(node.attribute("type").value())) { if (!map_type.compare(node.attribute("type").value())) {
output.push_back(node.attribute("id").value()); output.emplace_back(node.attribute("id").value());
} }
} }
@ -408,7 +408,7 @@ public:
m_xml_node.append_attribute("offset").set_value(offset); m_xml_node.append_attribute("offset").set_value(offset);
m_xml_node.append_attribute("size").set_value(size); m_xml_node.append_attribute("size").set_value(size);
} }
} else if (const auto& a = ngraph::as_type<ngraph::AttributeAdapter<ngraph::op::FrameworkNodeAttrs>>(&adapter)) { } else if (const auto& a = ngraph::as_type<ngraph::AttributeAdapter<ov::op::util::FrameworkNodeAttrs>>(&adapter)) {
const auto & attrs = a->get(); const auto & attrs = a->get();
// Update type and version attributes // Update type and version attributes

View File

@ -1,59 +0,0 @@
// Copyright (C) 2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <gtest/gtest.h>
#include <string>
#include <memory>
#include <queue>
#include <ngraph/opsets/opset8.hpp>
#include <ngraph_ops/framework_node.hpp>
#include "common_test_utils/ngraph_test_utils.hpp"
using namespace testing;
using namespace ngraph;
TEST(TransformationTests, FrameworkNode) {
auto param = std::make_shared<ngraph::opset8::Parameter>(element::i64, Shape{1, 64});
auto f_node = std::make_shared<ngraph::op::FrameworkNode>(OutputVector{param});
f_node->set_output_type(0, element::i64, Shape{1, 64});
// Set partially dynamic shape
param->set_partial_shape(PartialShape{Dimension::dynamic(), 64});
param->validate_and_infer_types();
ASSERT_NO_THROW(f_node->validate_and_infer_types());
ASSERT_EQ(f_node->get_output_partial_shape(0), PartialShape::dynamic());
// Set dynamic shape
param->set_partial_shape(PartialShape::dynamic(2));
param->validate_and_infer_types();
ASSERT_NO_THROW(f_node->validate_and_infer_types());
ASSERT_EQ(f_node->get_output_partial_shape(0), PartialShape::dynamic());
// Set fully dynamic shape
param->set_partial_shape(PartialShape::dynamic());
param->validate_and_infer_types();
ASSERT_NO_THROW(f_node->validate_and_infer_types());
ASSERT_EQ(f_node->get_output_partial_shape(0), PartialShape::dynamic());
// Set original static shape
param->set_partial_shape(Shape{1, 64});
param->validate_and_infer_types();
ASSERT_NO_THROW(f_node->validate_and_infer_types());
ASSERT_EQ(f_node->get_output_partial_shape(0), PartialShape({1, 64}));
// Set different static shape
param->set_partial_shape(Shape{2, 64});
param->validate_and_infer_types();
ASSERT_THROW(f_node->validate_and_infer_types(), ngraph_error::exception);
}

View File

@ -4,7 +4,6 @@
#include "behavior/caching/caching_tests.hpp" #include "behavior/caching/caching_tests.hpp"
#include <ngraph_ops/nms_ie_internal.hpp> #include <ngraph_ops/nms_ie_internal.hpp>
#include <ngraph_ops/framework_node.hpp>
#include <ngraph_ops/nms_static_shape_ie.hpp> #include <ngraph_ops/nms_static_shape_ie.hpp>
using namespace LayerTestsDefinitions; using namespace LayerTestsDefinitions;

View File

@ -19,6 +19,7 @@ function(add_common_utils ADD_TARGET_NAME)
gtest gtest
gtest_main gtest_main
inference_engine_transformations inference_engine_transformations
ngraph_test_util
PRIVATE PRIVATE
openvino::util openvino::util
) )

View File

@ -13,850 +13,15 @@
#include <ngraph/opsets/opset1.hpp> #include <ngraph/opsets/opset1.hpp>
#include <ngraph/pass/pass.hpp> #include <ngraph/pass/pass.hpp>
#include <ngraph/opsets/opset6.hpp> #include <ngraph/opsets/opset6.hpp>
#include <ngraph/op/util/framework_node.hpp>
#include "ie_common.h" #include "ie_common.h"
#include <ngraph_ops/framework_node.hpp>
#include "test_common.hpp" #include "test_common.hpp"
#include "graph_comparator.hpp"
#include "test_tools.hpp"
#define DYN ngraph::Dimension::dynamic() #define DYN ngraph::Dimension::dynamic()
using TransformationTests = CommonTestUtils::TestsCommon; using TransformationTests = CommonTestUtils::TestsCommon;
class FunctionsComparator {
public:
enum CmpValues {
NONE = 0,
CONST_VALUES = 1 << 0,
NAMES = 1 << 1,
RUNTIME_KEYS = 1 << 2,
PRECISIONS = 1 << 3,
ATTRIBUTES = 1 << 4,
};
struct Result {
bool valid;
std::string message;
static Result ok(std::string msg = {}) {
return {true, std::move(msg)};
}
static Result error(std::string msg) {
return {false, std::move(msg)};
}
};
static constexpr FunctionsComparator no_default() noexcept {
return FunctionsComparator{NONE};
}
static constexpr FunctionsComparator with_default() noexcept {
return FunctionsComparator{PRECISIONS};
}
FunctionsComparator& enable(CmpValues f) noexcept {
m_comparition_flags = static_cast<CmpValues>(m_comparition_flags | f);
return *this;
}
constexpr bool should_compare(CmpValues f) const noexcept {
return m_comparition_flags & f;
}
Result compare(
const std::shared_ptr<ngraph::Function>& f1,
const std::shared_ptr<ngraph::Function>& f2) const;
Result operator()(
const std::shared_ptr<ngraph::Function>& f1,
const std::shared_ptr<ngraph::Function>& f2) const {
return compare(f1, f2);
}
private:
constexpr explicit FunctionsComparator(CmpValues f) noexcept : m_comparition_flags(f) {}
CmpValues m_comparition_flags;
};
///
/// \deprecated
/// \brief compare_functions is obsolete function use FunctionsComparator instead.
///
inline std::pair<bool, std::string> compare_functions(
const std::shared_ptr<ngraph::Function>& f1,
const std::shared_ptr<ngraph::Function>& f2,
const bool compareConstValues = false,
const bool compareNames = false,
const bool compareRuntimeKeys = false,
const bool comparePrecisions = true,
const bool compareAttributes = false) {
auto fc = FunctionsComparator::no_default();
using Cmp = FunctionsComparator::CmpValues;
if (compareConstValues) fc.enable(Cmp::CONST_VALUES);
if (compareNames) fc.enable(Cmp::NAMES);
if (compareRuntimeKeys) fc.enable(Cmp::RUNTIME_KEYS);
if (comparePrecisions) fc.enable(Cmp::PRECISIONS);
if (compareAttributes) fc.enable(Cmp::ATTRIBUTES);
const auto r = fc(f1, f2);
return {r.valid, r.message};
}
void check_rt_info(const std::shared_ptr<ngraph::Function>& f);
void set_tensor_name(ngraph::Output<ngraph::Node> output, const std::string & name);
void set_tensor_names(ngraph::Output<ngraph::Node> output, const std::unordered_set<std::string> & names);
namespace ngraph {
namespace pass {
class InjectionPass;
} // namespace pass
} // namespace ngraph
class ngraph::pass::InjectionPass : public ngraph::pass::FunctionPass {
public:
using injection_callback = std::function<void(std::shared_ptr<ngraph::Function>)>;
explicit InjectionPass(injection_callback callback)
: FunctionPass(), m_callback(std::move(callback)) {}
bool run_on_function(std::shared_ptr<ngraph::Function> f) override {
m_callback(f);
return false;
}
private:
injection_callback m_callback;
};
template <typename T>
size_t count_ops_of_type(std::shared_ptr<ngraph::Function> f) {
size_t count = 0;
for (auto op : f->get_ops()) {
if (ngraph::is_type<T>(op)) {
count++;
}
}
return count;
}
class TestOpMultiOut : public ngraph::op::Op {
public:
NGRAPH_RTTI_DECLARATION;
TestOpMultiOut() = default;
TestOpMultiOut(const ngraph::Output<Node>& output_1, const ngraph::Output<Node>& output_2)
: Op({output_1, output_2}) {
validate_and_infer_types();
}
void validate_and_infer_types() override {
set_output_size(2);
set_output_type(0, get_input_element_type(0), get_input_partial_shape(0));
set_output_type(1, get_input_element_type(1), get_input_partial_shape(1));
}
std::shared_ptr<Node> clone_with_new_inputs(
const ngraph::OutputVector& new_args) const override {
return std::make_shared<TestOpMultiOut>(new_args.at(0), new_args.at(1));
}
};
class Comparator {
public:
using CmpValues = FunctionsComparator::CmpValues;
using Result = FunctionsComparator::Result;
using ComparedNodes = std::pair<ngraph::Node*, ngraph::Node*>;
explicit Comparator(CmpValues f) : m_comparition_flags(f) {}
Result compare(
const std::shared_ptr<ngraph::Function>& f1, const std::shared_ptr<ngraph::Function>& f2);
Result compare(ngraph::Node* node1, ngraph::Node* node2) {
std::stringstream errors;
const auto result = compare(node1, node2, errors);
if (!result.valid) {
return result;
}
const auto msg = errors.str();
return msg.empty() ? Result::ok() : Result::error(msg);
}
Comparator recreate() const {
return Comparator(m_comparition_flags);
}
void compare_inputs(ngraph::Node* node1, ngraph::Node* node2, std::ostream& err_log);
void compare_outputs(ngraph::Node* node1, ngraph::Node* node2, std::ostream& err_log);
private:
bool should_compare(CmpValues f) const noexcept {
return m_comparition_flags & f;
}
///
/// \param err_log - will be fill by minor errors if happen
/// \return only fatality error if some minor one appears it will be add to err_log
///
Result compare(ngraph::Node* node1, ngraph::Node* node2, std::ostream& err_log);
void add_nodes_inputs_to_queue(ngraph::Node* node1, ngraph::Node* node2);
//-- DATA --
CmpValues m_comparition_flags;
std::queue<ComparedNodes> q;
std::unordered_set<ngraph::Node*> used;
};
inline namespace tools {
template<typename T>
std::string to_str(const T &v) {
using std::to_string;
return to_string(v);
}
template<typename Node>
std::string name(const Node &n) {
return n->get_friendly_name();
}
}
namespace attributes {
namespace detail {
using AttrName = std::string;
class Result {
public:
explicit Result(std::string m = {}) : m_message(std::move(m)) {}
const std::string& message() const {
return m_message;
}
bool has_error() const {
return !m_message.empty();
}
Result& operator+=(const std::string& msg) {
m_message.append(m_break_line_no, '\n').append(msg);
m_break_line_no = 1;
return *this;
}
private:
std::string m_message;
int m_break_line_no{0};
};
using SubGraphOpInputDescription =
std::vector<std::shared_ptr<ngraph::op::util::SubGraphOp::InputDescription>>;
using SubGraphOpOutputDescription =
std::vector<std::shared_ptr<ngraph::op::util::SubGraphOp::OutputDescription>>;
using SpecialBodyPorts = ngraph::opset6::Loop::SpecialBodyPorts;
namespace storage {
class MemoryChunk {
public:
using Data = std::vector<unsigned char>;
MemoryChunk(Data data) : m_data{std::move(data)} {}
Data::const_pointer data() const {
return m_data.data();
}
size_t size() const {
return m_data.size();
}
private:
Data m_data;
};
template <typename AttrValue>
class AttributeStorage {
public:
bool insert_value(AttrName name, AttrValue value) {
return m_attributes.insert({std::move(name), std::move(value)}).second;
}
const AttrValue* get_value(const AttrName& name) const {
const auto found = m_attributes.find(name);
if (found != end(m_attributes)) {
return std::addressof(found->second);
}
return {};
}
std::size_t get_attributes_number() const {
return m_attributes.size();
}
private:
std::map<AttrName, AttrValue> m_attributes;
};
class Storage : private AttributeStorage<MemoryChunk>,
private AttributeStorage<bool>,
private AttributeStorage<std::string>,
private AttributeStorage<int8_t>,
private AttributeStorage<int16_t>,
private AttributeStorage<int32_t>,
private AttributeStorage<int64_t>,
private AttributeStorage<uint8_t>,
private AttributeStorage<uint16_t>,
private AttributeStorage<uint32_t>,
private AttributeStorage<uint64_t>,
private AttributeStorage<float>,
private AttributeStorage<double>,
private AttributeStorage<std::vector<int8_t>>,
private AttributeStorage<std::vector<int16_t>>,
private AttributeStorage<std::vector<int32_t>>,
private AttributeStorage<std::vector<int64_t>>,
private AttributeStorage<std::vector<uint8_t>>,
private AttributeStorage<std::vector<uint16_t>>,
private AttributeStorage<std::vector<uint32_t>>,
private AttributeStorage<std::vector<uint64_t>>,
private AttributeStorage<std::vector<float>>,
private AttributeStorage<std::vector<double>>,
private AttributeStorage<std::vector<std::string>>,
private AttributeStorage<std::shared_ptr<ngraph::Function>>,
private AttributeStorage<SubGraphOpInputDescription>,
private AttributeStorage<SubGraphOpOutputDescription>,
private AttributeStorage<ngraph::op::FrameworkNodeAttrs>,
private AttributeStorage<std::shared_ptr<ngraph::Variable>> {
public:
template <typename AttrValue>
const AttributeStorage<AttrValue>& storage() const {
return *static_cast<const AttributeStorage<AttrValue>*>(this);
}
template <typename AttrValue>
AttributeStorage<AttrValue>& storage() {
return *static_cast<AttributeStorage<AttrValue>*>(this);
}
size_t stored_attributes_number() const {
return storage<MemoryChunk>().get_attributes_number() +
storage<bool>().get_attributes_number() +
storage<std::string>().get_attributes_number() +
storage<int8_t>().get_attributes_number() +
storage<int16_t>().get_attributes_number() +
storage<int32_t>().get_attributes_number() +
storage<int64_t>().get_attributes_number() +
storage<uint8_t>().get_attributes_number() +
storage<uint16_t>().get_attributes_number() +
storage<uint32_t>().get_attributes_number() +
storage<uint64_t>().get_attributes_number() +
storage<float>().get_attributes_number() +
storage<double>().get_attributes_number() +
storage<std::vector<int8_t>>().get_attributes_number() +
storage<std::vector<int16_t>>().get_attributes_number() +
storage<std::vector<int32_t>>().get_attributes_number() +
storage<std::vector<int64_t>>().get_attributes_number() +
storage<std::vector<uint8_t>>().get_attributes_number() +
storage<std::vector<uint16_t>>().get_attributes_number() +
storage<std::vector<uint32_t>>().get_attributes_number() +
storage<std::vector<uint64_t>>().get_attributes_number() +
storage<std::vector<float>>().get_attributes_number() +
storage<std::vector<double>>().get_attributes_number() +
storage<std::vector<std::string>>().get_attributes_number() +
storage<std::shared_ptr<ngraph::Function>>().get_attributes_number() +
storage<SubGraphOpInputDescription>().get_attributes_number() +
storage<SubGraphOpOutputDescription>().get_attributes_number() +
storage<ngraph::op::FrameworkNodeAttrs>().get_attributes_number() +
storage<std::shared_ptr<ngraph::Variable>>().get_attributes_number();
}
};
} // namespace storage
class ReadAndStoreAttributes : public ngraph::AttributeVisitor, protected storage::Storage {
public:
void on_adapter(const std::string& name, ngraph::ValueAccessor<void>& adapter) override;
#define ON_ADAPTER(TYPE) \
void on_adapter(const std::string& name, ngraph::ValueAccessor<TYPE>& adapter) override { \
insert(name, adapter.get()); \
}
ON_ADAPTER(bool)
ON_ADAPTER(std::string)
ON_ADAPTER(int8_t)
ON_ADAPTER(int16_t)
ON_ADAPTER(int32_t)
ON_ADAPTER(int64_t)
ON_ADAPTER(uint8_t)
ON_ADAPTER(uint16_t)
ON_ADAPTER(uint32_t)
ON_ADAPTER(uint64_t)
ON_ADAPTER(float)
ON_ADAPTER(double)
ON_ADAPTER(std::vector<int8_t>)
ON_ADAPTER(std::vector<int16_t>)
ON_ADAPTER(std::vector<int32_t>)
ON_ADAPTER(std::vector<int64_t>)
ON_ADAPTER(std::vector<uint8_t>)
ON_ADAPTER(std::vector<uint16_t>)
ON_ADAPTER(std::vector<uint32_t>)
ON_ADAPTER(std::vector<uint64_t>)
ON_ADAPTER(std::vector<float>)
ON_ADAPTER(std::vector<double>)
ON_ADAPTER(std::vector<std::string>)
ON_ADAPTER(std::shared_ptr<ngraph::Function>)
#undef ON_ADAPTER
template <typename AttrValue>
const AttrValue* get(const AttrName& name) const {
return storage<AttrValue>().get_value(name);
}
template <typename AttrValue>
bool insert(AttrName name, AttrValue value) {
return storage<AttrValue>().insert_value(std::move(name), std::move(value));
}
size_t attributes_number() const {
return stored_attributes_number();
}
const Result read_result() const {
return m_read_result;
}
private:
Result m_read_result;
};
namespace equal {
template <typename Value>
struct Equal {
static bool equal_value(const Value& lhs, const Value& rhs) {
return lhs == rhs;
}
};
template <>
struct Equal<ngraph::bfloat16> {
static bool equal_value(ngraph::bfloat16 lhs, ngraph::bfloat16 rhs) {
if (lhs.to_bits() == rhs.to_bits()) {
return true;
}
return std::abs(lhs - rhs) < 1e-3;
}
};
template <>
struct Equal<ngraph::float16> {
static bool equal_value(ngraph::float16 lhs, ngraph::float16 rhs) {
if (lhs.to_bits() == rhs.to_bits()) {
return true;
}
return std::abs(lhs - rhs) < 1e-3;
}
};
template <>
struct Equal<float> {
static bool equal_value(float lhs, float rhs) {
if (std::isfinite(lhs) && std::isfinite(rhs)) {
return std::abs(lhs - rhs) < 1e-4;
}
return (std::isinf(lhs) && std::isinf(rhs)) ||
(std::isnan(lhs) && std::isnan(rhs));
}
};
template <>
struct Equal<double> {
static bool equal_value(double lhs, double rhs) {
if (std::isfinite(lhs) && std::isfinite(rhs)) {
return std::abs(lhs - rhs) < 1e-5;
}
return (std::isinf(lhs) && std::isinf(rhs)) ||
(std::isnan(lhs) && std::isnan(rhs));
}
};
template <typename T>
struct Equal<std::vector<T>> {
static bool equal_value(const std::vector<T>& lhs, const std::vector<T>& rhs) {
return lhs.size() == rhs.size() &&
std::equal(begin(lhs), end(lhs), begin(rhs), Equal<T>::equal_value);
}
};
template <>
struct Equal<SubGraphOpInputDescription::value_type> {
static bool equal_value(
SubGraphOpInputDescription::const_reference lhs,
SubGraphOpInputDescription::const_reference rhs) {
const auto& lhs_type_info = lhs->get_type_info();
const auto& rhs_type_info = rhs->get_type_info();
if (lhs_type_info != rhs_type_info) {
return false;
}
using SubGraphOp = ngraph::op::util::SubGraphOp;
if (lhs_type_info == SubGraphOp::SliceInputDescription::get_type_info_static()) {
const auto& l_input = static_cast<const SubGraphOp::SliceInputDescription&>(*lhs);
const auto& r_input = static_cast<const SubGraphOp::SliceInputDescription&>(*rhs);
return l_input.m_start == r_input.m_start && l_input.m_stride == r_input.m_stride &&
l_input.m_part_size == r_input.m_part_size && l_input.m_end == r_input.m_end &&
l_input.m_axis == r_input.m_axis;
} else if (lhs_type_info == SubGraphOp::MergedInputDescription::get_type_info_static()) {
return true;
} else if (lhs_type_info == SubGraphOp::InvariantInputDescription::get_type_info_static()) {
return true;
}
return false;
}
};
template <>
struct Equal<SubGraphOpInputDescription> {
static bool equal_value(
const SubGraphOpInputDescription& lhs, const SubGraphOpInputDescription& rhs) {
if (lhs.size() != rhs.size()) {
return false;
}
return std::is_permutation(
begin(lhs), end(lhs), begin(rhs),
Equal<SubGraphOpInputDescription::value_type>::equal_value);
}
};
template <>
struct Equal<SubGraphOpOutputDescription::value_type> {
static bool equal_value(
SubGraphOpOutputDescription::const_reference lhs,
SubGraphOpOutputDescription::const_reference rhs) {
const auto& lhs_type_info = lhs->get_type_info();
const auto& rhs_type_info = rhs->get_type_info();
if (lhs_type_info != rhs_type_info) {
return false;
}
using SubGraphOp = ngraph::op::util::SubGraphOp;
if (lhs_type_info == SubGraphOp::ConcatOutputDescription::get_type_info_static()) {
const auto& l_output = static_cast<const SubGraphOp::ConcatOutputDescription&>(*lhs);
const auto& r_output = static_cast<const SubGraphOp::ConcatOutputDescription&>(*rhs);
return l_output.m_start == r_output.m_start && l_output.m_stride == r_output.m_stride &&
l_output.m_part_size == r_output.m_part_size &&
l_output.m_end == r_output.m_end && l_output.m_axis == r_output.m_axis;
} else if (lhs_type_info == SubGraphOp::BodyOutputDescription::get_type_info_static()) {
const auto& l_output = static_cast<const SubGraphOp::BodyOutputDescription&>(*lhs);
const auto& r_output = static_cast<const SubGraphOp::BodyOutputDescription&>(*rhs);
return l_output.m_iteration == r_output.m_iteration;
}
return false;
}
};
template <>
struct Equal<SubGraphOpOutputDescription> {
static bool equal_value(
const SubGraphOpOutputDescription& lhs, const SubGraphOpOutputDescription& rhs) {
if (lhs.size() != rhs.size()) {
return false;
}
return std::is_permutation(
begin(lhs), end(lhs), begin(rhs),
Equal<SubGraphOpOutputDescription::value_type>::equal_value);
}
};
template <>
struct Equal<std::shared_ptr<ngraph::Variable>> {
static bool equal_value(
const std::shared_ptr<ngraph::Variable>& lhs, const std::shared_ptr<ngraph::Variable>& rhs) {
return lhs->get_info() == rhs->get_info();
}
};
template <>
struct Equal<uint8_t*> {
static constexpr uint8_t BITS_IN_BYTE_COUNT = 8;
static inline uint8_t extract_bit(uint8_t val, uint8_t bit) {
return (val >> bit) & 0x01;
}
static bool equal_value(const uint8_t* lhs, const uint8_t* rhs,
size_t lhs_bit_size, size_t rhs_bit_size) {
if (lhs_bit_size != rhs_bit_size) return false;
for (size_t bit_idx = 0; bit_idx < lhs_bit_size; bit_idx++) {
const auto byte_idx_result(bit_idx / BITS_IN_BYTE_COUNT);
if (byte_idx_result > std::numeric_limits<uint8_t>::max())
IE_THROW() << "(bit_idx / BITS_IN_BYTE_COUNT) bigger than uint8_t::max_value";
const uint8_t byte_idx(static_cast<uint8_t>(byte_idx_result));
const uint8_t bit_in_byte_idx = 7 - (bit_idx % BITS_IN_BYTE_COUNT);
if (extract_bit(lhs[byte_idx], bit_in_byte_idx) !=
extract_bit(rhs[byte_idx], bit_in_byte_idx)) {
return false;
}
}
return true;
}
};
using Constant = ngraph::opset1::Constant;
template <>
struct Equal<std::shared_ptr<Constant>> {
static bool equal_value(
const std::shared_ptr<Constant>& lhs, const std::shared_ptr<Constant>& rhs) {
const auto lhs_t = lhs->get_element_type();
const auto rhs_t = rhs->get_element_type();
if (lhs_t != rhs_t) {
return false;
}
switch (lhs_t) {
case ngraph::element::Type_t::u1: {
const auto lhs_v = static_cast<const uint8_t*>(lhs->get_data_ptr());
const auto rhs_v = static_cast<const uint8_t*>(rhs->get_data_ptr());
const auto lhs_bit_size = shape_size(lhs->get_shape());
const auto rhs_bit_size = shape_size(rhs->get_shape());
return Equal<uint8_t*>::equal_value(lhs_v, rhs_v, lhs_bit_size,
rhs_bit_size);
}
case ngraph::element::Type_t::bf16: {
auto lhs_v = lhs->cast_vector<ngraph::bfloat16>();
auto rhs_v = rhs->cast_vector<ngraph::bfloat16>();
return Equal<std::vector<ngraph::bfloat16>>::equal_value(lhs_v, rhs_v);
break;
}
case ngraph::element::Type_t::f16: {
const auto& lhs_v = lhs->cast_vector<ngraph::float16>();
const auto& rhs_v = rhs->cast_vector<ngraph::float16>();
return Equal<std::vector<ngraph::float16>>::equal_value(lhs_v, rhs_v);
break;
}
case ngraph::element::Type_t::f32: {
const auto& lhs_v = lhs->cast_vector<float>();
const auto& rhs_v = rhs->cast_vector<float>();
return Equal<std::vector<float>>::equal_value(lhs_v, rhs_v);
break;
}
default: {
const auto& lhs_v = lhs->cast_vector<double>();
const auto& rhs_v = rhs->cast_vector<double>();
return Equal<std::vector<double>>::equal_value(lhs_v, rhs_v);
break;
}
}
return false;
}
};
} // namespace equal
namespace str {
template <typename...>
struct Void_t {
using type = void;
};
template <typename T, typename = void>
struct Get {
static std::string value(const T&) {
return std::string("[Ups can't convert this to value: ") + typeid(T).name() + "]";
}
};
template <typename T>
struct Get<T, typename Void_t<decltype(std::to_string(std::declval<T>()))>::type> {
static std::string value(const T& v) {
return "[" + std::to_string(v) + "]";
}
};
template <>
struct Get<std::string, void> {
static std::string value(const std::string& v) {
return "[" + v + "]";
}
};
template <typename T>
struct Get<
T,
typename Void_t<decltype(begin(std::declval<T>())), decltype(end(std::declval<T>()))>::type> {
template <typename Container>
static std::string join(const Container& c, const char* glue = ", ") {
std::stringstream oss;
const char* s = "";
for (const auto& v : c) {
oss << s << v;
s = glue;
}
return oss.str();
}
static std::string value(const T& v) {
return "[" + join(v) + "]";
}
};
template <>
struct Get<ngraph::op::FrameworkNodeAttrs, void> {
static std::string value(const ngraph::op::FrameworkNodeAttrs& attrs) {
std::stringstream oss;
const auto & a = attrs;
oss << "version=" << attrs.get_opset_name() << ", ";
oss << "type=" << attrs.get_type_name() << ", ";
oss << "attrs[";
for (const auto & item : a) {
oss << item.first << "=" << item.second << " ";
}
oss << "]";
return "[" + oss.str() + "]";
}
};
template <>
struct Get<std::shared_ptr<ngraph::Variable>, void> {
static std::string value(const std::shared_ptr<ngraph::Variable>& variable) {
std::stringstream oss;
const auto variable_info = variable->get_info();
oss << "[";
oss << "data_shape=" << variable_info.data_shape << ", ";
oss << "data_type=" << variable_info.data_type << ", ";
oss << "variable_id=" << variable_info.variable_id;
oss << "]";
return oss.str();
}
};
} // namespace str
class ReadAndCompareAttributes : public ngraph::AttributeVisitor {
public:
ReadAndCompareAttributes(const ReadAndStoreAttributes& ref, Comparator::CmpValues check_flags)
: m_attr_ref(ref), m_cmp_result{ref.read_result()}, m_check_flags(check_flags) {}
void on_adapter(const std::string& name, ngraph::ValueAccessor<void>& adapter) override {
verify_others(name, adapter);
}
#define ON_ADAPTER(TYPE) \
void on_adapter(const std::string& name, ngraph::ValueAccessor<TYPE>& adapter) override { \
verify(name, adapter.get()); \
}
ON_ADAPTER(bool)
ON_ADAPTER(std::string)
ON_ADAPTER(int8_t)
ON_ADAPTER(int16_t)
ON_ADAPTER(int32_t)
ON_ADAPTER(int64_t)
ON_ADAPTER(uint8_t)
ON_ADAPTER(uint16_t)
ON_ADAPTER(uint32_t)
ON_ADAPTER(uint64_t)
ON_ADAPTER(float)
ON_ADAPTER(double)
ON_ADAPTER(std::vector<int8_t>)
ON_ADAPTER(std::vector<int16_t>)
ON_ADAPTER(std::vector<int32_t>)
ON_ADAPTER(std::vector<int64_t>)
ON_ADAPTER(std::vector<uint8_t>)
ON_ADAPTER(std::vector<uint16_t>)
ON_ADAPTER(std::vector<uint32_t>)
ON_ADAPTER(std::vector<uint64_t>)
ON_ADAPTER(std::vector<float>)
ON_ADAPTER(std::vector<double>)
ON_ADAPTER(std::vector<std::string>)
#undef ON_ADAPTER
void on_adapter(
const std::string& name,
ngraph::ValueAccessor<std::shared_ptr<ngraph::Function>>& adapter) override {
verify_function(name, adapter);
}
bool all_attr_was_compared() const {
return m_visited_attributes.size() == m_attr_ref.attributes_number();
}
size_t compared_attr_number() const {
return m_visited_attributes.size();
}
const Result& cmp_result() const {
return m_cmp_result;
}
private:
bool should_return() const {
return m_fast_exit && m_cmp_result.has_error();
}
template <typename AttrValue>
void verify(const std::string& name, const AttrValue& attr_value);
void verify_mem_buf(
const std::string& name, const std::shared_ptr<ngraph::runtime::AlignedBuffer>& buffer);
using FunctionAccessor = ngraph::ValueAccessor<std::shared_ptr<ngraph::Function>>;
void verify_function(const std::string& name, FunctionAccessor& adapter);
void verify_others(const std::string& name, ngraph::ValueAccessor<void>& adapter);
//-- DATA --
const ReadAndStoreAttributes& m_attr_ref;
Result m_cmp_result;
Comparator::CmpValues m_check_flags;
std::set<AttrName> m_visited_attributes;
static constexpr bool m_fast_exit{true};
};
class CompareNodesAttributes {
public:
using ReadAndStoreAttributes = detail::ReadAndStoreAttributes;
using ReadAndCompareAttributes = detail::ReadAndCompareAttributes;
CompareNodesAttributes(Comparator::CmpValues m_compare_flags)
: m_compare_attr(m_store_attr, m_compare_flags) {}
ReadAndStoreAttributes& get_ref_reader() {
return m_store_attr;
}
ReadAndCompareAttributes& get_cmp_reader() {
return m_compare_attr;
}
bool equal() const {
return m_compare_attr.all_attr_was_compared() && !m_compare_attr.cmp_result().has_error();
}
friend std::string to_string(const CompareNodesAttributes& c) {
const auto& result = c.m_compare_attr.cmp_result();
if (result.has_error()) {
return result.message();
}
if (!c.m_compare_attr.all_attr_was_compared()) {
return "not all of attr was compared: " +
to_str(c.m_compare_attr.compared_attr_number()) + " vs " +
to_str(c.m_store_attr.attributes_number());
}
return "looks good [compared " + to_str(c.m_compare_attr.compared_attr_number()) +
" attributes]";
}
private:
ReadAndStoreAttributes m_store_attr;
ReadAndCompareAttributes m_compare_attr;
};
} // namespace detail
Comparator::Result compare(ngraph::Node* node1, ngraph::Node* node2, Comparator::CmpValues comparition_flags);
} // namespace attributes

View File

@ -0,0 +1,15 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include "ngraph/op/op.hpp"
#include "openvino/op/util/framework_node.hpp"
namespace ngraph {
namespace op {
using ov::op::util::FrameworkNode;
using ov::op::util::FrameworkNodeAttrs;
} // namespace op
} // namespace ngraph

View File

@ -0,0 +1,121 @@
// Copyright (C) 2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include <vector>
#include "openvino/core/partial_shape.hpp"
#include "openvino/core/strides.hpp"
#include "openvino/op/op.hpp"
namespace ov {
namespace op {
namespace util {
class OPENVINO_API FrameworkNodeAttrs {
public:
using attrs_t = std::unordered_map<std::string, std::string>;
void set_opset_name(const std::string& opset_name) {
m_opset_name = opset_name;
}
void set_type_name(const std::string& type_name) {
m_type_name = type_name;
}
const std::string& get_opset_name() const {
return m_opset_name;
}
const std::string& get_type_name() const {
return m_type_name;
}
attrs_t::iterator begin() {
return m_attrs.begin();
}
attrs_t::iterator end() {
return m_attrs.end();
}
attrs_t::const_iterator begin() const {
return m_attrs.begin();
}
attrs_t::const_iterator end() const {
return m_attrs.end();
}
std::string operator[](const std::string& key) {
return m_attrs[key];
}
std::string at(const std::string& key) const {
return m_attrs.at(key);
}
bool operator==(const FrameworkNodeAttrs& other) const {
return m_type_name == other.m_type_name && m_opset_name == other.m_opset_name && m_attrs == m_attrs;
}
private:
std::string m_type_name;
std::string m_opset_name;
std::unordered_map<std::string, std::string> m_attrs;
};
class OPENVINO_API FrameworkNode : public Op {
public:
OPENVINO_OP("FrameworkNode", "util");
BWDCMP_RTTI_DECLARATION;
FrameworkNode() = default;
explicit FrameworkNode(const OutputVector& inputs, size_t output_size = 1);
void validate_and_infer_types() override;
bool visit_attributes(AttributeVisitor& visitor) override {
visitor.on_attribute("framework_node_attrs", m_attrs);
return true;
}
const FrameworkNodeAttrs& get_attrs() const {
return m_attrs;
}
void set_attrs(const FrameworkNodeAttrs& attrs) {
m_attrs = attrs;
}
std::shared_ptr<Node> clone_with_new_inputs(const OutputVector& new_args) const override;
void cache_output_descriptor();
private:
std::vector<std::tuple<ngraph::PartialShape, ngraph::element::Type>> m_inputs_desc;
std::vector<std::tuple<ngraph::PartialShape, ngraph::element::Type>> m_output_desc;
FrameworkNodeAttrs m_attrs;
};
} // namespace util
} // namespace op
} // namespace ov
namespace ov {
template <>
class OPENVINO_API AttributeAdapter<ov::op::util::FrameworkNodeAttrs>
: public DirectValueAccessor<ov::op::util::FrameworkNodeAttrs> {
public:
AttributeAdapter(ov::op::util::FrameworkNodeAttrs& value);
OPENVINO_RTTI("AttributeAdapter<FrameworkNodeAttr>");
};
} // namespace ov

View File

@ -2,38 +2,35 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "ngraph_ops/framework_node.hpp" #include "openvino/op/util/framework_node.hpp"
#include "itt.hpp" #include "itt.hpp"
using namespace std; BWDCMP_RTTI_DEFINITION(ov::op::util::FrameworkNode);
using namespace ngraph;
BWDCMP_RTTI_DEFINITION(op::FrameworkNode); ov::op::util::FrameworkNode::FrameworkNode(const OutputVector& inputs, size_t output_size) : Op(inputs) {
op::FrameworkNode::FrameworkNode(const OutputVector& inputs, size_t output_size)
: Op(inputs) {
set_output_size(output_size); set_output_size(output_size);
constructor_validate_and_infer_types(); constructor_validate_and_infer_types();
} }
shared_ptr<Node> op::FrameworkNode::clone_with_new_inputs(const OutputVector& new_args) const { std::shared_ptr<ov::Node> ov::op::util::FrameworkNode::clone_with_new_inputs(const OutputVector& new_args) const {
INTERNAL_OP_SCOPE(FrameworkNode_clone_with_new_inputs); NGRAPH_OP_SCOPE(FrameworkNode_clone_with_new_inputs);
check_new_args_count(this, new_args); check_new_args_count(this, new_args);
auto node = std::make_shared<op::FrameworkNode>(new_args); auto node = std::make_shared<op::util::FrameworkNode>(new_args);
for (size_t i = 0; i < get_output_size(); ++i) { for (size_t i = 0; i < get_output_size(); ++i) {
node->set_output_type(i, get_output_element_type(i), get_output_partial_shape(i)); node->set_output_type(i, get_output_element_type(i), get_output_partial_shape(i));
} }
return node; return node;
} }
void op::FrameworkNode::cache_output_descriptor() { void ov::op::util::FrameworkNode::cache_output_descriptor() {
for (size_t i = 0; i < get_output_size(); ++i) { for (size_t i = 0; i < get_output_size(); ++i) {
m_output_desc.emplace_back(get_output_partial_shape(i), get_output_element_type(i)); m_output_desc.emplace_back(get_output_partial_shape(i), get_output_element_type(i));
} }
} }
void op::FrameworkNode::validate_and_infer_types() { void ov::op::util::FrameworkNode::validate_and_infer_types() {
INTERNAL_OP_SCOPE(FrameworkNode_validate_and_infer_types); NGRAPH_OP_SCOPE(FrameworkNode_validate_and_infer_types);
// Save initial inputs descriptors // Save initial inputs descriptors
bool initialize_input_desc = m_inputs_desc.empty(); bool initialize_input_desc = m_inputs_desc.empty();
bool reset_output_shape_to_dynamic = false; bool reset_output_shape_to_dynamic = false;
@ -44,14 +41,11 @@ void op::FrameworkNode::validate_and_infer_types() {
const auto& input_type = get_input_element_type(i); const auto& input_type = get_input_element_type(i);
const auto& rank = input_pshape.rank(); const auto& rank = input_pshape.rank();
const auto & get_error_message = [&]() { const auto& get_error_message = [&]() {
std::stringstream out; std::stringstream out;
out << "Input descriptor for " << get_friendly_name() out << "Input descriptor for " << get_friendly_name() << " node has been changed:" << std::endl;
<< " node has been changed:" << std::endl; out << "Before: " << std::get<0>(m_inputs_desc[i]) << ", " << std::get<1>(m_inputs_desc[i]) << std::endl;
out << "Before: " << std::get<0>(m_inputs_desc[i]) << ", " out << "After: " << input_pshape << ", " << input_type << std::endl;
<< std::get<1>(m_inputs_desc[i]) << std::endl;
out << "After: " << input_pshape << ", "
<< input_type << std::endl;
out << "Please specify InferenceEngine Extensions to support this case."; out << "Please specify InferenceEngine Extensions to support this case.";
return out.str(); return out.str();
}; };
@ -67,14 +61,17 @@ void op::FrameworkNode::validate_and_infer_types() {
} else if (rank.is_static() && orig_input_pshape.rank().is_static() && } else if (rank.is_static() && orig_input_pshape.rank().is_static() &&
rank.get_length() == orig_input_pshape.rank().get_length()) { rank.get_length() == orig_input_pshape.rank().get_length()) {
for (int64_t dim = 0; dim < rank.get_length(); ++dim) { for (int64_t dim = 0; dim < rank.get_length(); ++dim) {
NODE_VALIDATION_CHECK(this, input_pshape[dim].is_dynamic() || NODE_VALIDATION_CHECK(this,
input_pshape[dim].is_dynamic() ||
(orig_input_pshape[dim].is_static() && (orig_input_pshape[dim].is_static() &&
orig_input_pshape[dim].get_length() == input_pshape[dim].get_length()), orig_input_pshape[dim].get_length() == input_pshape[dim].get_length()),
get_error_message()); get_error_message());
} }
reset_output_shape_to_dynamic = true; reset_output_shape_to_dynamic = true;
} else { } else {
NODE_VALIDATION_CHECK(this, m_inputs_desc[i] == std::make_tuple(input_pshape, input_type), get_error_message()); NODE_VALIDATION_CHECK(this,
m_inputs_desc[i] == std::make_tuple(input_pshape, input_type),
get_error_message());
} }
} }
} }
@ -95,6 +92,5 @@ void op::FrameworkNode::validate_and_infer_types() {
} }
} }
ov::AttributeAdapter<ngraph::op::FrameworkNodeAttrs>::AttributeAdapter( ov::AttributeAdapter<ov::op::util::FrameworkNodeAttrs>::AttributeAdapter(ov::op::util::FrameworkNodeAttrs& value)
ngraph::op::FrameworkNodeAttrs& value) : DirectValueAccessor<ov::op::util::FrameworkNodeAttrs>(value) {}
: DirectValueAccessor<ngraph::op::FrameworkNodeAttrs>(value) {}

View File

@ -6,8 +6,8 @@
#include <ie_ngraph_utils.hpp> #include <ie_ngraph_utils.hpp>
#include <ir_deserializer.hpp> #include <ir_deserializer.hpp>
#include <ngraph/op/util/framework_node.hpp>
#include <ngraph/opsets/opset1.hpp> #include <ngraph/opsets/opset1.hpp>
#include <ngraph_ops/framework_node.hpp>
#include <pugixml.hpp> #include <pugixml.hpp>
#include <rt_info_deserializer.hpp> #include <rt_info_deserializer.hpp>
#include <transformations/rt_info/attributes.hpp> #include <transformations/rt_info/attributes.hpp>

View File

@ -8,7 +8,7 @@
#include <ir_deserializer.hpp> #include <ir_deserializer.hpp>
#include <ngraph/opsets/opset1.hpp> #include <ngraph/opsets/opset1.hpp>
#include <ngraph_ops/framework_node.hpp> #include <openvino/op/util/framework_node.hpp>
#include <pugixml.hpp> #include <pugixml.hpp>
using namespace ngraph; using namespace ngraph;

View File

@ -20,8 +20,8 @@
#include <ngraph/function.hpp> #include <ngraph/function.hpp>
#include <ngraph/graph_util.hpp> #include <ngraph/graph_util.hpp>
#include <ngraph/visibility.hpp> #include <ngraph/visibility.hpp>
#include <ngraph_ops/framework_node.hpp>
#include <onnx_import/core/node.hpp> #include <onnx_import/core/node.hpp>
#include <openvino/op/util/framework_node.hpp>
namespace ONNX_NAMESPACE { namespace ONNX_NAMESPACE {
// forward declaration // forward declaration
@ -34,19 +34,19 @@ class Model;
} }
namespace frontend { namespace frontend {
class ONNXFrameworkNode : public op::FrameworkNode { class ONNXFrameworkNode : public ov::op::util::FrameworkNode {
public: public:
NGRAPH_RTTI_DECLARATION; NGRAPH_RTTI_DECLARATION;
ONNXFrameworkNode(std::shared_ptr<onnx_import::Graph> graph, const onnx_import::Node& node) ONNXFrameworkNode(std::shared_ptr<onnx_import::Graph> graph, const onnx_import::Node& node)
: FrameworkNode(node.get_ng_inputs(), node.get_outputs_size()), : ov::op::util::FrameworkNode(node.get_ng_inputs(), node.get_outputs_size()),
m_node(node), m_node(node),
m_graph(graph) {} m_graph(graph) {}
ONNXFrameworkNode(std::shared_ptr<onnx_import::Graph> graph, ONNXFrameworkNode(std::shared_ptr<onnx_import::Graph> graph,
const onnx_import::Node& node, const onnx_import::Node& node,
const OutputVector& inputs) const OutputVector& inputs)
: FrameworkNode(inputs, node.get_outputs_size()), : ov::op::util::FrameworkNode(inputs, node.get_outputs_size()),
m_node(node), m_node(node),
m_graph(graph) {} m_graph(graph) {}

View File

@ -4,13 +4,13 @@
#pragma once #pragma once
#include <ngraph_ops/framework_node.hpp> #include <openvino/op/util/framework_node.hpp>
#include "decoder.hpp" #include "decoder.hpp"
namespace ngraph { namespace ngraph {
namespace frontend { namespace frontend {
class PDPDFrameworkNode : public op::FrameworkNode { class PDPDFrameworkNode : public ov::op::util::FrameworkNode {
public: public:
NGRAPH_RTTI_DECLARATION; NGRAPH_RTTI_DECLARATION;
@ -20,7 +20,7 @@ public:
: FrameworkNode(inputs, decoder.get_output_size()), : FrameworkNode(inputs, decoder.get_output_size()),
m_decoder{decoder}, m_decoder{decoder},
m_inputs_names{inputs_names} { m_inputs_names{inputs_names} {
op::FrameworkNodeAttrs attrs; ov::op::util::FrameworkNodeAttrs attrs;
attrs.set_type_name(m_decoder.get_op_type()); attrs.set_type_name(m_decoder.get_op_type());
set_attrs(attrs); set_attrs(attrs);

View File

@ -147,6 +147,7 @@ set(SRC
type_prop/fake_quantize.cpp type_prop/fake_quantize.cpp
type_prop/floor.cpp type_prop/floor.cpp
type_prop/floor_mod.cpp type_prop/floor_mod.cpp
type_prop/framework_node.cpp
type_prop/gather.cpp type_prop/gather.cpp
type_prop/gather_elements.cpp type_prop/gather_elements.cpp
type_prop/gather_nd.cpp type_prop/gather_nd.cpp
@ -412,6 +413,11 @@ endif()
add_definitions("-DTEST_FILES=\"${TEST_MODEL_ZOO}/ngraph/files\"") add_definitions("-DTEST_FILES=\"${TEST_MODEL_ZOO}/ngraph/files\"")
add_subdirectory(util) add_subdirectory(util)
add_subdirectory(engines_util)
if (NGRAPH_ONNX_FRONTEND_ENABLE)
add_subdirectory(onnx_test_util)
endif()
# backend specific test files must meet the following requirements: # backend specific test files must meet the following requirements:
# 1) The must be named <name>.in.cpp # 1) The must be named <name>.in.cpp
@ -608,6 +614,7 @@ if(UNIT_TESTS_DEPENDENCIES)
endif() endif()
target_link_libraries(unit-test PRIVATE ngraph_test_util target_link_libraries(unit-test PRIVATE ngraph_test_util
engines_test_util
ngraph::builder ngraph::builder
${CMAKE_DL_LIBS} ${CMAKE_DL_LIBS}
ie_backend ie_backend
@ -637,7 +644,7 @@ endif()
if (NGRAPH_ONNX_FRONTEND_ENABLE) if (NGRAPH_ONNX_FRONTEND_ENABLE)
get_target_property(ONNX_FRONTEND_SRC_DIR onnx_ngraph_frontend SOURCE_DIR) get_target_property(ONNX_FRONTEND_SRC_DIR onnx_ngraph_frontend SOURCE_DIR)
target_include_directories(unit-test PRIVATE ${ONNX_FRONTEND_SRC_DIR}/src) target_include_directories(unit-test PRIVATE ${ONNX_FRONTEND_SRC_DIR}/src)
target_link_libraries(unit-test PRIVATE onnx_ngraph_frontend) target_link_libraries(unit-test PRIVATE onnx_ngraph_frontend onnx_test_util)
if (LINUX) if (LINUX)
target_link_options(unit-test PRIVATE -Wl,--exclude-libs,ALL) target_link_options(unit-test PRIVATE -Wl,--exclude-libs,ALL)
elseif(APPLE) elseif(APPLE)

View File

@ -4,8 +4,8 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp" #include "test_case.hpp"
#include "util/test_case.hpp" #include "test_engines.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace std; using namespace std;

View File

@ -21,8 +21,8 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp" #include "engines_util/test_engines.hpp"
#include "util/test_case.hpp" #include "engines_util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace std; using namespace std;

View File

@ -2,10 +2,10 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace std; using namespace std;

View File

@ -1,10 +1,10 @@
// Copyright (C) 2018-2021 Intel Corporation // Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace std; using namespace std;

View File

@ -21,8 +21,8 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp" #include "engines_util/test_engines.hpp"
#include "util/test_case.hpp" #include "engines_util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace std; using namespace std;

View File

@ -2,10 +2,10 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace std; using namespace std;

View File

@ -2,15 +2,15 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/execute_tools.hpp"
#include "engines_util/random.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "ngraph/runtime/tensor.hpp" #include "ngraph/runtime/tensor.hpp"
#include "runtime/backend.hpp" #include "runtime/backend.hpp"
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/random.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;

View File

@ -38,7 +38,7 @@
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp" #include "engines_util/execute_tools.hpp"
NGRAPH_SUPPRESS_DEPRECATED_START NGRAPH_SUPPRESS_DEPRECATED_START

View File

@ -14,8 +14,8 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp" #include "engines_util/test_engines.hpp"
#include "util/test_case.hpp" #include "engines_util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace std; using namespace std;

View File

@ -2,10 +2,10 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace std; using namespace std;

View File

@ -2,11 +2,11 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace std; using namespace std;

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/execute_tools.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "ngraph/runtime/tensor.hpp" #include "ngraph/runtime/tensor.hpp"

View File

@ -10,6 +10,7 @@
#include <random> #include <random>
#include <string> #include <string>
#include "engines_util/execute_tools.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/builder/autobroadcast.hpp" #include "ngraph/builder/autobroadcast.hpp"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
@ -19,7 +20,6 @@
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp"
NGRAPH_SUPPRESS_DEPRECATED_START NGRAPH_SUPPRESS_DEPRECATED_START

View File

@ -2,10 +2,10 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
NGRAPH_SUPPRESS_DEPRECATED_START NGRAPH_SUPPRESS_DEPRECATED_START

View File

@ -4,13 +4,13 @@
#include <numeric> #include <numeric>
#include "engines_util/execute_tools.hpp"
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "ngraph/builder/reduce_ops.hpp" #include "ngraph/builder/reduce_ops.hpp"
#include "ngraph/builder/reshape.hpp" #include "ngraph/builder/reshape.hpp"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp"
using namespace ngraph; using namespace ngraph;
using namespace std; using namespace std;

View File

@ -14,8 +14,8 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp" #include "engines_util/test_engines.hpp"
#include "util/test_case.hpp" #include "engines_util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace std; using namespace std;

View File

@ -14,10 +14,10 @@
// limitations under the License. // limitations under the License.
//***************************************************************************** //*****************************************************************************
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace std; using namespace std;

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/execute_tools.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "ngraph/runtime/tensor.hpp" #include "ngraph/runtime/tensor.hpp"
@ -10,7 +11,6 @@
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp"
NGRAPH_SUPPRESS_DEPRECATED_START NGRAPH_SUPPRESS_DEPRECATED_START

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/execute_tools.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "ngraph/runtime/tensor.hpp" #include "ngraph/runtime/tensor.hpp"
@ -10,7 +11,6 @@
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp"
NGRAPH_SUPPRESS_DEPRECATED_START NGRAPH_SUPPRESS_DEPRECATED_START

View File

@ -2,17 +2,17 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/execute_tools.hpp"
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "ngraph/runtime/tensor.hpp" #include "ngraph/runtime/tensor.hpp"
#include "runtime/backend.hpp" #include "runtime/backend.hpp"
#include "util/all_close.hpp" #include "util/all_close.hpp"
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/engine/test_engines.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;

View File

@ -14,17 +14,17 @@
// limitations under the License. // limitations under the License.
//***************************************************************************** //*****************************************************************************
#include "engines_util/execute_tools.hpp"
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "ngraph/runtime/tensor.hpp" #include "ngraph/runtime/tensor.hpp"
#include "runtime/backend.hpp" #include "runtime/backend.hpp"
#include "util/all_close.hpp" #include "util/all_close.hpp"
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/engine/test_engines.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;

View File

@ -21,8 +21,8 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp" #include "engines_util/test_engines.hpp"
#include "util/test_case.hpp" #include "engines_util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
NGRAPH_SUPPRESS_DEPRECATED_START NGRAPH_SUPPRESS_DEPRECATED_START

View File

@ -21,8 +21,8 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp" #include "engines_util/test_engines.hpp"
#include "util/test_case.hpp" #include "engines_util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
NGRAPH_SUPPRESS_DEPRECATED_START NGRAPH_SUPPRESS_DEPRECATED_START

View File

@ -2,17 +2,17 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/execute_tools.hpp"
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "ngraph/runtime/tensor.hpp" #include "ngraph/runtime/tensor.hpp"
#include "runtime/backend.hpp" #include "runtime/backend.hpp"
#include "util/all_close.hpp" #include "util/all_close.hpp"
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/engine/test_engines.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;

View File

@ -2,17 +2,17 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/execute_tools.hpp"
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "ngraph/runtime/tensor.hpp" #include "ngraph/runtime/tensor.hpp"
#include "runtime/backend.hpp" #include "runtime/backend.hpp"
#include "util/all_close.hpp" #include "util/all_close.hpp"
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/engine/test_engines.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;

View File

@ -2,10 +2,10 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/op/deformable_psroi_pooling.hpp" #include "ngraph/op/deformable_psroi_pooling.hpp"
#include "util/engine/test_engines.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace ngraph; using namespace ngraph;

View File

@ -2,10 +2,10 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/op/depth_to_space.hpp" #include "ngraph/op/depth_to_space.hpp"
#include "util/engine/test_engines.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace ngraph; using namespace ngraph;

View File

@ -14,8 +14,8 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp" #include "engines_util/test_engines.hpp"
#include "util/test_case.hpp" #include "engines_util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace std; using namespace std;

View File

@ -2,6 +2,9 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/execute_tools.hpp"
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "ngraph/runtime/tensor.hpp" #include "ngraph/runtime/tensor.hpp"
@ -10,11 +13,8 @@
#include "runtime/backend.hpp" #include "runtime/backend.hpp"
#include "util/all_close.hpp" #include "util/all_close.hpp"
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/engine/test_engines.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;

View File

@ -28,7 +28,7 @@
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp" #include "engines_util/execute_tools.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;

View File

@ -2,13 +2,13 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/execute_tools.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "ngraph/runtime/tensor.hpp" #include "ngraph/runtime/tensor.hpp"
#include "runtime/backend.hpp" #include "runtime/backend.hpp"
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;

View File

@ -2,13 +2,13 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/execute_tools.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "ngraph/runtime/tensor.hpp" #include "ngraph/runtime/tensor.hpp"
#include "runtime/backend.hpp" #include "runtime/backend.hpp"
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;

View File

@ -21,8 +21,8 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp" #include "engines_util/test_engines.hpp"
#include "util/test_case.hpp" #include "engines_util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace std; using namespace std;

View File

@ -21,8 +21,8 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp" #include "engines_util/test_engines.hpp"
#include "util/test_case.hpp" #include "engines_util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace std; using namespace std;

View File

@ -31,9 +31,9 @@
#include "util/all_close.hpp" #include "util/all_close.hpp"
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/random.hpp" #include "engines_util/random.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp" #include "engines_util/execute_tools.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;

View File

@ -19,9 +19,9 @@
#include "util/all_close.hpp" #include "util/all_close.hpp"
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/random.hpp" #include "engines_util/random.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp" #include "engines_util/execute_tools.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;

View File

@ -33,9 +33,9 @@
#include "util/all_close.hpp" #include "util/all_close.hpp"
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/random.hpp" #include "engines_util/random.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp" #include "engines_util/execute_tools.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;

View File

@ -2,17 +2,17 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/execute_tools.hpp"
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "ngraph/runtime/tensor.hpp" #include "ngraph/runtime/tensor.hpp"
#include "runtime/backend.hpp" #include "runtime/backend.hpp"
#include "util/all_close.hpp" #include "util/all_close.hpp"
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/engine/test_engines.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;

View File

@ -22,8 +22,8 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp" #include "engines_util/test_engines.hpp"
#include "util/test_case.hpp" #include "engines_util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace ngraph; using namespace ngraph;

View File

@ -21,8 +21,8 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp" #include "engines_util/test_engines.hpp"
#include "util/test_case.hpp" #include "engines_util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace std; using namespace std;

View File

@ -21,8 +21,8 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp" #include "engines_util/test_engines.hpp"
#include "util/test_case.hpp" #include "engines_util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace std; using namespace std;

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/execute_tools.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "ngraph/runtime/tensor.hpp" #include "ngraph/runtime/tensor.hpp"
@ -9,7 +10,6 @@
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;

View File

@ -9,10 +9,10 @@
#include <random> #include <random>
#include <string> #include <string>
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
NGRAPH_SUPPRESS_DEPRECATED_START NGRAPH_SUPPRESS_DEPRECATED_START

View File

@ -2,10 +2,10 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
NGRAPH_SUPPRESS_DEPRECATED_START NGRAPH_SUPPRESS_DEPRECATED_START

View File

@ -9,6 +9,9 @@
#include <random> #include <random>
#include <string> #include <string>
#include "engines_util/execute_tools.hpp"
#include "engines_util/random.hpp"
#include "engines_util/test_case.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "ngraph/runtime/tensor.hpp" #include "ngraph/runtime/tensor.hpp"
@ -16,10 +19,7 @@
#include "util/all_close.hpp" #include "util/all_close.hpp"
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/random.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp"
NGRAPH_SUPPRESS_DEPRECATED_START NGRAPH_SUPPRESS_DEPRECATED_START

View File

@ -2,10 +2,10 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace std; using namespace std;

View File

@ -2,17 +2,17 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/execute_tools.hpp"
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "ngraph/runtime/tensor.hpp" #include "ngraph/runtime/tensor.hpp"
#include "runtime/backend.hpp" #include "runtime/backend.hpp"
#include "util/all_close.hpp" #include "util/all_close.hpp"
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/engine/test_engines.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;

View File

@ -2,10 +2,10 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace std; using namespace std;

View File

@ -4,10 +4,10 @@
#include <fstream> #include <fstream>
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
NGRAPH_SUPPRESS_DEPRECATED_START NGRAPH_SUPPRESS_DEPRECATED_START

View File

@ -2,6 +2,9 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/execute_tools.hpp"
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "ngraph/runtime/tensor.hpp" #include "ngraph/runtime/tensor.hpp"
@ -10,11 +13,8 @@
#include "runtime/backend.hpp" #include "runtime/backend.hpp"
#include "util/all_close.hpp" #include "util/all_close.hpp"
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/engine/test_engines.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;

View File

@ -2,17 +2,17 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/execute_tools.hpp"
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "ngraph/runtime/tensor.hpp" #include "ngraph/runtime/tensor.hpp"
#include "runtime/backend.hpp" #include "runtime/backend.hpp"
#include "util/all_close.hpp" #include "util/all_close.hpp"
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/engine/test_engines.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;

View File

@ -27,15 +27,14 @@
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp" #include "engines_util/execute_tools.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;
static string s_manifest = "${MANIFEST}"; static string s_manifest = "${MANIFEST}";
NGRAPH_TEST(${BACKEND_NAME}, layer_norm_affine_stats) NGRAPH_TEST(${BACKEND_NAME}, layer_norm_affine_stats) {
{
auto p_data = make_shared<op::Parameter>(element::f32, Shape{2, 4}); auto p_data = make_shared<op::Parameter>(element::f32, Shape{2, 4});
auto p_scale = make_shared<op::Parameter>(element::f32, Shape{4}); auto p_scale = make_shared<op::Parameter>(element::f32, Shape{4});
auto p_bias = make_shared<op::Parameter>(element::f32, Shape{4}); auto p_bias = make_shared<op::Parameter>(element::f32, Shape{4});

View File

@ -21,8 +21,8 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp" #include "engines_util/test_engines.hpp"
#include "util/test_case.hpp" #include "engines_util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace std; using namespace std;

View File

@ -20,7 +20,7 @@
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp" #include "engines_util/execute_tools.hpp"
NGRAPH_SUPPRESS_DEPRECATED_START NGRAPH_SUPPRESS_DEPRECATED_START

View File

@ -16,8 +16,8 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp" #include "engines_util/test_engines.hpp"
#include "util/test_case.hpp" #include "engines_util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace std; using namespace std;

View File

@ -10,17 +10,17 @@
#include <random> #include <random>
#include <string> #include <string>
#include "engines_util/execute_tools.hpp"
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "ngraph/runtime/tensor.hpp" #include "ngraph/runtime/tensor.hpp"
#include "runtime/backend.hpp" #include "runtime/backend.hpp"
#include "util/all_close.hpp" #include "util/all_close.hpp"
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/engine/test_engines.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;

View File

@ -14,8 +14,8 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp" #include "engines_util/test_engines.hpp"
#include "util/test_case.hpp" #include "engines_util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace std; using namespace std;

View File

@ -14,8 +14,8 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp" #include "engines_util/test_engines.hpp"
#include "util/test_case.hpp" #include "engines_util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace std; using namespace std;

View File

@ -21,8 +21,8 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp" #include "engines_util/test_engines.hpp"
#include "util/test_case.hpp" #include "engines_util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace std; using namespace std;

View File

@ -9,6 +9,7 @@
#include <random> #include <random>
#include <string> #include <string>
#include "engines_util/execute_tools.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "ngraph/runtime/tensor.hpp" #include "ngraph/runtime/tensor.hpp"
@ -17,7 +18,6 @@
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;

View File

@ -21,8 +21,8 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp" #include "engines_util/test_engines.hpp"
#include "util/test_case.hpp" #include "engines_util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace std; using namespace std;

View File

@ -14,8 +14,8 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp" #include "engines_util/test_engines.hpp"
#include "util/test_case.hpp" #include "engines_util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace std; using namespace std;

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/execute_tools.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "ngraph/runtime/tensor.hpp" #include "ngraph/runtime/tensor.hpp"
@ -10,7 +11,6 @@
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/execute_tools.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "ngraph/runtime/tensor.hpp" #include "ngraph/runtime/tensor.hpp"
@ -9,7 +10,6 @@
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp"
NGRAPH_SUPPRESS_DEPRECATED_START NGRAPH_SUPPRESS_DEPRECATED_START

View File

@ -21,8 +21,8 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp" #include "engines_util/test_engines.hpp"
#include "util/test_case.hpp" #include "engines_util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
NGRAPH_SUPPRESS_DEPRECATED_START NGRAPH_SUPPRESS_DEPRECATED_START

View File

@ -14,8 +14,8 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp" #include "engines_util/test_engines.hpp"
#include "util/test_case.hpp" #include "engines_util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace std; using namespace std;

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/execute_tools.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "ngraph/runtime/tensor.hpp" #include "ngraph/runtime/tensor.hpp"
@ -9,7 +10,6 @@
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;

View File

@ -20,7 +20,7 @@
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp" #include "engines_util/execute_tools.hpp"
NGRAPH_SUPPRESS_DEPRECATED_START NGRAPH_SUPPRESS_DEPRECATED_START

View File

@ -2,12 +2,12 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/execute_tools.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;

View File

@ -10,16 +10,16 @@
#include <random> #include <random>
#include <string> #include <string>
#include "engines_util/execute_tools.hpp"
#include "engines_util/random.hpp"
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/all_close.hpp" #include "util/all_close.hpp"
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/engine/test_engines.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/random.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;

View File

@ -9,10 +9,10 @@
#include <random> #include <random>
#include <string> #include <string>
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace std; using namespace std;

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/execute_tools.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "ngraph/runtime/tensor.hpp" #include "ngraph/runtime/tensor.hpp"
@ -10,7 +11,6 @@
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/execute_tools.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "ngraph/runtime/tensor.hpp" #include "ngraph/runtime/tensor.hpp"
@ -9,7 +10,6 @@
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;

View File

@ -27,23 +27,21 @@
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp" #include "engines_util/execute_tools.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;
static string s_manifest = "${MANIFEST}"; static string s_manifest = "${MANIFEST}";
NGRAPH_TEST(${BACKEND_NAME}, partial_slice_static) NGRAPH_TEST(${BACKEND_NAME}, partial_slice_static) {
{
Shape shape_x{2, 3, 2}; Shape shape_x{2, 3, 2};
auto x = make_shared<op::Parameter>(element::f32, shape_x); auto x = make_shared<op::Parameter>(element::f32, shape_x);
AxisVector axes{0, 1}; AxisVector axes{0, 1};
vector<int64_t> lower_bounds{1, 0}; vector<int64_t> lower_bounds{1, 0};
vector<int64_t> upper_bounds{2, 2}; vector<int64_t> upper_bounds{2, 2};
AxisVector decrease_axes{}; AxisVector decrease_axes{};
auto f = make_shared<Function>( auto f = make_shared<Function>(make_shared<op::PartialSlice>(x, axes, lower_bounds, upper_bounds, decrease_axes),
make_shared<op::PartialSlice>(x, axes, lower_bounds, upper_bounds, decrease_axes),
ParameterVector{x}); ParameterVector{x});
auto backend = runtime::Backend::create("${BACKEND_NAME}"); auto backend = runtime::Backend::create("${BACKEND_NAME}");
@ -61,16 +59,14 @@ NGRAPH_TEST(${BACKEND_NAME}, partial_slice_static)
EXPECT_TRUE(test::all_close_f(v_r, read_vector<float>(t_r))); EXPECT_TRUE(test::all_close_f(v_r, read_vector<float>(t_r)));
} }
NGRAPH_TEST(${BACKEND_NAME}, partial_slice_partial_shape) NGRAPH_TEST(${BACKEND_NAME}, partial_slice_partial_shape) {
{
auto pshape_x = PartialShape{Dimension::dynamic(), 3, Dimension::dynamic()}; auto pshape_x = PartialShape{Dimension::dynamic(), 3, Dimension::dynamic()};
auto x = make_shared<op::Parameter>(element::f32, pshape_x); auto x = make_shared<op::Parameter>(element::f32, pshape_x);
AxisVector axes{0, 1}; AxisVector axes{0, 1};
vector<int64_t> lower_bounds{1, 0}; vector<int64_t> lower_bounds{1, 0};
vector<int64_t> upper_bounds{2, 2}; vector<int64_t> upper_bounds{2, 2};
AxisVector decrease_axes{}; AxisVector decrease_axes{};
auto f = make_shared<Function>( auto f = make_shared<Function>(make_shared<op::PartialSlice>(x, axes, lower_bounds, upper_bounds, decrease_axes),
make_shared<op::PartialSlice>(x, axes, lower_bounds, upper_bounds, decrease_axes),
ParameterVector{x}); ParameterVector{x});
auto backend = runtime::Backend::create("${BACKEND_NAME}", true); auto backend = runtime::Backend::create("${BACKEND_NAME}", true);
@ -89,16 +85,14 @@ NGRAPH_TEST(${BACKEND_NAME}, partial_slice_partial_shape)
EXPECT_TRUE(test::all_close_f(v_r, read_vector<float>(t_r))); EXPECT_TRUE(test::all_close_f(v_r, read_vector<float>(t_r)));
} }
NGRAPH_TEST(${BACKEND_NAME}, partial_slice_unkown_rank) NGRAPH_TEST(${BACKEND_NAME}, partial_slice_unkown_rank) {
{
auto pshape_x = PartialShape::dynamic(); auto pshape_x = PartialShape::dynamic();
auto x = make_shared<op::Parameter>(element::f32, pshape_x); auto x = make_shared<op::Parameter>(element::f32, pshape_x);
AxisVector axes{0, 1}; AxisVector axes{0, 1};
vector<int64_t> lower_bounds{1, 0}; vector<int64_t> lower_bounds{1, 0};
vector<int64_t> upper_bounds{2, 2}; vector<int64_t> upper_bounds{2, 2};
AxisVector decrease_axes{}; AxisVector decrease_axes{};
auto f = make_shared<Function>( auto f = make_shared<Function>(make_shared<op::PartialSlice>(x, axes, lower_bounds, upper_bounds, decrease_axes),
make_shared<op::PartialSlice>(x, axes, lower_bounds, upper_bounds, decrease_axes),
ParameterVector{x}); ParameterVector{x});
auto backend = runtime::Backend::create("${BACKEND_NAME}", true); auto backend = runtime::Backend::create("${BACKEND_NAME}", true);

View File

@ -21,8 +21,8 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp" #include "engines_util/test_engines.hpp"
#include "util/test_case.hpp" #include "engines_util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
NGRAPH_SUPPRESS_DEPRECATED_START NGRAPH_SUPPRESS_DEPRECATED_START

View File

@ -1,10 +1,10 @@
// Co pyright (C) 2018-2021 Intel Corporation // Co pyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace std; using namespace std;

View File

@ -1,11 +1,11 @@
// Copyright (C) 2018-2021 Intel Corporation // Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "ngraph/op/prior_box.hpp" #include "ngraph/op/prior_box.hpp"
#include "util/engine/test_engines.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace std; using namespace std;

View File

@ -2,11 +2,11 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "ngraph/op/prior_box_clustered.hpp" #include "ngraph/op/prior_box_clustered.hpp"
#include "util/engine/test_engines.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace std; using namespace std;

View File

@ -9,11 +9,11 @@
#include <random> #include <random>
#include <string> #include <string>
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "ngraph/op/proposal.hpp" #include "ngraph/op/proposal.hpp"
#include "util/engine/test_engines.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
NGRAPH_SUPPRESS_DEPRECATED_START NGRAPH_SUPPRESS_DEPRECATED_START

View File

@ -2,10 +2,10 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/op/psroi_pooling.hpp" #include "ngraph/op/psroi_pooling.hpp"
#include "util/engine/test_engines.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
using namespace ngraph; using namespace ngraph;

View File

@ -2,10 +2,10 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
NGRAPH_SUPPRESS_DEPRECATED_START NGRAPH_SUPPRESS_DEPRECATED_START
@ -16,8 +16,7 @@ using namespace ngraph;
static string s_manifest = "${MANIFEST}"; static string s_manifest = "${MANIFEST}";
using TestEngine = test::ENGINE_CLASS_NAME(${BACKEND_NAME}); using TestEngine = test::ENGINE_CLASS_NAME(${BACKEND_NAME});
NGRAPH_TEST(${BACKEND_NAME}, quantize) NGRAPH_TEST(${BACKEND_NAME}, quantize) {
{
Shape input_shape{4, 3}; Shape input_shape{4, 3};
Shape scale_offset_shape; Shape scale_offset_shape;
AxisSet quantization_axes; AxisSet quantization_axes;
@ -33,8 +32,7 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize)
auto X = make_shared<op::Parameter>(input_type, input_shape); auto X = make_shared<op::Parameter>(input_type, input_shape);
auto scale = op::Constant::create(input_type, scale_offset_shape, {2}); auto scale = op::Constant::create(input_type, scale_offset_shape, {2});
auto offset = op::Constant::create(output_type, scale_offset_shape, {1}); auto offset = op::Constant::create(output_type, scale_offset_shape, {1});
auto quantize = auto quantize = make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
auto f = make_shared<Function>(quantize, ParameterVector{X}); auto f = make_shared<Function>(quantize, ParameterVector{X});
std::vector<input_c_type> x{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; std::vector<input_c_type> x{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
@ -49,8 +47,7 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize)
test_case.run(); test_case.run();
} }
NGRAPH_TEST(${BACKEND_NAME}, quantize_zero_offset) NGRAPH_TEST(${BACKEND_NAME}, quantize_zero_offset) {
{
Shape input_shape{4, 3}; Shape input_shape{4, 3};
Shape scale_offset_shape; Shape scale_offset_shape;
AxisSet quantization_axes; AxisSet quantization_axes;
@ -66,8 +63,7 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_zero_offset)
auto X = make_shared<op::Parameter>(input_type, input_shape); auto X = make_shared<op::Parameter>(input_type, input_shape);
auto scale = op::Constant::create(input_type, scale_offset_shape, {2}); auto scale = op::Constant::create(input_type, scale_offset_shape, {2});
auto offset = op::Constant::create(output_type, scale_offset_shape, {0}); auto offset = op::Constant::create(output_type, scale_offset_shape, {0});
auto quantize = auto quantize = make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
auto f = make_shared<Function>(quantize, ParameterVector{X}); auto f = make_shared<Function>(quantize, ParameterVector{X});
std::vector<input_c_type> x{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; std::vector<input_c_type> x{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
@ -82,8 +78,7 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_zero_offset)
test_case.run(); test_case.run();
} }
NGRAPH_TEST(${BACKEND_NAME}, quantize_axes) NGRAPH_TEST(${BACKEND_NAME}, quantize_axes) {
{
Shape input_shape{4, 3}; Shape input_shape{4, 3};
Shape scale_offset_shape{4}; Shape scale_offset_shape{4};
AxisSet quantization_axes{0}; AxisSet quantization_axes{0};
@ -99,8 +94,7 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_axes)
auto X = make_shared<op::Parameter>(input_type, input_shape); auto X = make_shared<op::Parameter>(input_type, input_shape);
auto scale = op::Constant::create(input_type, scale_offset_shape, {2, 3, 4, 5}); auto scale = op::Constant::create(input_type, scale_offset_shape, {2, 3, 4, 5});
auto offset = op::Constant::create(output_type, scale_offset_shape, {10, 20, 30, 40}); auto offset = op::Constant::create(output_type, scale_offset_shape, {10, 20, 30, 40});
auto quantize = auto quantize = make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
auto f = make_shared<Function>(quantize, ParameterVector{X}); auto f = make_shared<Function>(quantize, ParameterVector{X});
std::vector<input_c_type> x{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; std::vector<input_c_type> x{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
@ -111,13 +105,11 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_axes)
auto test_case = test::TestCase<TestEngine>(f); auto test_case = test::TestCase<TestEngine>(f);
test_case.add_input<input_c_type>({x}); test_case.add_input<input_c_type>({x});
test_case.add_expected_output<output_c_type>(input_shape, test_case.add_expected_output<output_c_type>(input_shape, {10, 11, 11, 21, 21, 22, 32, 32, 32, 42, 42, 42});
{10, 11, 11, 21, 21, 22, 32, 32, 32, 42, 42, 42});
test_case.run(); test_case.run();
} }
NGRAPH_TEST(${BACKEND_NAME}, quantize_int8) NGRAPH_TEST(${BACKEND_NAME}, quantize_int8) {
{
Shape input_shape{4, 3}; Shape input_shape{4, 3};
Shape scale_offset_shape; Shape scale_offset_shape;
AxisSet quantization_axes; AxisSet quantization_axes;
@ -133,8 +125,7 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_int8)
auto X = make_shared<op::Parameter>(input_type, input_shape); auto X = make_shared<op::Parameter>(input_type, input_shape);
auto scale = op::Constant::create(input_type, scale_offset_shape, {2}); auto scale = op::Constant::create(input_type, scale_offset_shape, {2});
auto offset = op::Constant::create(output_type, scale_offset_shape, {1}); auto offset = op::Constant::create(output_type, scale_offset_shape, {1});
auto quantize = auto quantize = make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
auto f = make_shared<Function>(quantize, ParameterVector{X}); auto f = make_shared<Function>(quantize, ParameterVector{X});
std::vector<input_c_type> x{0, -1, 2, -3, 4, -5, 6, -7, 8, -9, 10, -11}; std::vector<input_c_type> x{0, -1, 2, -3, 4, -5, 6, -7, 8, -9, 10, -11};
@ -145,13 +136,11 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_int8)
auto test_case = test::TestCase<TestEngine>(f); auto test_case = test::TestCase<TestEngine>(f);
test_case.add_input<input_c_type>({x}); test_case.add_input<input_c_type>({x});
test_case.add_expected_output<output_c_type>(input_shape, test_case.add_expected_output<output_c_type>(input_shape, {1, 1, 2, -1, 3, -1, 4, -3, 5, -3, 6, -5});
{1, 1, 2, -1, 3, -1, 4, -3, 5, -3, 6, -5});
test_case.run(); test_case.run();
} }
NGRAPH_TEST(${BACKEND_NAME}, quantize_int8_zero_offset) NGRAPH_TEST(${BACKEND_NAME}, quantize_int8_zero_offset) {
{
Shape input_shape{4, 3}; Shape input_shape{4, 3};
Shape scale_offset_shape; Shape scale_offset_shape;
AxisSet quantization_axes; AxisSet quantization_axes;
@ -167,8 +156,7 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_int8_zero_offset)
auto X = make_shared<op::Parameter>(input_type, input_shape); auto X = make_shared<op::Parameter>(input_type, input_shape);
auto scale = op::Constant::create(input_type, scale_offset_shape, {2}); auto scale = op::Constant::create(input_type, scale_offset_shape, {2});
auto offset = op::Constant::create(output_type, scale_offset_shape, {0}); auto offset = op::Constant::create(output_type, scale_offset_shape, {0});
auto quantize = auto quantize = make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
auto f = make_shared<Function>(quantize, ParameterVector{X}); auto f = make_shared<Function>(quantize, ParameterVector{X});
std::vector<input_c_type> x{0, -1, 2, -3, 4, -5, 6, -7, 8, -9, 10, -11}; std::vector<input_c_type> x{0, -1, 2, -3, 4, -5, 6, -7, 8, -9, 10, -11};
@ -179,13 +167,11 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_int8_zero_offset)
auto test_case = test::TestCase<TestEngine>(f); auto test_case = test::TestCase<TestEngine>(f);
test_case.add_input<input_c_type>({x}); test_case.add_input<input_c_type>({x});
test_case.add_expected_output<output_c_type>(input_shape, test_case.add_expected_output<output_c_type>(input_shape, {0, 0, 1, -2, 2, -2, 3, -4, 4, -4, 5, -6});
{0, 0, 1, -2, 2, -2, 3, -4, 4, -4, 5, -6});
test_case.run(); test_case.run();
} }
NGRAPH_TEST(${BACKEND_NAME}, quantize_int32) NGRAPH_TEST(${BACKEND_NAME}, quantize_int32) {
{
Shape input_shape{4, 3}; Shape input_shape{4, 3};
Shape scale_offset_shape; Shape scale_offset_shape;
AxisSet quantization_axes; AxisSet quantization_axes;
@ -201,8 +187,7 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_int32)
auto X = make_shared<op::Parameter>(input_type, input_shape); auto X = make_shared<op::Parameter>(input_type, input_shape);
auto scale = op::Constant::create(input_type, scale_offset_shape, {2}); auto scale = op::Constant::create(input_type, scale_offset_shape, {2});
auto offset = op::Constant::create(output_type, scale_offset_shape, {1}); auto offset = op::Constant::create(output_type, scale_offset_shape, {1});
auto quantize = auto quantize = make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
auto f = make_shared<Function>(quantize, ParameterVector{X}); auto f = make_shared<Function>(quantize, ParameterVector{X});
std::vector<input_c_type> x{0, -1, 2, -3, 4, -5, 6, -7, 8, -9, 10, -11}; std::vector<input_c_type> x{0, -1, 2, -3, 4, -5, 6, -7, 8, -9, 10, -11};
@ -213,13 +198,11 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_int32)
auto test_case = test::TestCase<TestEngine>(f); auto test_case = test::TestCase<TestEngine>(f);
test_case.add_input<input_c_type>({x}); test_case.add_input<input_c_type>({x});
test_case.add_expected_output<output_c_type>(input_shape, test_case.add_expected_output<output_c_type>(input_shape, {1, 1, 2, -1, 3, -1, 4, -3, 5, -3, 6, -5});
{1, 1, 2, -1, 3, -1, 4, -3, 5, -3, 6, -5});
test_case.run(); test_case.run();
} }
NGRAPH_TEST(${BACKEND_NAME}, quantize_int32_zero_offset) NGRAPH_TEST(${BACKEND_NAME}, quantize_int32_zero_offset) {
{
Shape input_shape{4, 3}; Shape input_shape{4, 3};
Shape scale_offset_shape; Shape scale_offset_shape;
AxisSet quantization_axes; AxisSet quantization_axes;
@ -235,8 +218,7 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_int32_zero_offset)
auto X = make_shared<op::Parameter>(input_type, input_shape); auto X = make_shared<op::Parameter>(input_type, input_shape);
auto scale = op::Constant::create(input_type, scale_offset_shape, {2}); auto scale = op::Constant::create(input_type, scale_offset_shape, {2});
auto offset = op::Constant::create(output_type, scale_offset_shape, {0}); auto offset = op::Constant::create(output_type, scale_offset_shape, {0});
auto quantize = auto quantize = make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
auto f = make_shared<Function>(quantize, ParameterVector{X}); auto f = make_shared<Function>(quantize, ParameterVector{X});
std::vector<input_c_type> x{0, -1, 2, -3, 4, -5, 6, -7, 8, -9, 10, -11}; std::vector<input_c_type> x{0, -1, 2, -3, 4, -5, 6, -7, 8, -9, 10, -11};
@ -247,13 +229,11 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_int32_zero_offset)
auto test_case = test::TestCase<TestEngine>(f); auto test_case = test::TestCase<TestEngine>(f);
test_case.add_input<input_c_type>({x}); test_case.add_input<input_c_type>({x});
test_case.add_expected_output<output_c_type>(input_shape, test_case.add_expected_output<output_c_type>(input_shape, {0, 0, 1, -2, 2, -2, 3, -4, 4, -4, 5, -6});
{0, 0, 1, -2, 2, -2, 3, -4, 4, -4, 5, -6});
test_case.run(); test_case.run();
} }
NGRAPH_TEST(${BACKEND_NAME}, quantize_clamp_uint8) NGRAPH_TEST(${BACKEND_NAME}, quantize_clamp_uint8) {
{
Shape input_shape{4, 3}; Shape input_shape{4, 3};
Shape scale_offset_shape; Shape scale_offset_shape;
AxisSet quantization_axes; AxisSet quantization_axes;
@ -271,21 +251,19 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_clamp_uint8)
auto X = make_shared<op::Parameter>(input_type, input_shape); auto X = make_shared<op::Parameter>(input_type, input_shape);
auto scale = op::Constant::create(input_type, scale_offset_shape, {1.0 / (max + 1.0)}); auto scale = op::Constant::create(input_type, scale_offset_shape, {1.0 / (max + 1.0)});
auto offset = op::Constant::create(output_type, scale_offset_shape, {0}); auto offset = op::Constant::create(output_type, scale_offset_shape, {0});
auto quantize = auto quantize = make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
auto f = make_shared<Function>(quantize, ParameterVector{X}); auto f = make_shared<Function>(quantize, ParameterVector{X});
std::vector<input_c_type> x{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; std::vector<input_c_type> x{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
auto test_case = test::TestCase<TestEngine>(f); auto test_case = test::TestCase<TestEngine>(f);
test_case.add_input<input_c_type>({x}); test_case.add_input<input_c_type>({x});
test_case.add_expected_output<output_c_type>( test_case.add_expected_output<output_c_type>(input_shape,
input_shape, {0, max, max, max, max, max, max, max, max, max, max, max}); {0, max, max, max, max, max, max, max, max, max, max, max});
test_case.run(); test_case.run();
} }
NGRAPH_TEST(${BACKEND_NAME}, quantize_clamp_int8) NGRAPH_TEST(${BACKEND_NAME}, quantize_clamp_int8) {
{
Shape input_shape{4, 3}; Shape input_shape{4, 3};
Shape scale_offset_shape; Shape scale_offset_shape;
AxisSet quantization_axes; AxisSet quantization_axes;
@ -304,21 +282,19 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_clamp_int8)
auto X = make_shared<op::Parameter>(input_type, input_shape); auto X = make_shared<op::Parameter>(input_type, input_shape);
auto scale = op::Constant::create(input_type, scale_offset_shape, {1.0 / (max + 1.0)}); auto scale = op::Constant::create(input_type, scale_offset_shape, {1.0 / (max + 1.0)});
auto offset = op::Constant::create(output_type, scale_offset_shape, {0}); auto offset = op::Constant::create(output_type, scale_offset_shape, {0});
auto quantize = auto quantize = make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
auto f = make_shared<Function>(quantize, ParameterVector{X}); auto f = make_shared<Function>(quantize, ParameterVector{X});
std::vector<input_c_type> x{0, -1, 2, -3, 4, -5, 6, -7, 8, -9, 10, -11}; std::vector<input_c_type> x{0, -1, 2, -3, 4, -5, 6, -7, 8, -9, 10, -11};
auto test_case = test::TestCase<TestEngine>(f); auto test_case = test::TestCase<TestEngine>(f);
test_case.add_input<input_c_type>({x}); test_case.add_input<input_c_type>({x});
test_case.add_expected_output<output_c_type>( test_case.add_expected_output<output_c_type>(input_shape,
input_shape, {0, min, max, min, max, min, max, min, max, min, max, min}); {0, min, max, min, max, min, max, min, max, min, max, min});
test_case.run(); test_case.run();
} }
NGRAPH_TEST(${BACKEND_NAME}, quantize_clamp_int32) NGRAPH_TEST(${BACKEND_NAME}, quantize_clamp_int32) {
{
Shape input_shape{4, 3}; Shape input_shape{4, 3};
Shape scale_offset_shape; Shape scale_offset_shape;
AxisSet quantization_axes; AxisSet quantization_axes;
@ -338,21 +314,19 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_clamp_int32)
auto X = make_shared<op::Parameter>(input_type, input_shape); auto X = make_shared<op::Parameter>(input_type, input_shape);
auto scale = op::Constant::create(input_type, scale_offset_shape, {1.0 / (max + 1.0)}); auto scale = op::Constant::create(input_type, scale_offset_shape, {1.0 / (max + 1.0)});
auto offset = op::Constant::create(output_type, scale_offset_shape, {0}); auto offset = op::Constant::create(output_type, scale_offset_shape, {0});
auto quantize = auto quantize = make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
auto f = make_shared<Function>(quantize, ParameterVector{X}); auto f = make_shared<Function>(quantize, ParameterVector{X});
std::vector<input_c_type> x{0, -1, 2, -3, 4, -5, 6, -7, 8, -9, 10, -11}; std::vector<input_c_type> x{0, -1, 2, -3, 4, -5, 6, -7, 8, -9, 10, -11};
auto test_case = test::TestCase<TestEngine>(f); auto test_case = test::TestCase<TestEngine>(f);
test_case.add_input<input_c_type>({x}); test_case.add_input<input_c_type>({x});
test_case.add_expected_output<output_c_type>( test_case.add_expected_output<output_c_type>(input_shape,
input_shape, {0, min, max, min, max, min, max, min, max, min, max, min}); {0, min, max, min, max, min, max, min, max, min, max, min});
test_case.run(); test_case.run();
} }
NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_NEAREST_TOWARD_ZERO) NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_NEAREST_TOWARD_ZERO) {
{
Shape input_shape{4, 3}; Shape input_shape{4, 3};
Shape scale_offset_shape; Shape scale_offset_shape;
AxisSet quantization_axes; AxisSet quantization_axes;
@ -368,8 +342,7 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_NEAREST_TOWARD_ZERO)
auto X = make_shared<op::Parameter>(input_type, input_shape); auto X = make_shared<op::Parameter>(input_type, input_shape);
auto scale = op::Constant::create(input_type, scale_offset_shape, {4}); auto scale = op::Constant::create(input_type, scale_offset_shape, {4});
auto offset = op::Constant::create(output_type, scale_offset_shape, {0}); auto offset = op::Constant::create(output_type, scale_offset_shape, {0});
auto quantize = auto quantize = make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
auto f = make_shared<Function>(quantize, ParameterVector{X}); auto f = make_shared<Function>(quantize, ParameterVector{X});
std::vector<input_c_type> x{9, 10, 11, -9, -10, -11, 13, 14, 15, -13, -14, -15}; std::vector<input_c_type> x{9, 10, 11, -9, -10, -11, 13, 14, 15, -13, -14, -15};
@ -378,13 +351,11 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_NEAREST_TOWARD_ZERO)
auto test_case = test::TestCase<TestEngine>(f); auto test_case = test::TestCase<TestEngine>(f);
test_case.add_input<input_c_type>({x}); test_case.add_input<input_c_type>({x});
test_case.add_expected_output<output_c_type>(input_shape, test_case.add_expected_output<output_c_type>(input_shape, {2, 2, 3, -2, -2, -3, 3, 3, 4, -3, -3, -4});
{2, 2, 3, -2, -2, -3, 3, 3, 4, -3, -3, -4});
test_case.run(); test_case.run();
} }
NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_NEAREST_TOWARD_INFINITY) NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_NEAREST_TOWARD_INFINITY) {
{
Shape input_shape{4, 3}; Shape input_shape{4, 3};
Shape scale_offset_shape; Shape scale_offset_shape;
AxisSet quantization_axes; AxisSet quantization_axes;
@ -400,8 +371,7 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_NEAREST_TOWARD_INFINITY)
auto X = make_shared<op::Parameter>(input_type, input_shape); auto X = make_shared<op::Parameter>(input_type, input_shape);
auto scale = op::Constant::create(input_type, scale_offset_shape, {4}); auto scale = op::Constant::create(input_type, scale_offset_shape, {4});
auto offset = op::Constant::create(output_type, scale_offset_shape, {0}); auto offset = op::Constant::create(output_type, scale_offset_shape, {0});
auto quantize = auto quantize = make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
auto f = make_shared<Function>(quantize, ParameterVector{X}); auto f = make_shared<Function>(quantize, ParameterVector{X});
std::vector<input_c_type> x{9, 10, 11, -9, -10, -11, 13, 14, 15, -13, -14, -15}; std::vector<input_c_type> x{9, 10, 11, -9, -10, -11, 13, 14, 15, -13, -14, -15};
@ -410,13 +380,11 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_NEAREST_TOWARD_INFINITY)
auto test_case = test::TestCase<TestEngine>(f); auto test_case = test::TestCase<TestEngine>(f);
test_case.add_input<input_c_type>({x}); test_case.add_input<input_c_type>({x});
test_case.add_expected_output<output_c_type>(input_shape, test_case.add_expected_output<output_c_type>(input_shape, {2, 3, 3, -2, -3, -3, 3, 4, 4, -3, -4, -4});
{2, 3, 3, -2, -3, -3, 3, 4, 4, -3, -4, -4});
test_case.run(); test_case.run();
} }
NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_NEAREST_UPWARD) NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_NEAREST_UPWARD) {
{
Shape input_shape{4, 3}; Shape input_shape{4, 3};
Shape scale_offset_shape; Shape scale_offset_shape;
AxisSet quantization_axes; AxisSet quantization_axes;
@ -432,8 +400,7 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_NEAREST_UPWARD)
auto X = make_shared<op::Parameter>(input_type, input_shape); auto X = make_shared<op::Parameter>(input_type, input_shape);
auto scale = op::Constant::create(input_type, scale_offset_shape, {4}); auto scale = op::Constant::create(input_type, scale_offset_shape, {4});
auto offset = op::Constant::create(output_type, scale_offset_shape, {0}); auto offset = op::Constant::create(output_type, scale_offset_shape, {0});
auto quantize = auto quantize = make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
auto f = make_shared<Function>(quantize, ParameterVector{X}); auto f = make_shared<Function>(quantize, ParameterVector{X});
std::vector<input_c_type> x{9, 10, 11, -9, -10, -11, 13, 14, 15, -13, -14, -15}; std::vector<input_c_type> x{9, 10, 11, -9, -10, -11, 13, 14, 15, -13, -14, -15};
@ -442,13 +409,11 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_NEAREST_UPWARD)
auto test_case = test::TestCase<TestEngine>(f); auto test_case = test::TestCase<TestEngine>(f);
test_case.add_input<input_c_type>({x}); test_case.add_input<input_c_type>({x});
test_case.add_expected_output<output_c_type>(input_shape, test_case.add_expected_output<output_c_type>(input_shape, {2, 3, 3, -2, -2, -3, 3, 4, 4, -3, -3, -4});
{2, 3, 3, -2, -2, -3, 3, 4, 4, -3, -3, -4});
test_case.run(); test_case.run();
} }
NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_NEAREST_DOWNWARD) NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_NEAREST_DOWNWARD) {
{
Shape input_shape{4, 3}; Shape input_shape{4, 3};
Shape scale_offset_shape; Shape scale_offset_shape;
AxisSet quantization_axes; AxisSet quantization_axes;
@ -464,8 +429,7 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_NEAREST_DOWNWARD)
auto X = make_shared<op::Parameter>(input_type, input_shape); auto X = make_shared<op::Parameter>(input_type, input_shape);
auto scale = op::Constant::create(input_type, scale_offset_shape, {4}); auto scale = op::Constant::create(input_type, scale_offset_shape, {4});
auto offset = op::Constant::create(output_type, scale_offset_shape, {0}); auto offset = op::Constant::create(output_type, scale_offset_shape, {0});
auto quantize = auto quantize = make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
auto f = make_shared<Function>(quantize, ParameterVector{X}); auto f = make_shared<Function>(quantize, ParameterVector{X});
std::vector<input_c_type> x{9, 10, 11, -9, -10, -11, 13, 14, 15, -13, -14, -15}; std::vector<input_c_type> x{9, 10, 11, -9, -10, -11, 13, 14, 15, -13, -14, -15};
@ -474,13 +438,11 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_NEAREST_DOWNWARD)
auto test_case = test::TestCase<TestEngine>(f); auto test_case = test::TestCase<TestEngine>(f);
test_case.add_input<input_c_type>({x}); test_case.add_input<input_c_type>({x});
test_case.add_expected_output<output_c_type>(input_shape, test_case.add_expected_output<output_c_type>(input_shape, {2, 2, 3, -2, -3, -3, 3, 3, 4, -3, -4, -4});
{2, 2, 3, -2, -3, -3, 3, 3, 4, -3, -4, -4});
test_case.run(); test_case.run();
} }
NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_NEAREST_TOWARD_EVEN) NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_NEAREST_TOWARD_EVEN) {
{
Shape input_shape{4, 3}; Shape input_shape{4, 3};
Shape scale_offset_shape; Shape scale_offset_shape;
AxisSet quantization_axes; AxisSet quantization_axes;
@ -496,8 +458,7 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_NEAREST_TOWARD_EVEN)
auto X = make_shared<op::Parameter>(input_type, input_shape); auto X = make_shared<op::Parameter>(input_type, input_shape);
auto scale = op::Constant::create(input_type, scale_offset_shape, {4}); auto scale = op::Constant::create(input_type, scale_offset_shape, {4});
auto offset = op::Constant::create(output_type, scale_offset_shape, {0}); auto offset = op::Constant::create(output_type, scale_offset_shape, {0});
auto quantize = auto quantize = make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
auto f = make_shared<Function>(quantize, ParameterVector{X}); auto f = make_shared<Function>(quantize, ParameterVector{X});
std::vector<input_c_type> x{9, 10, 11, -9, -10, -11, 13, 14, 15, -13, -14, -15}; std::vector<input_c_type> x{9, 10, 11, -9, -10, -11, 13, 14, 15, -13, -14, -15};
@ -506,13 +467,11 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_NEAREST_TOWARD_EVEN)
auto test_case = test::TestCase<TestEngine>(f); auto test_case = test::TestCase<TestEngine>(f);
test_case.add_input<input_c_type>({x}); test_case.add_input<input_c_type>({x});
test_case.add_expected_output<output_c_type>(input_shape, test_case.add_expected_output<output_c_type>(input_shape, {2, 2, 3, -2, -2, -3, 3, 4, 4, -3, -4, -4});
{2, 2, 3, -2, -2, -3, 3, 4, 4, -3, -4, -4});
test_case.run(); test_case.run();
} }
NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_TOWARD_INFINITY) NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_TOWARD_INFINITY) {
{
Shape input_shape{4, 3}; Shape input_shape{4, 3};
Shape scale_offset_shape; Shape scale_offset_shape;
AxisSet quantization_axes; AxisSet quantization_axes;
@ -528,8 +487,7 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_TOWARD_INFINITY)
auto X = make_shared<op::Parameter>(input_type, input_shape); auto X = make_shared<op::Parameter>(input_type, input_shape);
auto scale = op::Constant::create(input_type, scale_offset_shape, {4}); auto scale = op::Constant::create(input_type, scale_offset_shape, {4});
auto offset = op::Constant::create(output_type, scale_offset_shape, {0}); auto offset = op::Constant::create(output_type, scale_offset_shape, {0});
auto quantize = make_shared<op::Quantize>( auto quantize = make_shared<op::Quantize>(X,
X,
scale, scale,
offset, offset,
output_type, output_type,
@ -543,13 +501,11 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_TOWARD_INFINITY)
auto test_case = test::TestCase<TestEngine>(f); auto test_case = test::TestCase<TestEngine>(f);
test_case.add_input<input_c_type>({x}); test_case.add_input<input_c_type>({x});
test_case.add_expected_output<output_c_type>(input_shape, test_case.add_expected_output<output_c_type>(input_shape, {3, 3, 3, -3, -3, -3, 4, 4, 4, -4, -4, -4});
{3, 3, 3, -3, -3, -3, 4, 4, 4, -4, -4, -4});
test_case.run(); test_case.run();
} }
NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_TOWARD_ZERO) NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_TOWARD_ZERO) {
{
Shape input_shape{4, 3}; Shape input_shape{4, 3};
Shape scale_offset_shape; Shape scale_offset_shape;
AxisSet quantization_axes; AxisSet quantization_axes;
@ -565,8 +521,7 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_TOWARD_ZERO)
auto X = make_shared<op::Parameter>(input_type, input_shape); auto X = make_shared<op::Parameter>(input_type, input_shape);
auto scale = op::Constant::create(input_type, scale_offset_shape, {4}); auto scale = op::Constant::create(input_type, scale_offset_shape, {4});
auto offset = op::Constant::create(output_type, scale_offset_shape, {0}); auto offset = op::Constant::create(output_type, scale_offset_shape, {0});
auto quantize = make_shared<op::Quantize>( auto quantize = make_shared<op::Quantize>(X,
X,
scale, scale,
offset, offset,
output_type, output_type,
@ -580,13 +535,11 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_TOWARD_ZERO)
auto test_case = test::TestCase<TestEngine>(f); auto test_case = test::TestCase<TestEngine>(f);
test_case.add_input<input_c_type>({x}); test_case.add_input<input_c_type>({x});
test_case.add_expected_output<output_c_type>(input_shape, test_case.add_expected_output<output_c_type>(input_shape, {2, 2, 2, -2, -2, -2, 3, 3, 3, -3, -3, -3});
{2, 2, 2, -2, -2, -2, 3, 3, 3, -3, -3, -3});
test_case.run(); test_case.run();
} }
NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_UP) NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_UP) {
{
Shape input_shape{4, 3}; Shape input_shape{4, 3};
Shape scale_offset_shape; Shape scale_offset_shape;
AxisSet quantization_axes; AxisSet quantization_axes;
@ -602,8 +555,7 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_UP)
auto X = make_shared<op::Parameter>(input_type, input_shape); auto X = make_shared<op::Parameter>(input_type, input_shape);
auto scale = op::Constant::create(input_type, scale_offset_shape, {4}); auto scale = op::Constant::create(input_type, scale_offset_shape, {4});
auto offset = op::Constant::create(output_type, scale_offset_shape, {0}); auto offset = op::Constant::create(output_type, scale_offset_shape, {0});
auto quantize = auto quantize = make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
auto f = make_shared<Function>(quantize, ParameterVector{X}); auto f = make_shared<Function>(quantize, ParameterVector{X});
std::vector<input_c_type> x{9, 10, 11, -9, -10, -11, 13, 14, 15, -13, -14, -15}; std::vector<input_c_type> x{9, 10, 11, -9, -10, -11, 13, 14, 15, -13, -14, -15};
@ -612,13 +564,11 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_UP)
auto test_case = test::TestCase<TestEngine>(f); auto test_case = test::TestCase<TestEngine>(f);
test_case.add_input<input_c_type>({x}); test_case.add_input<input_c_type>({x});
test_case.add_expected_output<output_c_type>(input_shape, test_case.add_expected_output<output_c_type>(input_shape, {3, 3, 3, -2, -2, -2, 4, 4, 4, -3, -3, -3});
{3, 3, 3, -2, -2, -2, 4, 4, 4, -3, -3, -3});
test_case.run(); test_case.run();
} }
NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_DOWN) NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_DOWN) {
{
Shape input_shape{4, 3}; Shape input_shape{4, 3};
Shape scale_offset_shape; Shape scale_offset_shape;
AxisSet quantization_axes; AxisSet quantization_axes;
@ -634,8 +584,7 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_DOWN)
auto X = make_shared<op::Parameter>(input_type, input_shape); auto X = make_shared<op::Parameter>(input_type, input_shape);
auto scale = op::Constant::create(input_type, scale_offset_shape, {4}); auto scale = op::Constant::create(input_type, scale_offset_shape, {4});
auto offset = op::Constant::create(output_type, scale_offset_shape, {0}); auto offset = op::Constant::create(output_type, scale_offset_shape, {0});
auto quantize = auto quantize = make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
auto f = make_shared<Function>(quantize, ParameterVector{X}); auto f = make_shared<Function>(quantize, ParameterVector{X});
std::vector<input_c_type> x{9, 10, 11, -9, -10, -11, 13, 14, 15, -13, -14, -15}; std::vector<input_c_type> x{9, 10, 11, -9, -10, -11, 13, 14, 15, -13, -14, -15};
@ -644,13 +593,11 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_ROUND_DOWN)
auto test_case = test::TestCase<TestEngine>(f); auto test_case = test::TestCase<TestEngine>(f);
test_case.add_input<input_c_type>({x}); test_case.add_input<input_c_type>({x});
test_case.add_expected_output<output_c_type>(input_shape, test_case.add_expected_output<output_c_type>(input_shape, {2, 2, 2, -3, -3, -3, 3, 3, 3, -4, -4, -4});
{2, 2, 2, -3, -3, -3, 3, 3, 3, -4, -4, -4});
test_case.run(); test_case.run();
} }
NGRAPH_TEST(${BACKEND_NAME}, quantize_dynamic_offset) NGRAPH_TEST(${BACKEND_NAME}, quantize_dynamic_offset) {
{
Shape input_shape{4, 3}; Shape input_shape{4, 3};
Shape scale_offset_shape = {}; Shape scale_offset_shape = {};
AxisSet quantization_axes; AxisSet quantization_axes;
@ -666,8 +613,7 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_dynamic_offset)
auto X = make_shared<op::Parameter>(input_type, input_shape); auto X = make_shared<op::Parameter>(input_type, input_shape);
auto scale = make_shared<op::Parameter>(input_type, scale_offset_shape); auto scale = make_shared<op::Parameter>(input_type, scale_offset_shape);
auto offset = make_shared<op::Parameter>(output_type, scale_offset_shape); auto offset = make_shared<op::Parameter>(output_type, scale_offset_shape);
auto quantize = auto quantize = make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
make_shared<op::Quantize>(X, scale, offset, output_type, quantization_axes, round_mode);
auto f = make_shared<Function>(quantize, ParameterVector{X, scale, offset}); auto f = make_shared<Function>(quantize, ParameterVector{X, scale, offset});
std::vector<input_c_type> x{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; std::vector<input_c_type> x{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};

View File

@ -2,12 +2,12 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/execute_tools.hpp"
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;

View File

@ -13,10 +13,10 @@
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "ngraph/opsets/opset4.hpp" #include "ngraph/opsets/opset4.hpp"
#include "util/engine/test_engines.hpp" #include "engines_util/test_engines.hpp"
#include "util/test_case.hpp" #include "engines_util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp" #include "engines_util/execute_tools.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;

View File

@ -4,10 +4,10 @@
#include <fstream> #include <fstream>
#include "engines_util/test_case.hpp"
#include "engines_util/test_engines.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp"
#include "util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
NGRAPH_SUPPRESS_DEPRECATED_START NGRAPH_SUPPRESS_DEPRECATED_START

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "engines_util/execute_tools.hpp"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "ngraph/runtime/tensor.hpp" #include "ngraph/runtime/tensor.hpp"
@ -10,7 +11,6 @@
#include "util/all_close_f.hpp" #include "util/all_close_f.hpp"
#include "util/ndarray.hpp" #include "util/ndarray.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/test_tools.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;

View File

@ -21,8 +21,8 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp" #include "engines_util/test_engines.hpp"
#include "util/test_case.hpp" #include "engines_util/test_case.hpp"
#include "util/test_control.hpp" #include "util/test_control.hpp"
#include "util/type_prop.hpp" #include "util/type_prop.hpp"

Some files were not shown because too many files have changed in this diff Show More