Skip to content

Commit

Permalink
Remove ngraph/type API (openvinotoolkit#22297)
Browse files Browse the repository at this point in the history
  • Loading branch information
praasz authored Jan 26, 2024
1 parent 20abada commit e1fcafc
Show file tree
Hide file tree
Showing 211 changed files with 2,144 additions and 2,058 deletions.
30 changes: 13 additions & 17 deletions docs/snippets/lpt_intel_cpu_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,16 @@ if (useLpt) {
// Low precision transformations plugin specific configuration: restrictions definition
auto supportedPrecisions = std::vector<PrecisionsRestriction>({
PrecisionsRestriction::create<ov::opset1::Convolution>({
{{0}, {ngraph::element::u8}},
{{1}, {ngraph::element::i8}},
}),
PrecisionsRestriction::create<ov::opset1::ConvolutionBackpropData>({
{{0}, {ngraph::element::u8, ngraph::element::i8}},
{{1}, {ngraph::element::i8}}
}),
PrecisionsRestriction::create<ov::opset1::GroupConvolution>({
{{0}, {ngraph::element::u8}},
{{1}, {ngraph::element::i8}}
{{0}, {ov::element::u8}},
{{1}, {ov::element::i8}},
}),
PrecisionsRestriction::create<ov::opset1::ConvolutionBackpropData>(
{{{0}, {ov::element::u8, ov::element::i8}}, {{1}, {ov::element::i8}}}),
PrecisionsRestriction::create<ov::opset1::GroupConvolution>(
{{{0}, {ov::element::u8}}, {{1}, {ov::element::i8}}}),
PrecisionsRestriction::create<ov::opset1::Multiply>({
{{0}, {ngraph::element::u8}},
{{1}, {ngraph::element::i8}},
{{0}, {ov::element::u8}},
{{1}, {ov::element::i8}},
}),
});

Expand Down Expand Up @@ -134,8 +130,8 @@ using namespace ov::pass::low_precision;
//! [lpt_supported_precisions]
auto supportedPrecisions = std::vector<PrecisionsRestriction>({
PrecisionsRestriction::create<ov::opset1::Convolution>({
{{0}, {ngraph::element::u8}},
{{1}, {ngraph::element::i8}},
{{0}, {ov::element::u8}},
{{1}, {ov::element::i8}},
}),
});

Expand Down Expand Up @@ -170,7 +166,7 @@ lptManager.run_passes(nGraphFunc);
return 0;
}

int asymmetric_quantization(const std::vector<ngraph::element::Type>& defaultPrecisions) {
int asymmetric_quantization(const std::vector<ov::element::Type>& defaultPrecisions) {
std::shared_ptr<ov::Model> nGraphFunc;
ov::pass::Manager manager;
auto pass_config = manager.get_pass_config();
Expand Down Expand Up @@ -198,8 +194,8 @@ using namespace ov::pass::low_precision;
//! [lpt_markup_pipeline]
auto supportedPrecisions = std::vector<PrecisionsRestriction>({
PrecisionsRestriction::create<ov::opset1::Convolution>({
{{0}, {ngraph::element::u8}},
{{1}, {ngraph::element::i8}},
{{0}, {ov::element::u8}},
{{1}, {ov::element::i8}},
}),
});

Expand Down
2 changes: 1 addition & 1 deletion src/core/include/ngraph/evaluator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "ngraph/deprecated.hpp"
#include "ngraph/node.hpp"
#include "ngraph/shape.hpp"
#include "ngraph/type/element_type_traits.hpp"
#include "openvino/core/type/element_type_traits.hpp"

namespace ngraph {
/// \brief Execute handlers on a subgraph to compute values
Expand Down
5 changes: 2 additions & 3 deletions src/core/include/ngraph/ngraph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,14 @@
#include "ngraph/factory.hpp"
#include "ngraph/function.hpp"
#include "ngraph/node.hpp"
#include "ngraph/ops.hpp"
#include "ngraph/partial_shape.hpp"
#include "ngraph/rt_info.hpp"
#include "ngraph/shape.hpp"
#include "ngraph/specialize_function.hpp"
#include "ngraph/type/element_type.hpp"
#include "openvino/core/descriptor/input.hpp"
#include "openvino/core/descriptor/output.hpp"
#include "openvino/core/descriptor/tensor.hpp"
#include "openvino/core/type/element_type.hpp"

// nGraph opsets
#include "ngraph/opsets/opset.hpp"
#include "ngraph/opsets/opset.hpp"
21 changes: 0 additions & 21 deletions src/core/include/ngraph/type/bfloat16.hpp

This file was deleted.

64 changes: 0 additions & 64 deletions src/core/include/ngraph/type/element_type.hpp

This file was deleted.

24 changes: 0 additions & 24 deletions src/core/include/ngraph/type/element_type_traits.hpp

This file was deleted.

21 changes: 0 additions & 21 deletions src/core/include/ngraph/type/float16.hpp

This file was deleted.

10 changes: 5 additions & 5 deletions src/core/include/ngraph/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
#include "ngraph/graph_util.hpp"
#include "ngraph/node.hpp"
#include "ngraph/shape.hpp"
#include "ngraph/type/element_type.hpp"
#include "ngraph/type/element_type_traits.hpp"
#include "openvino/core/enum_mask.hpp"
#include "openvino/core/type/element_type.hpp"
#include "openvino/core/type/element_type_traits.hpp"
#include "openvino/runtime/tensor.hpp"

namespace ov {
Expand Down Expand Up @@ -255,7 +255,7 @@ NGRAPH_API_DEPRECATED T double_to_int(double x, double float_to_int_converter(do

template <typename T>
NGRAPH_API_DEPRECATED std::vector<T> read_vector(std::shared_ptr<ov::Tensor> tv) {
if (ngraph::element::from<T>() != tv->get_element_type()) {
if (ov::element::from<T>() != tv->get_element_type()) {
OPENVINO_THROW("read_vector type must match Tensor type");
}
size_t element_count = ngraph::shape_size(tv->get_shape());
Expand All @@ -265,8 +265,8 @@ NGRAPH_API_DEPRECATED std::vector<T> read_vector(std::shared_ptr<ov::Tensor> tv)
return rc;
}

template <class T, ngraph::element::Type_t ET>
NGRAPH_API_DEPRECATED std::vector<T> array_2_vector(typename ngraph::element_type_traits<ET>::value_type* data,
template <class T, ov::element::Type_t ET>
NGRAPH_API_DEPRECATED std::vector<T> array_2_vector(typename ov::element_type_traits<ET>::value_type* data,
size_t size) {
std::vector<T> result(size);
for (size_t i = 0; i < size; i++) {
Expand Down
5 changes: 5 additions & 0 deletions src/core/include/ngraph/validation_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ using ov::normalize_axes;
using ov::normalize_axis;
using ov::op::v0::Constant;

namespace element {
using ov::element::Type;
using ov::element::Type_t;
} // namespace element

NGRAPH_API_DEPRECATED
NGRAPH_API
Strides conv_default_strides(const Node* node,
Expand Down
8 changes: 4 additions & 4 deletions src/core/src/graph_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
//

#include "ngraph/graph_util.hpp"
#include "openvino/core/graph_util.hpp"

#include <numeric>
#include <unordered_map>
Expand Down Expand Up @@ -609,18 +609,18 @@ void insert_new_node_between(const std::shared_ptr<Node>& src_node,
dst_input.replace_source_output(new_node->output(0)); // Remove [0] (again), add [8], remove [1], add [9]
}

std::shared_ptr<ov::Node> make_zero(const element::Type& element_type, const Shape& shape) {
std::shared_ptr<ov::Node> make_zero(const ov::element::Type& element_type, const Shape& shape) {
auto zero = ov::op::v0::Constant::create(element_type, Shape{}, {0.0});
if (shape.size() > 0) {
return std::make_shared<ov::op::v1::Broadcast>(
zero,
ov::op::v0::Constant::create(element::u64, Shape{shape.size()}, shape));
ov::op::v0::Constant::create(ov::element::u64, Shape{shape.size()}, shape));
}
return zero;
}

std::shared_ptr<ov::Node> make_constant_from_string(std::string val,
const element::Type& element_type,
const ov::element::Type& element_type,
const Shape& shape) {
auto cvals = std::vector<std::string>(shape_size(shape), val);
return std::make_shared<ov::op::v0::Constant>(element_type, shape, cvals);
Expand Down
45 changes: 23 additions & 22 deletions src/core/src/validation_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -819,31 +819,32 @@ std::shared_ptr<op::v0::Constant> get_constant_min_of_type(element::Type_t t) {
}

std::shared_ptr<op::v0::Constant> get_constant_lowest_of_type(element::Type_t t) {
#define OPENVINO_TYPE_TO_LOWEST_CONST(t) \
case t: \
return op::v0::Constant::create(t, \
{}, \
{std::numeric_limits<typename element_type_traits<t>::value_type>::lowest()}); \
#define OPENVINO_TYPE_TO_LOWEST_CONST(t) \
case t: \
return op::v0::Constant::create( \
t, \
{}, \
{std::numeric_limits<typename ov::element_type_traits<t>::value_type>::lowest()}); \
break

switch (t) {
OPENVINO_TYPE_TO_LOWEST_CONST(element::boolean);
OPENVINO_TYPE_TO_LOWEST_CONST(element::bf16);
OPENVINO_TYPE_TO_LOWEST_CONST(element::f16);
OPENVINO_TYPE_TO_LOWEST_CONST(element::f32);
OPENVINO_TYPE_TO_LOWEST_CONST(element::f64);
OPENVINO_TYPE_TO_LOWEST_CONST(element::i8);
OPENVINO_TYPE_TO_LOWEST_CONST(element::i16);
OPENVINO_TYPE_TO_LOWEST_CONST(element::i32);
OPENVINO_TYPE_TO_LOWEST_CONST(element::i64);
OPENVINO_TYPE_TO_LOWEST_CONST(element::u1);
OPENVINO_TYPE_TO_LOWEST_CONST(element::u8);
OPENVINO_TYPE_TO_LOWEST_CONST(element::u16);
OPENVINO_TYPE_TO_LOWEST_CONST(element::u32);
OPENVINO_TYPE_TO_LOWEST_CONST(element::u64);

case element::undefined:
case element::dynamic:
OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::boolean);
OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::bf16);
OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::f16);
OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::f32);
OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::f64);
OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::i8);
OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::i16);
OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::i32);
OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::i64);
OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::u1);
OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::u8);
OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::u16);
OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::u32);
OPENVINO_TYPE_TO_LOWEST_CONST(ov::element::u64);

case ov::element::undefined:
case ov::element::dynamic:
default:
return nullptr;
}
Expand Down
1 change: 1 addition & 0 deletions src/core/tests/specialize_function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "openvino/op/convert.hpp"

using namespace ngraph;
using namespace ov;
NGRAPH_SUPPRESS_DEPRECATED_START;

using ov::op::v0::Constant;
Expand Down
4 changes: 2 additions & 2 deletions src/frontends/onnx/docs/how_to_add_op.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ OutputVector custom_add(const Node& node) {
const auto in2 = node.get_ng_inputs().at(1);
const auto alpha = node.get_attribute_value<float>("alpha", 1);
const auto alpha_node =
std::make_shared<default_opset::Convert>(default_opset::Constant::create(element::f32, {}, {alpha}),
std::make_shared<default_opset::Convert>(default_opset::Constant::create( ov::element::f32, {}, {alpha}),
in1.get_element_type());
const auto add = std::make_shared<default_opset::Add>(in1, in2);
Expand Down Expand Up @@ -104,4 +104,4 @@ fe.add_extension(OpExtension("opset9.Add", "CustomAdd", "org.openvinotoolkit", {
## See also
* [OpenVINO ONNX Frontend README](../README.md)
* [OpenVINO™ README](../../../../README.md)
* [Developer documentation](../../../../docs/dev/index.md)
* [Developer documentation](../../../../docs/dev/index.md)
Loading

0 comments on commit e1fcafc

Please sign in to comment.