namespace ngraph

Overview

transformation aligns elementwise constant inputs ranks with its output rank More…

namespace ngraph {

// namespaces

namespace ngraph::builder;
    namespace ngraph::builder::opset1;
namespace ngraph::coordinates;
namespace ngraph::descriptor;
    namespace ngraph::descriptor::layout;
namespace ngraph::element;
namespace ngraph::file_util;
namespace ngraph::op;
    namespace ngraph::op::internal;
    namespace ngraph::op::util;
        namespace ngraph::op::util::detail;
        namespace ngraph::op::util::error;
    namespace ngraph::op::v0;
    namespace ngraph::op::v1;
    namespace ngraph::op::v3;
    namespace ngraph::op::v4;
    namespace ngraph::op::v5;
    namespace ngraph::op::v6;
    namespace ngraph::op::v7;
    namespace ngraph::op::v8;
    namespace ngraph::op::v9;
namespace ngraph::opset1;
namespace ngraph::opset2;
namespace ngraph::opset3;
namespace ngraph::opset4;
namespace ngraph::opset5;
namespace ngraph::opset6;
namespace ngraph::opset7;
namespace ngraph::opset8;
namespace ngraph::opset9;
namespace ngraph::pass;
    namespace ngraph::pass::itt;
        namespace ngraph::pass::itt::domains;
    namespace ngraph::pass::low_precision;
        namespace ngraph::pass::low_precision::itt;
            namespace ngraph::pass::low_precision::itt::domains;
        namespace ngraph::pass::low_precision::precision_set;
namespace ngraph::pattern;
    namespace ngraph::pattern::op;
namespace ngraph::reduction;
namespace ngraph::runtime;
    namespace ngraph::runtime::opt_kernel;
    namespace ngraph::runtime::reference;
        namespace ngraph::runtime::reference::adaptive_pool;
        namespace ngraph::runtime::reference::detail;
        namespace ngraph::runtime::reference::details;
        namespace ngraph::runtime::reference::fake_quantize_details;
        namespace ngraph::runtime::reference::fft_common;
        namespace ngraph::runtime::reference::internal;
        namespace ngraph::runtime::reference::kernel;
        namespace ngraph::runtime::reference::nms_common;
namespace ngraph::snippets;
    namespace ngraph::snippets::isa;
    namespace ngraph::snippets::op;
    namespace ngraph::snippets::pass;

// structs

struct NullLogger;
struct SlicePlan;

// classes

class AvgPoolPrecisionPreservedAttribute;
class ConstString;
class CoordinateIterator;
class CoordinateTransformBasic;
template <typename BASE_TYPE>
class FactoryRegistry;
class FusedNames;
template <class T>
class HasTypeInfoMember;
class IntervalsAlignmentAttribute;
class IntervalsAlignmentSharedValue;
class LogHelper;
class Logger;
class Mask;
class OpSet;
class PrecisionPreservedAttribute;
class PrecisionsAttribute;
class QuantizationAlignmentAttribute;
class QuantizationGranularityAttribute;
class QuantizationModeAttribute;
template <typename VT>
class VariantImpl;
template <typename VT>
class VariantWrapper;
template <>
class VariantWrapper<int64_t>;
template <>
class VariantWrapper<std::string>;

// global functions

std::ostream& operator << (std::ostream& s, const ELTWISE_TYPE& type);
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);
NGRAPH_API std::string getFusedNames(const std::shared_ptr<ngraph::Node>& node);
NGRAPH_API std::vector<std::string> getFusedNamesVector(const std::shared_ptr<ngraph::Node>& node);
NGRAPH_API std::string getenv_string(const char \* env_var);
NGRAPH_API int32_t getenv_int(const char \* env_var, int32_t default_value = -1);
NGRAPH_API bool getenv_bool(const char \* env_var, bool default_value = false);

template <typename V>
class NGRAPH_DEPRECATED("This class is deprecated and will be removed soon.");

NGRAPH_API std::mutex& get_registry_mutex();

std::shared_ptr<ngraph::Function> clone_function(
    const ngraph::Function& func,
    ngraph::NodeMap& node_map
    );

std::shared_ptr<ngraph::Function> clone_function(const ngraph::Function& func);

NGRAPH_API NodeVector find_common_args(
    std::shared_ptr<Node> target,
    std::shared_ptr<Node> replacement
    );

template <typename T>
std::vector<std::shared_ptr<Node>> subgraph_topological_sort(T nodes);

template <typename T>
void validate_nodes_and_infer_types(const T& nodes);

NGRAPH_API bool is_post_dominated(Node \* X, Node \* Y);

NGRAPH_API bool is_equal_to_const_value(
    const std::string& const_value,
    const Output<Node>& reduce_constant
    );

NGRAPH_API std::vector<std::shared_ptr<ngraph::Node>> clone_nodes(
    const std::vector<std::shared_ptr<ngraph::Node>>& nodes,
    NodeMap& node_map
    );

NGRAPH_API std::list<std::shared_ptr<ngraph::Node>> clone_nodes(
    const std::vector<std::shared_ptr<ngraph::Node>>& nodes,
    RawNodeOutputMap& node_map
    );

NGRAPH_API std::pair<std::shared_ptr<op::v0::Result>, std::shared_ptr<op::v0::Parameter>> insert_result_parameter_split(
    const std::shared_ptr<Node>& src_node,
    const std::shared_ptr<Node>& dst_node
    );

NGRAPH_API void insert_new_node_between(
    const std::shared_ptr<Node>& src_node,
    const std::shared_ptr<Node>& dst_node,
    const std::shared_ptr<Node>& new_node
    );

NGRAPH_API std::shared_ptr<Node> make_zero(
    const element::Type& element_type,
    const Shape& shape
    );

NGRAPH_API std::shared_ptr<Node> make_constant_from_string(
    std::string val,
    const element::Type& element_type,
    const Shape& shape
    );

NGRAPH_API bool is_zero(const Output<Node>& reduce_constant);

NGRAPH_API NodeVector get_subgraph_outputs(
    const NodeVector& nodes,
    const NodeVector& exclusions,
    bool ignore_unused = false,
    bool ignore_output_duplicates = true
    );

NGRAPH_API NodeVector extract_subgraph(
    const NodeVector& results,
    const NodeVector& args
    );

NGRAPH_API bool is_one(const Output<Node>& reduce_constant);
NGRAPH_API bool is_used(Node \* node);
NGRAPH_API size_t get_user_count(Node \* node);
NGRAPH_API bool possibly_overwritten(Node \* node);
NGRAPH_API bool is_strided(const Strides& strides);

NGRAPH_API bool is_valid_rank(
    const std::shared_ptr<Node>& node,
    std::vector<size_t> valid_ranks
    );

NGRAPH_API void plot_graph(
    std::shared_ptr<Function> f,
    const std::string& filename,
    std::function<void(const Node&node, std::vector<std::string>&attributes)> = nullptr
    );

NGRAPH_API std::vector<Input<Node>> get_inputs_from(Node& src, Node& dst);
NGRAPH_API std::vector<Output<Node>> get_outputs_to(Node& src, Node& dst);

NGRAPH_API bool check_for_cycles(
    const ngraph::Function \* func,
    ngraph::NodeVector& cycle_nodes,
    bool& is_bkwd_cycle
    );

constexpr const char \* find_last(ConstString s, size_t offset, char ch);
constexpr const char \* find_last(ConstString s, char ch);
constexpr const char \* get_file_name(ConstString s);
constexpr const char \* trim_file_name(ConstString root, ConstString s);
NGRAPH_API void default_logger_handler_func(const std::string& s);

template <typename T>
NullLogger&& operator << (NullLogger&& logger, T&&);

template <typename T>
NullLogger&& operator << (NullLogger&& logger, const T&);

NullLogger&& operator << (
    NullLogger&& logger,
    std::basic_ostream<char, std::char_traits<char>>&&)(std::basic_ostream< char, std::char_traits< char > > &
    );

NGRAPH_API const std::shared_ptr<Node>& check_single_output_arg(
    const std::shared_ptr<Node>& node,
    size_t i
    );

NGRAPH_API const NodeVector& check_single_output_args(const NodeVector& args);
NGRAPH_API std::shared_ptr<Node> operator - (const Output<Node>& arg0);

AxisSet get_normalized_axes_from_tensor(
    const HostTensorPtr tensor,
    const ngraph::Rank& rank,
    const std::string& node_description
    );

SlicePlan NGRAPH_API make_slice_plan(
    const Shape& input_shape,
    const std::vector<int64_t>& begins,
    const std::vector<int64_t>& ends,
    const std::vector<int64_t>& strides,
    const AxisSet& lower_bounds_mask,
    const AxisSet& upper_bounds_mask,
    const AxisSet& new_axis_mask,
    const AxisSet& shrink_axis_mask,
    const AxisSet& ellipsis_mask
    );

const NGRAPH_API OpSet& get_opset1();
const NGRAPH_API OpSet& get_opset2();
const NGRAPH_API OpSet& get_opset3();
const NGRAPH_API OpSet& get_opset4();
const NGRAPH_API OpSet& get_opset5();
const NGRAPH_API OpSet& get_opset6();
const NGRAPH_API OpSet& get_opset7();
const NGRAPH_API OpSet& get_opset8();
const NGRAPH_API OpSet& get_opset9();

template <typename AXIS_VALUES>
AXIS_VALUES project(
    const AXIS_VALUES& axis_values,
    const AxisSet& axes
    );

NGRAPH_API PartialShape project(const PartialShape& shape, const AxisSet& axes);

template <typename AXIS_VALUES>
AXIS_VALUES reduce(
    const AXIS_VALUES& axis_values,
    const AxisSet& deleted_axes,
    bool keep_dims
    );

NGRAPH_API PartialShape reduce(
    const PartialShape& shape,
    const AxisSet& deleted_axes,
    bool keep_dims
    );

template <typename AXIS_VALUES, typename AXIS_VALUE>
AXIS_VALUES inject_pairs(
    const AXIS_VALUES& axis_values,
    std::vector<std::pair<size_t, AXIS_VALUE>> new_axis_pos_value_pairs
    );

NGRAPH_API PartialShape inject_pairs(
    const PartialShape& shape,
    std::vector<std::pair<size_t, Dimension>> new_axis_pos_value_pairs
    );

template <typename AXIS_VALUES, typename AXIS_VALUE>
AXIS_VALUES inject(
    const AXIS_VALUES& axis_values,
    size_t new_axis_pos,
    AXIS_VALUE new_axis_val
    );

NGRAPH_API std::shared_ptr<Function> specialize_function(
    std::shared_ptr<Function> f,
    const std::vector<element::Type>& parameter_element_types,
    const std::vector<PartialShape>& parameter_shapes,
    const std::vector<void \*>& parameter_values
    );

size_t compiler_byte_size(element::Type_t et);

template <typename T>
std::string join(
    const T& v,
    const std::string& sep = ", "
    );

template <typename T>
std::string vector_to_string(const T& v);

NGRAPH_API size_t hash_combine(const std::vector<size_t>& list);
NGRAPH_API void dump(std::ostream& out, const void \*, size_t);
NGRAPH_API std::string to_lower(const std::string& s);
NGRAPH_API std::string to_upper(const std::string& s);
NGRAPH_API std::string trim(const std::string& s);

NGRAPH_API std::vector<std::string> split(
    const std::string& s,
    char delimiter,
    bool trim = false
    );

template <typename T>
std::string locale_string(T x);

class NGRAPH_API NGRAPH_DEPRECATED("It is obsolete structure and will be removed soon");

template <typename T>
T parse_string(const std::string& s);

NGRAPH_API float parse_string< float >(const std::string& s);
NGRAPH_API double parse_string< double >(const std::string& s);
NGRAPH_API int8_t parse_string< int8_t >(const std::string& s);
NGRAPH_API uint8_t parse_string< uint8_t >(const std::string& s);

template <typename T>
std::vector<T> parse_string(const std::vector<std::string>& ss);

template <typename T>
T ceil_div(const T& x, const T& y);

template <typename T>
T subtract_or_zero(T x, T y);

NGRAPH_API void \* ngraph_malloc(size_t size);
NGRAPH_API void ngraph_free(void \*);
NGRAPH_API size_t round_up(size_t size, size_t alignment);

bool is_valid_permutation(
    ngraph::AxisVector permutation,
    ngraph::Rank rank = Rank::dynamic()
    );

template <typename T>
T apply_permutation(T input, ngraph::AxisVector order);

template NGRAPH_API NGRAPH_DEPRECATED("This method is deprecated and will be removed soon");
NGRAPH_API PartialShape apply_permutation(PartialShape input, AxisVector order);
NGRAPH_API AxisVector get_default_order(size_t rank);
NGRAPH_API AxisVector get_default_order(const Rank& rank);
NGRAPH_API AxisVector get_default_order(const Shape& shape);
NGRAPH_API AxisVector get_default_order(const PartialShape& shape);

NGRAPH_API void parse_version_string(
    std::string version,
    size_t& major,
    size_t& minor,
    size_t& patch,
    std::string& extra
    );

template <typename T>
T double_to_int(
    double x,
    double  float_to_int_converterdouble
    );

NGRAPH_API Strides conv_default_strides(
    const Node \* node,
    const PartialShape& data_batch_shape,
    const PartialShape& filters_shape
    );

NGRAPH_API CoordinateDiff conv_default_padding(
    const Node \* node,
    const PartialShape& data_batch_shape,
    const PartialShape& filters_shape
    );

NGRAPH_API PartialShape infer_windowed_reduction_output_shape(
    const Node \* node,
    const PartialShape& data_shape,
    const Strides& data_dilation,
    const CoordinateDiff& data_padding_below,
    const CoordinateDiff& data_padding_above,
    const PartialShape& window_shape,
    const Strides& window_strides,
    const Strides& window_dilation,
    bool is_window_all_in_padding_allowed,
    bool ceil_mode = false
    );

void validate_conv_params_spatial_dimensions(
    const Node \* node,
    const size_t num_spatial_dims,
    const op::PadType auto_pad,
    Strides& strides,
    Strides& dilations,
    CoordinateDiff& pads_begin,
    CoordinateDiff& pads_end
    );

PartialShape validate_and_infer_convolution_forward_output_shape(
    const Node \* node,
    const Rank& result_ps_rank,
    const PartialShape& data_batch_pshape,
    const PartialShape& filters_pshape,
    const op::PadType auto_pad,
    Strides& strides,
    Strides& dilations,
    CoordinateDiff& pads_begin,
    CoordinateDiff& pads_end
    );

NGRAPH_API PartialShape infer_batched_pooling_forward(
    const Node \* node,
    const PartialShape& data_batch_shape,
    const CoordinateDiff& data_padding_below,
    const CoordinateDiff& data_padding_above,
    const PartialShape& window_shape,
    const Strides& window_strides,
    bool is_window_all_in_padding_allowed,
    bool ceil_mode = false,
    const Strides& window_dilation = Strides{}
    );

NGRAPH_API std::tuple<element::Type, PartialShape, PartialShape> infer_batch_norm_forward(
    const Node \* node,
    element::Type input_element_type,
    element::Type gamma_element_type,
    element::Type beta_element_type,
    element::Type mean_element_type,
    element::Type variance_element_type,
    const PartialShape& input_shape,
    const PartialShape& gamma_shape,
    const PartialShape& beta_shape,
    const PartialShape& mean_shape,
    const PartialShape& variance_shape
    );

NGRAPH_API std::tuple<element::Type, PartialShape, PartialShape> infer_batch_norm_forward(
    const Node \* node,
    element::Type input_element_type,
    element::Type gamma_element_type,
    element::Type beta_element_type,
    const PartialShape& input_shape,
    const PartialShape& gamma_shape,
    const PartialShape& beta_shape
    );

NGRAPH_API bool try_apply_auto_padding(
    const PartialShape& 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
    );

NGRAPH_API PartialShape infer_slice_shape(
    const Node \* node,
    const PartialShape& input_shape,
    const std::vector<int64_t>& begin,
    const std::vector<int64_t>& end,
    const std::vector<int64_t>& strides,
    const AxisSet& begin_mask,
    const AxisSet& end_mask,
    const AxisSet& new_axis_mask,
    const AxisSet& shrink_axis_mask,
    const AxisSet& ellipsis_mask
    );

NGRAPH_API std::pair<bool, uint64_t> maximum_value(const Output<Node>& value);

NGRAPH_API void evaluate_nodes(
    std::map<RawNodeOutput, HostTensorPtr>& value_map,
    std::map<RawNodeOutput, HostTensorPtr>& output_tensor_map,
    const OutputVector& outputs,
    const EvaluationContext& evaluation_context = EvaluationContext()
    );

NGRAPH_API HostTensorPtr evaluate_lower_bound(const Output<Node>& output);
NGRAPH_API HostTensorPtr evaluate_upper_bound(const Output<Node>& output);
NGRAPH_API std::pair<HostTensorPtr, HostTensorPtr> evaluate_both_bounds(const Output<Node>& output);

NGRAPH_API bool default_upper_bound_evaluator(
    const Node \* node,
    const HostTensorVector& output_values
    );

NGRAPH_API bool default_lower_bound_evaluator(
    const Node \* node,
    const HostTensorVector& output_values
    );

NGRAPH_API bool interval_bound_evaluator(
    const Node \* node,
    const HostTensorVector& lower_output_values,
    const HostTensorVector& upper_output_values
    );

NGRAPH_API bool host_tensor_is_positive(const HostTensorPtr& bound);
NGRAPH_API bool has_and_set_equal_bounds(const Output<Node>& source);
NGRAPH_API std::shared_ptr<op::Constant> get_constant_max_of_type(element::Type_t t);
NGRAPH_API std::shared_ptr<op::Constant> get_constant_min_of_type(element::Type_t t);
NGRAPH_API std::shared_ptr<op::Constant> get_constant_lowest_of_type(element::Type_t t);

NGRAPH_API bool validate_host_tensor_vector(
    const HostTensorVector& v,
    const size_t& size
    );

NGRAPH_API bool could_propagate(
    const Output<Node>& output,
    std::vector<Node \*>& order
    );

template <typename T>
std::shared_ptr<Variant> make_variant(const T& p);

template <size_t N>
std::shared_ptr<Variant> make_variant(const char(&) s[N]);

NGRAPH_API void get_version(
    size_t& major,
    size_t& minor,
    size_t& patch,
    std::string& extra
    );

std::size_t coordinate_index(const Coordinate& c, const Shape& s);

} // namespace ngraph

Detailed Documentation

transformation aligns elementwise constant inputs ranks with its output rank

The Intel nGraph C++ API.

ngraph namespace

Resolves transpose_b key from MatMul operation if corresponding input is constant or FakeQuantize by inserting Transpose.

Global Functions

NGRAPH_API std::string getenv_string(const char \* env_var)

Get the names environment variable as a string.

Parameters:

env_var

The string name of the environment variable to get.

Returns:

Returns string by value or an empty string if the environment variable is not set.

NGRAPH_API int32_t getenv_int(const char \* env_var, int32_t default_value = -1)

Get the names environment variable as an integer. If the value is not a valid integer then an exception is thrown.

Parameters:

env_var

The string name of the environment variable to get.

default_value

The value to return if the environment variable is not set.

Returns:

Returns value or default_value if the environment variable is not set.

NGRAPH_API bool getenv_bool(const char \* env_var, bool default_value = false)

Get the names environment variable as a boolean. If the value is not a valid boolean then an exception is thrown. Valid booleans are one of 1, 0, on, off, true, false All values are case insensitive. If the environment variable is not set the default_value is returned.

Parameters:

env_var

The string name of the environment variable to get.

default_value

The value to return if the environment variable is not set.

Returns:

Returns the boolean value of the environment variable.

template <typename V>
class NGRAPH_DEPRECATED("This class is deprecated and will be removed soon.")

Execute handlers on a subgraph to compute values.

template <typename T>
std::vector<std::shared_ptr<Node>> subgraph_topological_sort(T nodes)

Topological sort of just nodes.

NGRAPH_API std::vector<Input<Node>> get_inputs_from(Node& src, Node& dst)

Returns:

A vector containing handles for each input of dst that is connected to an output of src.

NGRAPH_API std::vector<Output<Node>> get_outputs_to(Node& src, Node& dst)

Returns:

A vector containing a handle for each output of src that is connected to an input of dst.

NGRAPH_API bool check_for_cycles(
    const ngraph::Function \* func,
    ngraph::NodeVector& cycle_nodes,
    bool& is_bkwd_cycle
    )

Checks the func for graph cycles starting from results going backwards, then from parameters going forward. It returns true if a cycle is found and the first cycle encountered.

AxisSet get_normalized_axes_from_tensor(
    const HostTensorPtr tensor,
    const ngraph::Rank& rank,
    const std::string& node_description
    )

Extracts the tensor data and returns a set of normalized axes created out of it.

Parameters:

tensor

A pointer to a HostTensor object containing the raw axes data

rank

Rank of an operator’s input data tensor (used to normalize the axes)

node_description

An identifier of the operator’s node (used to report errors)

Returns:

Normalized (positive only) axes as an AxisSet object.

NGRAPH_API std::shared_ptr<Function> specialize_function(
    std::shared_ptr<Function> f,
    const std::vector<element::Type>& parameter_element_types,
    const std::vector<PartialShape>& parameter_shapes,
    const std::vector<void \*>& parameter_values
    )

Creates a “specialized” clone of a function. The partial shapes and element types of the function’s parameters may be narrowed to more specific shapes and element types, and constant values may optionally be substituted for any or all of the parameters.

Creates a “specialized” clone of an nGraph Function.

For example, suppose that a function f has three parameters with partial shapes:

param0: ?
param1: {1,?,3}
param2: {?,?,4}

Shape specialization would allow us to create a clone of f where the shapes are (for example):

param0: {1,2}
param1: {1,5,3}
param2: {3,?,4}

But not (for example):

param1: {1,5,3,4}  // rank doesn't match {1,?,3}
param1: {2,?,3}    // the "2" doesn't match the "1"
param1: {?,?,3}    // the new shape is too relaxed: it doesn't require 1 for the first dim

Note that validation errors can potentially occur during cloning. For example:

n = Parameter{shape=?}
m = Parameter{shape=?}
x = n + m
f = Function(x,{n,m})

If we specialize n to the shape {1,2,3} and m to the shape {4,5,6}, cloning will fail because when we reconstruct the new x node, it will see that the shapes are inconsistent for elementwise add.

Specialization of element types is also possible: element::dynamic can be specialized to a concrete element type or left dynamic; but a concrete element type can only be specialized to itself (e.g., specialization does not allow you to change element::i32 to element::i64).

Finally, it is possible to specialize parameter values. If the ith element of parameter_values is not nullptr, and fully static element type and shape has been specified for the ith parameter, a Constant node will be created and substituted for the ith parameter, with its data drawn from parameter_values[i]. Note that the Parameter node remains (in order to maintain the arity of the function), but will no longer have any users.

It is required that:

  1. The length of parameter_element_types, parameter_shapes, and parameter_values is the same as the number of f’s parameters.

  2. Each shape in parameter_shapes is a refinement of the shape of the corresponding parameter of f. Roughly speaking, a shape s1 is said to “refine” s2 if s1 can be obtained from s2 by filling in s2’s question marks. See PartialShape::refines for more details.

  3. For all i, either the element type of fp_i is dynamic, or fp_i is the same as parameter_element_types[i]. (Here fp_i is the ith parameter of f.)

  4. For all i where parameter_values[i] != nullptr and parameter_element_types[i] is static and parameter_shapes[i] is static, parameter_values[i] points to a buffer from which a Constant node with element type parameter_element_types[i] and shape parameter_shapes[i] can be created.

Parameters:

f

The function to be cloned.

parameter_element_types

The new parameter element types to substitute. Length must be equal to the number of parameters of f.

parameter_shapes

The new parameter shapes to substitute. Length must be equal to the number of parameters of f.

parameter_values

Parameter values to substitute. Length must be equal to the number of parameters of f, with nullptr indicating that no substitution is to be made for the corresponding parameter.

CheckFailure

if parameter_element_types, parameter_shapes is not valid (see details).

NodeValidationError

if node validation fails as the clone is being constructed.

Returns:

A clone of f, with the parameter element types, shapes, and values specialized.

size_t compiler_byte_size(element::Type_t et)

Return the number of bytes in the compile-time representation of the element type.

template <typename T>
T parse_string(const std::string& s)

Parses a string containing a literal of the underlying type.

NGRAPH_API float parse_string< float >(const std::string& s)

template specializations for float and double to handle INFINITY, -INFINITY and NaN values.

NGRAPH_API int8_t parse_string< int8_t >(const std::string& s)

template specializations for int8_t and uint8_t to handle the fact that default implementation ends up treating values as characters so that the number “0” turns into the parsed value 48, which is it’s ASCII value

template <typename T>
std::vector<T> parse_string(const std::vector<std::string>& ss)

Parses a list of strings containing literals of the underlying type.

NGRAPH_API void parse_version_string(
    std::string version,
    size_t& major,
    size_t& minor,
    size_t& patch,
    std::string& extra
    )

Function to query parsed version information of the version of ngraph which contains this function. Version information strictly follows Semantic Versioning http://semver.org.

Throws a runtime_error if there is an error during parsing

Parameters:

version

The major part of the version

major

Returns the major part of the version

minor

Returns the minor part of the version

patch

Returns the patch part of the version

extra

Returns the extra part of the version. This includes everything following the patch version number.

PartialShape validate_and_infer_convolution_forward_output_shape(
    const Node \* node,
    const Rank& result_ps_rank,
    const PartialShape& data_batch_pshape,
    const PartialShape& filters_pshape,
    const op::PadType auto_pad,
    Strides& strides,
    Strides& dilations,
    CoordinateDiff& pads_begin,
    CoordinateDiff& pads_end
    )

Validates input shape ranks and infers convolution forward output shape.

Parameters:

node

Node with convolution operation.

data_batch_pshape

Partial shape of data batch input.

filters_pshape

Partial shape of filters input.

auto_pad

Type of padding.

strides

Strides.

dilations

Dilations.

pads_begin

Pads begin.

pads_end

Pads end.

Returns:

Partial shape of the output.

NGRAPH_API bool try_apply_auto_padding(
    const PartialShape& 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
    )

Apply auto padding to padding_above and padding_below inputs if all needed informations are known.

Parameters:

image_shape

The shape of input image.

filter_shape

The shape of filter input.

filter_strides

The strides of applied padding.

filter_dilations

The dilations of applied padding.

pad_type

The type of padding. Auto padding is applied only for SAME_UPPER and SAME_LOWER mode.

padding_above

The beginning of padding shape.

end

The beginning of padding shape.

Returns:

true if auto padding was applied successfully (all needed informations such as spatial dims are known), false otherwise.

NGRAPH_API std::pair<bool, uint64_t> maximum_value(const Output<Node>& value)

Try to compute the maximum value of value.

Deprecated Use evaluate_upper_bound instead

Returns:

(true, max_value) if can be determined, or (false, numeric_limits<uint64_t>::max()) if not.

NGRAPH_API void evaluate_nodes(
    std::map<RawNodeOutput, HostTensorPtr>& value_map,
    std::map<RawNodeOutput, HostTensorPtr>& output_tensor_map,
    const OutputVector& outputs,
    const EvaluationContext& evaluation_context = EvaluationContext()
    )

Evaluates outputs, treating values in value_map as already computed. value_map is updated.

Parameters:

value_map

Key is RawNodeOutput in graph, value is the computed value. Updated by the function.

output_tensor_map

Tensors to use for particular outputs

outputs

Root set of values to try to compute

evaluation_context

Storage of additional settings and attributes that can be used when evaluating the function. This additional information can be shared across nodes.

NGRAPH_API HostTensorPtr evaluate_lower_bound(const Output<Node>& output)

Evaluates lower value estimation of the output tensor. Traverses graph up to deduce estimation through it.

Parameters:

Node

output pointing to the tensor for estimation.

Returns:

HostTensorPtr to estimated value if can be determined, or nullptr.

NGRAPH_API HostTensorPtr evaluate_upper_bound(const Output<Node>& output)

Evaluates lower value estimation of the output tensor. Traverses graph up to deduce estimation through it.

Parameters:

output

Tensor to be estimated.

Returns:

HostTensorPtr to estimated value if can be determined, or nullptr.

NGRAPH_API std::pair<HostTensorPtr, HostTensorPtr> evaluate_both_bounds(const Output<Node>& output)

Evaluates lower and upper value estimations of the output tensor. Traverses graph up to deduce estimation through it.

Parameters:

output

Node output pointing to the tensor for estimation.

Returns:

pair with HostTensorPtrs for lower and upper value estimation. Each object in pair could be HostTensorPtr to estimated value if particular bound can be determined, or nullptr.

NGRAPH_API bool default_upper_bound_evaluator(
    const Node \* node,
    const HostTensorVector& output_values
    )

Estimates upper bound for node output tensors using only upper bounds of the nodes inputs.

Parameters:

node

Operation to be performed

output_values

Vector of HostTensorPtrs representing resulting upper value estimations

Returns:

boolean status if value evaluation was successful.

NGRAPH_API bool default_lower_bound_evaluator(
    const Node \* node,
    const HostTensorVector& output_values
    )

Estimates lower bound for node output tensors using only lower bounds of the nodes inputs.

Parameters:

node

Operation to be performed

output_values

Vector of HostTensorPtrs representing resulting lower value estimations

Returns:

boolean status if value evaluation was successful.

NGRAPH_API bool interval_bound_evaluator(
    const Node \* node,
    const HostTensorVector& lower_output_values,
    const HostTensorVector& upper_output_values
    )

Estimates both bounds for node output tensors using both bounds of inputs. Works for operations with two inputs (in_1 and in_2). Brute forces all the pairs of bounds for inputs and evaluates all of them: {in_1_lower, in_2 lower}, {in_1_lower, in_2 upper}, {in_1_upper, in_2_lower}, {in_1_upper, in_2_upper}. Lower and upper values are selected from all the outputs calculated using input pairs.

Parameters:

node

Operation to be performed

output_values

Vector of HostTensorPtrs representing resulting lower value estimations

Returns:

boolean status if value evaluation was successful.

NGRAPH_API bool host_tensor_is_positive(const HostTensorPtr& bound)

Checks if all the elements of the bound HostTensor are positive.

NGRAPH_API bool has_and_set_equal_bounds(const Output<Node>& source)

Checks if lower and upper bounds of the corresponding tensor are set (not nullptr) and pointers are the same. It doesn’t check if lower and upper values are the same relying only on pointers comparison.

NGRAPH_API std::shared_ptr<op::Constant> get_constant_max_of_type(element::Type_t t)

Returns a Constant storing scalar value equal to std::numeric_limits<t>::max()

NGRAPH_API std::shared_ptr<op::Constant> get_constant_min_of_type(element::Type_t t)

Returns a Constant storing scalar value equal to std::numeric_limits<t>::min()

NGRAPH_API std::shared_ptr<op::Constant> get_constant_lowest_of_type(element::Type_t t)

Returns a Constant storing scalar value equal to std::numeric_limits<t>::lowest()

NGRAPH_API bool validate_host_tensor_vector(
    const HostTensorVector& v,
    const size_t& size
    )

Checks if size of HostTensorVector is the same as passed size attribute. Then checks that all the HostTensorPtrs are not equal to nullptr.

NGRAPH_API void get_version(
    size_t& major,
    size_t& minor,
    size_t& patch,
    std::string& extra
    )

Function to query parsed version information of the version of ngraph which contains this function. Version information strictly follows Semantic Versioning http://semver.org.

Throws a runtime_error if there is an error during parsing

Parameters:

major

Returns the major part of the version

minor

Returns the minor part of the version

patch

Returns the patch part of the version

extra

Returns the extra part of the version. This includes everything following the patch version number.