namespace ov¶
Overview¶
transformation aligns elementwise constant inputs ranks with its output rank More…
namespace ov {
// namespaces
namespace ov::batch_util;
namespace ov::cmp;
namespace ov::coordinates;
namespace ov::descriptor;
namespace ov::detail;
namespace ov::device;
namespace ov::device::capability;
namespace ov::element;
namespace ov::exec_model_info;
namespace ov::frontend;
namespace ov::frontend::tensorflow;
namespace ov::frontend::type;
namespace ov::helpers;
namespace ov::hint;
namespace ov::intel_auto;
namespace ov::intel_cpu;
namespace ov::intel_gna;
namespace ov::intel_gpu;
namespace ov::intel_gpu::capability;
namespace ov::intel_gpu::hint;
namespace ov::intel_gpu::memory_type;
namespace ov::intel_gpu::ocl;
namespace ov::internal;
namespace ov::itt;
namespace ov::itt::domains;
namespace ov::layout;
namespace ov::legacy_convert;
namespace ov::log;
namespace ov::op;
namespace ov::op::ShapeInferRange;
namespace ov::op::convolution;
namespace ov::op::convolution::validate;
namespace ov::op::deformable_conv;
namespace ov::op::deformable_conv::validate;
namespace ov::op::detectron;
namespace ov::op::detectron::validate;
namespace ov::op::eye;
namespace ov::op::fft;
namespace ov::op::gather_nd;
namespace ov::op::internal;
namespace ov::op::interpolate;
namespace ov::op::interpolate::validate;
namespace ov::op::multiclass_nms;
namespace ov::op::multiclass_nms::validate;
namespace ov::op::multinomial;
namespace ov::op::multinomial::validate;
namespace ov::op::nms;
namespace ov::op::nms::validate;
namespace ov::op::pad;
namespace ov::op::pooling;
namespace ov::op::pooling::validate;
namespace ov::op::prior_box;
namespace ov::op::prior_box::validate;
namespace ov::op::proposal;
namespace ov::op::psroi_pooling;
namespace ov::op::psroi_pooling::validate;
namespace ov::op::reshape;
namespace ov::op::rnn;
namespace ov::op::roi_align;
namespace ov::op::roi_align::validate;
namespace ov::op::roi_pooling;
namespace ov::op::roi_pooling::validate;
namespace ov::op::shape_of;
namespace ov::op::slice;
namespace ov::op::util;
namespace ov::op::util::detail;
namespace ov::op::util::embedding;
namespace ov::op::util::error;
namespace ov::op::util::fft_common_validation;
namespace ov::op::v0;
namespace ov::op::v0::lstm_cell;
namespace ov::op::v1;
namespace ov::op::v10;
namespace ov::op::v11;
namespace ov::op::v12;
namespace ov::op::v13;
namespace ov::op::v3;
namespace ov::op::v4;
namespace ov::op::v4::ctc_loss;
namespace ov::op::v4::lstm_cell;
namespace ov::op::v5;
namespace ov::op::v6;
namespace ov::op::v7;
namespace ov::op::v8;
namespace ov::op::v9;
namespace ov::op::validate;
namespace ov::opset1;
namespace ov::opset10;
namespace ov::opset11;
namespace ov::opset12;
namespace ov::opset13;
namespace ov::opset2;
namespace ov::opset3;
namespace ov::opset4;
namespace ov::opset5;
namespace ov::opset6;
namespace ov::opset7;
namespace ov::opset8;
namespace ov::opset9;
namespace ov::pass;
namespace ov::pass::low_precision;
namespace ov::pass::low_precision::itt;
namespace ov::pass::low_precision::itt::domains;
namespace ov::pass::low_precision::precision_set;
namespace ov::pass::pattern;
namespace ov::pass::pattern::op;
namespace ov::pass::transpose_sinking;
namespace ov::pass::transpose_sinking::utils;
namespace ov::pass::transpose_sinking::utils::sink_backward;
namespace ov::pass::transpose_sinking::utils::sink_forward;
namespace ov::preprocess;
namespace ov::proxy;
namespace ov::reference;
namespace ov::reference::adaptive_pool;
namespace ov::reference::detail;
namespace ov::reference::details;
namespace ov::reference::fake_quantize_details;
namespace ov::reference::fft_common;
namespace ov::reference::func;
namespace ov::reference::internal;
namespace ov::reference::interpolate_pil;
namespace ov::reference::iou_rotated;
namespace ov::reference::kernel;
namespace ov::reference::multinomial;
namespace ov::reference::nms_common;
namespace ov::runtime;
namespace ov::streams;
namespace ov::symbol;
namespace ov::symbol::util;
namespace ov::threading;
namespace ov::util;
namespace ov::util::dim;
// structs
struct CheckLocInfo;
struct DiscreteTypeInfo;
struct MemBandwidthPressure;
struct ProfilingInfo;
template <typename T>
struct Property<T, PropertyMutability::RO>;
struct PropertyName;
struct RawNodeOutput;
template <class T>
struct SoPtr;
struct TensorTransform;
struct Version;
template <>
struct element_type_traits<element::Type_t::i4>;
template <>
struct element_type_traits<element::Type_t::f32>;
template <>
struct element_type_traits<element::Type_t::i32>;
template <>
struct element_type_traits<element::Type_t::u8>;
template <>
struct element_type_traits<element::Type_t::f16>;
template <>
struct element_type_traits<element::Type_t::bf16>;
template <>
struct element_type_traits<element::Type_t::boolean>;
template <element::Type_t>
struct element_type_traits;
template <>
struct element_type_traits<element::Type_t::u64>;
template <>
struct element_type_traits<element::Type_t::f64>;
template <>
struct element_type_traits<element::Type_t::u32>;
template <>
struct element_type_traits<element::Type_t::u4>;
template <>
struct element_type_traits<element::Type_t::i64>;
template <>
struct element_type_traits<element::Type_t::i8>;
template <>
struct element_type_traits<element::Type_t::u16>;
template <>
struct element_type_traits<element::Type_t::u1>;
template <>
struct element_type_traits<element::Type_t::i16>;
template <>
struct element_type_traits<element::Type_t::nf4>;
template <>
struct result_shape<PartialShape>;
template <>
struct result_shape<ov::Shape>;
template <class TShape>
struct result_shape;
// templates
template AllocatorImpl;
template ICore;
template IVariableState;
// classes
class Allocator;
class Any;
class AssertFailure;
template <>
class AttributeAdapter<ov::op::util::FrameworkNodeAttrs>;
template <>
class AttributeAdapter<ov::NodeVector>;
template <>
class AttributeAdapter<ov::PartialShape>;
template <>
class AttributeAdapter<ov::Shape>;
template <>
class AttributeAdapter<ParameterVector>;
template <>
class AttributeAdapter<ResultVector>;
template <>
class AttributeAdapter<ov::element::TypeVector>;
template <>
class AttributeAdapter<std::shared_ptr<ngraph::runtime::AlignedBuffer>>;
template <>
class AttributeAdapter<std::set<std::string>>;
template <>
class AttributeAdapter<ov::element::Type_t>;
template <>
class AttributeAdapter<ov::element::Type>;
template <>
class AttributeAdapter<ov::Dimension>;
template <>
class AttributeAdapter<op::v9::GridSample::PaddingMode>;
template <>
class AttributeAdapter<op::v9::GridSample::InterpolationMode>;
template <>
class AttributeAdapter<op::v8::MatrixNms::SortResultType>;
template <>
class AttributeAdapter<std::shared_ptr<op::util::Variable>>;
template <>
class AttributeAdapter<op::v9::NonMaxSuppression::BoxEncodingType>;
template <>
class AttributeAdapter<op::v9::ROIAlign::PoolingMode>;
template <>
class AttributeAdapter<op::v9::ROIAlign::AlignedMode>;
template <>
class AttributeAdapter<ov::AxisSet>;
template <>
class AttributeAdapter<std::shared_ptr<ov::Model>>;
template <>
class AttributeAdapter<std::shared_ptr<ov::Node>>;
template <>
class AttributeAdapter<std::string>;
template <>
class AttributeAdapter<Strides>;
template <>
class AttributeAdapter<std::vector<uint8_t>>;
template <>
class AttributeAdapter<std::vector<uint64_t>>;
template <>
class AttributeAdapter<std::vector<uint32_t>>;
template <>
class AttributeAdapter<uint16_t>;
template <>
class AttributeAdapter<uint64_t>;
template <>
class AttributeAdapter<uint32_t>;
template <>
class AttributeAdapter<uint8_t>;
template <>
class AttributeAdapter<op::v8::MatrixNms::DecayFunction>;
template <>
class AttributeAdapter<std::vector<uint16_t>>;
template <>
class AttributeAdapter<std::vector<std::shared_ptr<op::util::MultiSubGraphOp::OutputDescription>>>;
template <>
class AttributeAdapter<std::vector<int16_t>>;
template <>
class AttributeAdapter<std::vector<float>>;
template <>
class AttributeAdapter<std::vector<double>>;
template <>
class AttributeAdapter<std::vector<std::string>>;
template <>
class AttributeAdapter<std::vector<int32_t>>;
template <>
class AttributeAdapter<std::vector<int8_t>>;
template <>
class AttributeAdapter<std::vector<int64_t>>;
template <>
class AttributeAdapter<std::vector<std::shared_ptr<op::util::MultiSubGraphOp::InputDescription>>>;
template <>
class AttributeAdapter<op::v5::Round::RoundMode>;
template <>
class AttributeAdapter<op::v5::NonMaxSuppression::BoxEncodingType>;
template <>
class AttributeAdapter<op::v5::Loop::SpecialBodyPorts>;
template <>
class AttributeAdapter<op::AutoBroadcastSpec>;
template <>
class AttributeAdapter<ngraph::reduction::Type>;
template <>
class AttributeAdapter<Layout>;
template <>
class AttributeAdapter<int8_t>;
template <>
class AttributeAdapter<op::AutoBroadcastType>;
template <>
class AttributeAdapter<op::BroadcastType>;
template <>
class AttributeAdapter<op::BroadcastModeSpec>;
template <>
class AttributeAdapter<op::EpsMode>;
template <>
class AttributeAdapter<op::GeluApproximationMode>;
template <>
class AttributeAdapter<int64_t>;
template <>
class AttributeAdapter<int16_t>;
template <>
class AttributeAdapter<bool>;
template <>
class AttributeAdapter<AxisVector>;
template <typename AT>
class AttributeAdapter;
template <>
class AttributeAdapter<int32_t>;
template <>
class AttributeAdapter<Coordinate>;
template <>
class AttributeAdapter<double>;
template <>
class AttributeAdapter<CoordinateDiff>;
template <>
class AttributeAdapter<float>;
template <>
class AttributeAdapter<op::MVNEpsMode>;
template <>
class AttributeAdapter<op::LSTMWeightsFormat>;
template <>
class AttributeAdapter<op::v0::DepthToSpace::DepthToSpaceMode>;
template <>
class AttributeAdapter<op::v12::ScatterElementsUpdate::Reduction>;
template <>
class AttributeAdapter<op::v0::SpaceToDepth::SpaceToDepthMode>;
template <>
class AttributeAdapter<op::v0::Interpolate::InterpolateMode>;
template <>
class AttributeAdapter<op::PadMode>;
template <>
class AttributeAdapter<op::v1::BinaryConvolution::BinaryConvolutionMode>;
template <>
class AttributeAdapter<op::v1::Reverse::Mode>;
template <>
class AttributeAdapter<op::v1::NonMaxSuppression::BoxEncodingType>;
template <>
class AttributeAdapter<op::v3::NonMaxSuppression::BoxEncodingType>;
template <>
class AttributeAdapter<op::v3::ROIAlign::PoolingMode>;
template <>
class AttributeAdapter<op::util::MulticlassNmsBase::SortResultType>;
template <>
class AttributeAdapter<op::util::InterpolateBase::NearestMode>;
template <>
class AttributeAdapter<op::RoundingType>;
template <>
class AttributeAdapter<op::RecurrentSequenceDirection>;
template <>
class AttributeAdapter<op::PadType>;
template <>
class AttributeAdapter<op::util::InterpolateBase::ShapeCalcMode>;
template <>
class AttributeAdapter<op::TopKMode>;
template <>
class AttributeAdapter<op::util::InterpolateBase::CoordinateTransformMode>;
template <>
class AttributeAdapter<op::TopKSortType>;
template <>
class AttributeAdapter<op::util::InterpolateBase::InterpolateMode>;
class AttributeVisitor;
class AvgPoolPrecisionPreservedAttribute;
class AxisSet;
class AxisVector;
class BaseOpExtension;
class BiasAttribute;
class Busy;
class Cancelled;
class CompiledModel;
class Coordinate;
class CoordinateDiff;
class CoordinateIterator;
class CoordinateTransform;
class CoordinateTransformBasic;
class Core;
class Decompression;
class DequantizationNode;
class DeviceIDParser;
class Dimension;
template <typename AT>
class DirectValueAccessor;
class DisableCleanupAttribute;
class DisableFP16Compression;
template <typename AT>
class EnumAttributeAdapterBase;
template <typename T>
class EnumMask;
template <typename EnumType>
class EnumNames;
class Exception;
class Extension;
class FusedNames;
class IAsyncInferRequest;
class ICompiledModel;
class IInferRequest;
class IPlugin;
class IRemoteContext;
class IRemoteTensor;
class ISyncInferRequest;
class ITensorAccessor;
template <typename AT, typename VAT>
class IndirectScalarValueAccessor;
template <typename AT, typename VAT>
class IndirectVectorValueAccessor;
class InferRequest;
template <typename NodeType>
class Input;
template <>
class Input<const Node>;
template <>
class Input<Node>;
class Interval;
class IntervalsAlignmentAttribute;
class IntervalsAlignmentSharedValue;
class KeepConstPrecision;
class Layout;
class LayoutAttribute;
class MappedMemory;
class Mask;
class Model;
class NmsSelectedIndices;
class NoTransposeSinkingAttr;
class Node;
class NodeValidationFailure;
class NonconvertibleDivide;
class NotImplemented;
class OldApiMapElementType;
class OldApiMapOrder;
template <class T>
class OpExtension;
class OpSet;
template <>
class Output<Node>;
template <>
class Output<const Node>;
template <typename NodeType>
class Output;
class PartialShape;
class PrecisionPreservedAttribute;
class PrecisionSensitive;
class PrecisionsAttribute;
class PreprocessingAttribute;
class PrimitivesPriority;
template <typename T, PropertyMutability mutability_ = PropertyMutability::RW>
class Property;
class QuantizationAlignmentAttribute;
class QuantizationGranularityAttribute;
class QuantizationModeAttribute;
class RemoteBlobTensor;
class RemoteContext;
class RemoteTensor;
class RoundingGuard;
class RuntimeAttribute;
template <class T, Direction D = Direction::FORWARD>
class SeqGen;
class Shape;
class ShapeSubgraph;
class Strides;
class StridesPropagation;
class SymbolicInfo;
class Tensor;
template <class TContainer>
class TensorAccessor;
class TensorRemoteBlob;
template <>
class ValueAccessor<void \*>;
template <>
class ValueAccessor<void>;
template <typename VAT>
class ValueAccessor;
class VariableState;
class VisitorAdapter;
class bfloat16;
class float16;
template <class T>
class optional;
// global functions
LP_TRANSFORMATIONS_API void mark_as_bias(const std::shared_ptr<Node>& node);
LP_TRANSFORMATIONS_API bool marked_as_bias(const std::shared_ptr<const Node>& node);
std::ostream& operator << (std::ostream& out, const Mask& mask);
Mask::Ptr getMask(const Output<const Node>& output);
Mask::Ptr getMask(const Output<Node>& output);
void setMask(Output<Node> output, const Mask::Ptr& mask);
void setMask(Input<Node> node, const Mask::Ptr& mask);
void mark_as_decompression(const std::shared_ptr<Node>& node);
void unmark_as_decompression(const std::shared_ptr<Node>& node);
bool is_decompression(const std::shared_ptr<Node>& node);
void mark_as_dequantization_node(const std::shared_ptr<Node>& node);
bool is_dequantization_node(const std::shared_ptr<Node>& node);
void disable_fp16_compression(const std::shared_ptr<Node>& node);
void enable_fp16_compression(const std::shared_ptr<Node>& node);
bool fp16_compression_is_disabled(const std::shared_ptr<const Node>& node);
void postpone_fp16_compression(RTMap& rt_info);
bool is_fp16_compression_postponed(const RTMap& rt_info);
void do_not_postpone_fp16_compression(RTMap& rt_info);
std::string getFusedNames(const std::shared_ptr<ov::Node>& node);
std::vector<std::string> getFusedNamesVector(const std::shared_ptr<ov::Node>& node);
void mark_shape_subgraph(const std::shared_ptr<Node>& node);
void unmark_shape_subgraph(const std::shared_ptr<Node>& node);
bool is_shape_subgraph(const std::shared_ptr<const Node>& node);
void enable_keep_const_precision(const std::shared_ptr<Node>& node);
void disable_keep_const_precision(const std::shared_ptr<Node>& node);
bool is_keep_const_precision(const std::shared_ptr<const Node>& node);
bool has_nms_selected_indices(const Node \* node);
void set_nms_selected_indices(Node \* node);
void disable_divide_conversion(const std::shared_ptr<Node>& node);
void enable_divide_conversion(const std::shared_ptr<Node>& node);
bool divide_is_nonconvertible(const std::shared_ptr<Node>& node);
bool has_old_api_map_element_type(const std::shared_ptr<Node>& node);
OldApiMapElementType get_old_api_map_element_type(const std::shared_ptr<Node>& node);
void set_old_api_map_element_type(
const std::shared_ptr<Node>& node,
const OldApiMapElementType& old_api_map
);
bool has_old_api_map_order(const std::shared_ptr<Node>& node);
OldApiMapOrder get_old_api_map_order(const std::shared_ptr<Node>& node);
void set_old_api_map_order(
std::shared_ptr<Node>& node,
const OldApiMapOrder& old_api_map
);
bool is_preprocesing_node(const std::shared_ptr<Node>& node);
void set_is_preprocessing_node(std::shared_ptr<Node> node);
std::string getPrimitivesPriority(const std::shared_ptr<Node>& node);
bool has_strides_prop(const Input<Node>& node);
ov::Strides get_strides_prop(const Input<Node>& node);
void insert_strides_prop(Input<Node>& node, const Strides& strides);
void remove_strides_prop(Input<Node>& node);
void mark_as_no_sinking_node(const std::shared_ptr<Node>& node);
void reset_no_sinking_attribute(const std::shared_ptr<Node>& node);
bool is_sinking_node(const std::shared_ptr<Node>& node);
bool is_sinking_node(const Node \* node);
bool is_sinking_node(ov::Output<ov::Node> output);
std::shared_ptr<ov::MappedMemory> load_mmap_object(const std::string& path);
template <typename A, typename B>
A copy_from(B& b);
OPENVINO_API std::ostream& operator << (std::ostream& s, const AxisSet& axis_set);
OPENVINO_API std::ostream& operator << (
std::ostream& s,
const AxisVector& axis_vector
);
OPENVINO_API std::ostream& operator << (
std::ostream& s,
const Coordinate& coordinate
);
OPENVINO_API std::ostream& operator << (
std::ostream& s,
const CoordinateDiff& coordinate_diff
);
OPENVINO_API std::ostream& operator << (
std::ostream& str,
const Dimension& dimension
);
template <typename Type, typename Value>
std::enable_if<std::is_convertible<Value, std::string>::value, Type>::type as_enum(const Value& value);
template <typename Value>
const std::string& as_string(Value value);
static std::ostream& write_all_to_stream(std::ostream& str);
template <typename T, typename... TS>
static std::ostream& write_all_to_stream(
std::ostream& str,
const T& arg,
TS&&... args
);
template <class T>
static std::string stringify(T&& arg);
void create_extensions(std::vector<Extension::Ptr>&);
OPENVINO_API void traverse_nodes(
const std::shared_ptr<const Model>& p,
const std::function<void(const std::shared_ptr<Node>&)>& f
);
OPENVINO_API void traverse_nodes(
const Model \* p,
const std::function<void(const std::shared_ptr<Node>&)>& f
);
OPENVINO_API void traverse_nodes(
const NodeVector& subgraph_results,
const std::function<void(const std::shared_ptr<Node>&)>& f,
const NodeVector& subgraph_params = {}
);
OPENVINO_API void replace_node(
const std::shared_ptr<Node>& target,
const std::shared_ptr<Node>& replacement,
const std::vector<int64_t>& output_order
);
OPENVINO_API void replace_node(
const std::shared_ptr<Node>& target,
const OutputVector& replacement_values
);
OPENVINO_API void replace_node(
const std::shared_ptr<Node>& target,
const std::shared_ptr<Node>& replacement
);
OPENVINO_API void replace_nodes(
const std::shared_ptr<Model>& f,
const std::unordered_map<std::shared_ptr<op::v0::Parameter>, std::shared_ptr<op::v0::Parameter>>& parameter_replacement_map,
const std::unordered_map<std::shared_ptr<Node>, std::shared_ptr<Node>>& body_replacement_map
);
template <typename T>
std::vector<std::shared_ptr<Node>> topological_sort(T root_nodes);
OPENVINO_API std::shared_ptr<ov::Model> clone_model(
const ov::Model& model,
std::unordered_map<Node \*, std::shared_ptr<Node>>& node_map
);
OPENVINO_API std::shared_ptr<ov::Model> clone_model(const ov::Model& model);
OPENVINO_API bool compare_constants(
const std::shared_ptr<Node>& n1,
const std::shared_ptr<Node>& n2
);
OPENVINO_API bool replace_output_update_name(
Output<Node> node,
const Output<Node>& node_input
);
OPENVINO_API bool replace_node_update_name(
const std::shared_ptr<Node>& target,
const std::shared_ptr<Node>& replacement
);
OPENVINO_API void serialize(
const std::shared_ptr<const ov::Model>& m,
const std::string& xml_path,
const std::string& bin_path = "",
ov::pass::Serialize::Version version = ov::pass::Serialize::Version::UNSPECIFIED
);
OPENVINO_API void save_model(
const std::shared_ptr<const ov::Model>& model,
const std::string& output_model,
bool compress_to_fp16 = true
);
OPENVINO_API std::ostream& operator << (
std::ostream& str,
const Interval& interval
);
std::shared_ptr<Model> clone_ov_model(
const Model& func,
std::unordered_map<Node \*, std::shared_ptr<Node>>& node_map
);
OPENVINO_API std::ostream& operator << (std::ostream&, const Model&);
OPENVINO_API ov::Dimension get_batch(const std::shared_ptr<const ov::Model>& f);
OPENVINO_API void set_batch(
const std::shared_ptr<ov::Model>& model,
ov::Dimension batch_size
);
OPENVINO_API std::string node_validation_failure_loc_string(const Node \* node);
OPENVINO_API std::ostream& operator << (std::ostream&, const Node&);
OPENVINO_API std::ostream& operator << (std::ostream&, const Node \*);
void OPENVINO_API check_new_args_count(
const Node \*const node,
const OutputVector& new_args
);
OPENVINO_API std::ostream& operator << (
std::ostream& out,
const Input<Node>& input
);
OPENVINO_API std::ostream& operator << (
std::ostream& out,
const Input<const Node>& input
);
OPENVINO_API std::ostream& operator << (
std::ostream& out,
const Output<Node>& output
);
OPENVINO_API std::ostream& operator << (
std::ostream& out,
const Output<const Node>& output
);
OPENVINO_API OutputVector as_output_vector(const NodeVector& args);
OPENVINO_API NodeVector as_node_vector(const OutputVector& values);
OPENVINO_API ResultVector as_result_vector(const OutputVector& values);
OPENVINO_API PartialShape operator + (
const PartialShape& s1,
const PartialShape& s2
);
OPENVINO_API std::ostream& operator << (
std::ostream& str,
const PartialShape& shape
);
OPENVINO_API void copy_runtime_info(
const std::shared_ptr<ov::Node>& from,
const std::shared_ptr<ov::Node>& to
);
OPENVINO_API void copy_runtime_info(
const std::shared_ptr<ov::Node>& from,
ov::NodeVector to
);
OPENVINO_API void copy_runtime_info(
const ov::NodeVector& from,
const std::shared_ptr<ov::Node>& to
);
OPENVINO_API void copy_runtime_info(
const ov::NodeVector& from,
ov::NodeVector to
);
OPENVINO_API void copy_output_runtime_info(
const ov::OutputVector& from,
ov::OutputVector to
);
OPENVINO_API std::ostream& operator << (
std::ostream& os,
const RuntimeAttribute& attrubute
);
template <typename ForwardIt>
size_t shape_size(
ForwardIt start_dim,
const ForwardIt end_dim
);
template <typename SHAPE_TYPE>
size_t shape_size(const SHAPE_TYPE& shape);
template <typename SHAPE_TYPE>
std::vector<size_t> row_major_strides(const SHAPE_TYPE& shape);
template <typename SHAPE_TYPE>
size_t row_major_stride(
const SHAPE_TYPE& shape,
size_t axis
);
template <typename SHAPE_TYPE>
bool is_scalar(const SHAPE_TYPE& shape);
template <typename SHAPE_TYPE>
bool is_vector(const SHAPE_TYPE& shape);
OPENVINO_API std::ostream& operator << (std::ostream& s, const Shape& shape);
OPENVINO_API std::ostream& operator << (std::ostream& s, const Strides& strides);
OPENVINO_API std::ostream& operator << (
std::ostream& s,
const DiscreteTypeInfo& info
);
bool ::type is_type(Value value);
Type \*::type as_type(Value value);
template <typename T, typename U>
auto as_type_ptr(const U& value);
OPENVINO_API PartialShape infer_convolution_forward(
const Node \* node,
const PartialShape& data_batch_shape,
const Strides& data_dilation,
const CoordinateDiff& data_padding_below,
const CoordinateDiff& data_padding_above,
const PartialShape& filters_shape,
const Strides& filter_strides,
const Strides& filter_dilation
);
OPENVINO_API void infer_auto_padding(
const Shape& image_shape,
const Shape& filter_shape,
const Strides& filter_strides,
const Strides& filter_dilations,
const op::PadType pad_type,
CoordinateDiff& padding_above,
CoordinateDiff& padding_below
);
OPENVINO_API int64_t normalize_axis(
const Node \* node,
std::int64_t axis,
const Rank& tensor_rank
);
OPENVINO_API std::vector<size_t> normalize_axes(
const std::string& node_description,
const std::vector<int64_t>& axes,
const Rank& tensor_rank
);
OPENVINO_API int64_t normalize_axis(
const std::string& node_description,
std::int64_t axis,
const Rank& tensor_rank
);
OPENVINO_API int64_t normalize_axis(
const Node \* node,
std::int64_t axis,
std::uint64_t tensor_rank,
std::int64_t axis_range_min,
std::int64_t axis_range_max
);
OPENVINO_API int64_t normalize_axis(
const std::string& node_description,
std::int64_t axis,
std::uint64_t tensor_rank,
std::int64_t axis_range_min,
std::int64_t axis_range_max
);
OPENVINO_API void normalize_axes(
const Node \* node,
const int64_t& tensor_rank,
std::vector<int64_t>& axes
);
OPENVINO_API bool evaluate_as_partial_shape(
const Output<Node>& output,
PartialShape& pshape
);
OPENVINO_API std::shared_ptr<op::v0::Constant> get_constant_from_source(const Output<Node>& source);
OPENVINO_API bool default_label_evaluator(
const Node \* node,
TensorLabelVector& output_labels
);
OPENVINO_API void generate_transpose_default_order(
std::vector<int64_t>& axes_order,
const size_t length
);
OPENVINO_API bool is_valid_axes_order(
const std::vector<int64_t>& axes_order,
const size_t size
);
OPENVINO_API bool has_no_labels(const TensorLabel& labels);
OPENVINO_API std::vector<PartialShape> get_node_input_partial_shapes(const ov::Node& node);
OPENVINO_API bool is_rank_compatible_any_of(
const ov::Rank& rank,
const std::vector<ov::Rank>& ranks
);
OPENVINO_API std::ostream& operator << (std::ostream& s, const Version& version);
OPENVINO_API std::ostream& operator << (
std::ostream& s,
const std::map<std::string, Version>& versions
);
OPENVINO_API_C(const Version);
OPENVINO_API std::ostream& operator << (
std::ostream& s,
const op::v1::BinaryConvolution::BinaryConvolutionMode& type
);
OPENVINO_API std::ostream& operator << (
std::ostream& s,
const op::v0::DepthToSpace::DepthToSpaceMode& type
);
OPENVINO_API std::ostream& operator << (
std::ostream& s,
const op::v9::GridSample::InterpolationMode& type
);
OPENVINO_API std::ostream& operator << (
std::ostream& s,
const op::v9::GridSample::PaddingMode& type
);
OPENVINO_API std::ostream& operator << (
std::ostream& s,
const op::v0::Interpolate::InterpolateMode& type
);
OPENVINO_API std::ostream& operator << (
std::ostream& s,
const op::LSTMWeightsFormat& type
);
OPENVINO_API std::ostream& operator << (
std::ostream& s,
const op::v8::MatrixNms::DecayFunction& type
);
OPENVINO_API std::ostream& operator << (
std::ostream& s,
const op::v8::MatrixNms::SortResultType& type
);
OPENVINO_API std::ostream& operator << (
std::ostream& s,
const op::v1::NonMaxSuppression::BoxEncodingType& type
);
OPENVINO_API std::ostream& operator << (
std::ostream& s,
const op::v3::NonMaxSuppression::BoxEncodingType& type
);
OPENVINO_API std::ostream& operator << (
std::ostream& s,
const op::v5::NonMaxSuppression::BoxEncodingType& type
);
OPENVINO_API std::ostream& operator << (
std::ostream& s,
const op::v9::NonMaxSuppression::BoxEncodingType& type
);
OPENVINO_API std::ostream& operator << (
std::ostream& s,
const op::v1::Reverse::Mode& type
);
std::ostream& operator << (
std::ostream& s,
const op::v3::ROIAlign::PoolingMode& mode
);
std::ostream& operator << (
std::ostream& s,
const op::v9::ROIAlign::PoolingMode& mode
);
std::ostream& operator << (
std::ostream& s,
const op::v9::ROIAlign::AlignedMode& mode
);
OPENVINO_API std::ostream& operator << (
std::ostream& s,
const op::v5::Round::RoundMode& type
);
OPENVINO_API std::ostream& operator << (
std::ostream& s,
const op::v0::SpaceToDepth::SpaceToDepthMode& type
);
OPENVINO_API std::ostream& operator << (
std::ostream& s,
const op::util::InterpolateBase::InterpolateMode& type
);
OPENVINO_API std::ostream& operator << (
std::ostream& s,
const op::util::InterpolateBase::CoordinateTransformMode& type
);
OPENVINO_API std::ostream& operator << (
std::ostream& s,
const op::util::InterpolateBase::NearestMode& type
);
OPENVINO_API std::ostream& operator << (
std::ostream& s,
const op::util::InterpolateBase::ShapeCalcMode& type
);
OPENVINO_API std::ostream& operator << (
std::ostream& s,
const op::util::MulticlassNmsBase::SortResultType& type
);
void OPENVINO_API mark_as_precision_sensitive(ov::Input<ov::Node> node_input);
void OPENVINO_API unmark_as_precision_sensitive(ov::Input<ov::Node> node_input);
bool OPENVINO_API is_precision_sensitive(const ov::Input<ov::Node>& node_input);
OPENVINO_API void set_up_symbolic_info(
const std::shared_ptr<ov::Model>& model,
const std::shared_ptr<ov::TableOfEquivalence>& table
);
OPENVINO_API void set_up_symbolic_info(
const ov::Output<ov::Node>& output,
const std::shared_ptr<ov::TableOfEquivalence>& table
);
OPENVINO_API void populate_tensor_with_missing_labels(ov::descriptor::Tensor& tensor);
OPENVINO_API bool skip_invalidation(const ov::descriptor::Tensor& tensor);
OPENVINO_API std::shared_ptr<ov::TableOfEquivalence> table_of_equivalence(const std::shared_ptr<ov::Model>& model);
OPENVINO_API std::shared_ptr<ov::TableOfEquivalence> table_of_equivalence(const ov::descriptor::Tensor& tensor);
OPENVINO_API void remove_symbolic_info(
const std::shared_ptr<ov::Model>& model,
bool outermost_model = true
);
const OPENVINO_API OpSet& get_opset1();
const OPENVINO_API OpSet& get_opset2();
const OPENVINO_API OpSet& get_opset3();
const OPENVINO_API OpSet& get_opset4();
const OPENVINO_API OpSet& get_opset5();
const OPENVINO_API OpSet& get_opset6();
const OPENVINO_API OpSet& get_opset7();
const OPENVINO_API OpSet& get_opset8();
const OPENVINO_API OpSet& get_opset9();
const OPENVINO_API OpSet& get_opset10();
const OPENVINO_API OpSet& get_opset11();
const OPENVINO_API OpSet& get_opset12();
const OPENVINO_API OpSet& get_opset13();
const OPENVINO_API std::map<std::string, std::function<const ov::OpSet&()>>& get_available_opsets();
std::size_t coordinate_index(const Coordinate& c, const Shape& s);
size_t coordinate_offset(
const std::vector<size_t>& coordinate,
const std::vector<size_t>& strides
);
template <class T>
constexpr bool is_floating_point();
template <class TContainer>
constexpr auto make_tensor_accessor(const TContainer& c);
auto make_tensor_accessor();
template <class T, class TResult = std::vector<T>, class UnaryOperation>
TResult get_raw_data_as(
const element::Type_t et,
const void \*const ptr,
const size_t size,
UnaryOperation&& func
);
template <class T, class TResult = std::vector<T>, class UnaryOperation>
OPENVINO_SUPPRESS_DEPRECATED_START TResult get_tensor_data_as(
ngraph::HostTensor& tv,
UnaryOperation&& func
);
template <class T, class TResult = std::vector<T>, class UnaryOperation>
TResult get_tensor_data_as(
ngraph::HostTensor \* tv,
UnaryOperation&& func
);
template <
class T,
class TResult = std::vector<T>,
class UnaryOperation = ov::util::Cast<T>
>
OPENVINO_SUPPRESS_DEPRECATED_END TResult get_tensor_data_as(
const Tensor& t,
UnaryOperation&& func = ov::util::Cast<T>()
);
FRONTEND_API void shutdown();
std::unordered_set<std::string> get_supported_nodes(
const std::shared_ptr<const ov::Model>& model,
std::function<void(std::shared_ptr<ov::Model>&)> transform,
std::function<bool(const std::shared_ptr<ov::Node>)> is_node_supported
);
std::shared_ptr<ITensor> make_tensor(
const element::Type type,
const Shape& shape,
const Allocator& allocator = {}
);
std::shared_ptr<ITensor> make_tensor(
const element::Type type,
const Shape& shape,
void \* host_ptr,
const Strides& strides = {}
);
std::shared_ptr<ITensor> make_tensor(
const std::shared_ptr<ITensor>& other,
const Coordinate& begin,
const Coordinate& end
);
ov::Tensor make_tensor(const ov::SoPtr<ITensor>& tensor);
bool check_open_mp_env_vars(bool include_omp_num_threads = true);
std::vector<int> get_available_numa_nodes();
std::vector<int> get_available_cores_types();
int get_number_of_cpu_cores(bool big_cores_only = false);
int get_number_of_logical_cpu_cores(bool big_cores_only = false);
bool with_cpu_x86_sse42();
bool with_cpu_x86_avx();
bool with_cpu_x86_avx2();
bool with_cpu_x86_avx2_vnni();
bool with_cpu_x86_avx512f();
bool with_cpu_x86_avx512_core();
bool with_cpu_x86_avx512_core_vnni();
bool with_cpu_x86_bfloat16();
bool with_cpu_x86_avx512_core_fp16();
bool with_cpu_x86_avx512_core_amx_int8();
bool with_cpu_x86_avx512_core_amx_bf16();
bool with_cpu_x86_avx512_core_amx();
bool is_cpu_map_available();
int get_num_numa_nodes();
int get_num_sockets();
std::vector<std::vector<int>> get_proc_type_table();
std::vector<std::vector<int>> get_org_proc_type_table();
void reserve_available_cpus(
const std::vector<std::vector<int>> streams_info_table,
std::vector<std::vector<int>>& stream_processors,
const int cpu_status = NOT_USED
);
void set_cpu_used(const std::vector<int>& cpu_ids, const int used);
int get_socket_by_numa_node(int numa_node_id);
static MemBandwidthPressure MemBandwidthPressureTolerance(
const std::shared_ptr<ov::Model> model,
const float cache_size,
const float memThresholdAssumeLimited = MemBandwidthPressure::LIMITED
);
} // namespace ov
Detailed Documentation¶
transformation aligns elementwise constant inputs ranks with its output rank
A namespace with const values for Execution Graph parameters names.
Executable Model Info is represented in ov::Model format with general ExecutionNode nodes inside including connections between the nodes. Each node describes an executable hardware-specific primitive and stores its parameters within ExecutionNode::get_rt_info map. There is a list of general keys for the parameters map.
OpenVINO C++ API.
Resolves transpose_b key from MatMul operation if corresponding input is constant or FakeQuantize by inserting Transpose.
Global Functions¶
std::shared_ptr<ov::MappedMemory> load_mmap_object(const std::string& path)
Returns mapped memory for a file from provided path. Instead of reading files, we can map the memory via mmap for Linux in order to avoid time-consuming reading and reduce memory consumption.
Parameters:
path |
Path to a file which memory will be mmaped. |
Returns:
MappedMemory shared ptr object which keep mmaped memory and control the lifetime.
OPENVINO_API std::ostream& operator << (
std::ostream& str,
const Dimension& dimension
)
Insert a human-readable representation of a dimension into an output stream.
Inserts the string ?
if dimension
is dynamic; else inserts dimension.get_length()
.
Parameters:
str |
The output stream targeted for insertion. |
dimension |
The dimension to be inserted into |
Returns:
A reference to str
after insertion.
template <typename Type, typename Value>
std::enable_if<std::is_convertible<Value, std::string>::value, Type>::type as_enum(const Value& value)
Returns the enum value matching the string.
template <typename Value>
const std::string& as_string(Value value)
Returns the string matching the enum value.
void create_extensions(std::vector<Extension::Ptr>&)
The entry point for library with OpenVINO extensions.
Parameters:
vector |
of extensions |
OPENVINO_API void traverse_nodes(
const NodeVector& subgraph_results,
const std::function<void(const std::shared_ptr<Node>&)>& f,
const NodeVector& subgraph_params = {}
)
Visit each node in a sub-graph of the entire graph.
Traverses a sub-graph starting from subgraph_results moving up towards parameter nodes. Traversal stops if it hits a node in subgraph_params.
Most useful for finding parameters of a graph directly from the result nodes and not from function parameters or extracting a subgraph relevant to the computation of certain outputs
Parameters:
subgraph_results |
The output nodes of the sub-graph |
f |
Model to execute at each node in the traversal |
subgraph_params |
Input nodes of the sub-graph (optional) |
OPENVINO_API void replace_node(
const std::shared_ptr<Node>& target,
const std::shared_ptr<Node>& replacement,
const std::vector<int64_t>& output_order
)
Replace the node target
with the node replacement
, i.e., redirect all users and control dependencies of target
to replacement
.
This is primarily used in graph-rewriting passes. For example, we might “fuse” two Concat operations as follows:
(Step 0: Original graph)
A B | | v v N0[Concat, concatenation_axis=3] C | | v v N1[Concat, concatenation_axis=3] | | v v some_user another_user
(Step 1: Construct replacement)
shared_ptr<Node> new_N1 = make_shared<op::Concat>({A,B,C},3);
A————————————-. | | | B————-). | | | | v v | | N0[Concat, concatenation_axis=3] C–)). | | | | | v v v v v N1[Concat, concatenation_axis=3] new_N1[Concat, concatenation_axis=3] | | v v some_user another_user
(Step 2: Replace N1 with new_N1)
replace_node(N1, new_N1);
A————————————-. | | | B————-). | | | | v v | | N0[Concat, concatenation_axis=3] C–)). | | | | | v v v v v N1[Concat, concatenation_axis=3] new_N1[Concat, concatenation_axis=3] | | v v some_user another_user
(Step 3: N0 and N1 are now dead, nodes will be freed)
[happens automatically, once all shared_ptrs to N1 are released]
A————————————-. | B————-). | | | | C–)). | | | v v v new_N1[Concat, concatenation_axis=3] | | v v some_user another_user
NOTE 1: replace_node is not type-safe (the graph is not revalidated). For example, the following is allowed, even if node some_user
requires an input of shape 2x2:
(Before) A(shape=2x2) B(shape=3x3) | v some_user(requires 2x2 input)
(After graph is now invalid)
replace_node(A, B);
A(shape=2x2) B(shape=3x3)
|
v
some_user(requires 2x2 input)
NOTE 2: it is possible to insert a cycle into the graph with replace_node, resulting in an invalid graph. Care must be taken to avoid this. One common example is when you are attempting to insert a new node M
“after” a node
N`. For example, you might expect this to work:
shared_ptr<Node> M = make_shared<SomeUnaryOp>(N); replace_node(M, N);
The problem is that at replacement time, N itself is a user of M. So we end up introducing a cycle as follows:
N
|
v
other users…
|||
vvv
N------------>M
|
v
other users…
|||
vvv
.----.
| |
| |
N `----->M
|
v
other users...
To avoid the cycle, a valid way to perform the above desired insertion would be,
auto new_N = N->clone_with_new_inputs(N->input_values());
shared_ptr<Node> M = make_shared<SomeUnaryOp>(new_N);
replace_node(N, M);
Parameters:
target |
Node to be replaced. |
replacement |
Node to replace |
output_order |
Vector determines order of replacement node’s outputs. |
OPENVINO_API void replace_node(
const std::shared_ptr<Node>& target,
const OutputVector& replacement_values
)
Replace target.outputs[i] with replacement_values[i] and transfer control dependents and.
OPENVINO_API void replace_nodes(
const std::shared_ptr<Model>& f,
const std::unordered_map<std::shared_ptr<op::v0::Parameter>, std::shared_ptr<op::v0::Parameter>>& parameter_replacement_map,
const std::unordered_map<std::shared_ptr<Node>, std::shared_ptr<Node>>& body_replacement_map
)
Replace multiple nodes in a function.
Limitations:
No check is made that the replaced nodes in
parameter_replacement_map
are actually among the bound parameters off
. (If a parameter appears in the map that is not bound byf
, it will be silently ignored.)If a parameter node appears as a key in both
parameter_replacement_map
and inbody_replacement_map
, behavior is unspecified.
Parameters:
f |
Model where replacement is taking place. |
parameter_replacement_map |
A mapping from parameter shared pointers to parameter shared pointers. For each pair (k,v) in the map, parameter k is replaced by parameter v, except if k==v or k is not a parameter bound by f, in which case the pair (k,v) is ignored. |
body_replacement_map |
A mapping from node shared pointers to node shared pointers. For each pair (k,v) in the map, node k is replaced by node v, except if k==v, the pair (k,v) is ignored. Note that if k is a parameter, its users will be redirected to v, but k will not be replaced in the function’s parameter list. |
template <typename T>
std::vector<std::shared_ptr<Node>> topological_sort(T root_nodes)
Topological sort of nodes needed to compute root_nodes.
OPENVINO_API void serialize(
const std::shared_ptr<const ov::Model>& m,
const std::string& xml_path,
const std::string& bin_path = "",
ov::pass::Serialize::Version version = ov::pass::Serialize::Version::UNSPECIFIED
)
Serialize given model into IR. The generated .xml and .bin files will be saved into provided paths. This method serializes model “as-is” that means no weights compression and other possible transformations are applied. It is recommended to use ov::save_model function instead of ov::serialize, because it is aligned with default model conversion flow.
Parameters:
m |
Model which will be converted to IR representation. |
xml_path |
Path where .xml file will be saved. |
bin_path |
Path where .bin file will be saved (optional). The same name as for xml_path will be used by default. |
version |
Version of the generated IR (optional). |
OPENVINO_API void save_model(
const std::shared_ptr<const ov::Model>& model,
const std::string& output_model,
bool compress_to_fp16 = true
)
Save given model into IR. Floating