namespace ngraph::op::util

Overview

namespace util {

// namespaces

namespace ngraph::op::util::detail;
namespace ngraph::op::util::error;

// typedefs

typedef std::shared_ptr<Node>(*)(const std::shared_ptr<Node>&, float, float) ActivationFunctionType;
typedef std::shared_ptr<util::SubGraphOp::InputDescription> InputDescriptionPtr;
typedef std::shared_ptr<util::SubGraphOp::OutputDescription> OutputDescriptionPtr;
typedef std::vector<InputDescriptionPtr> InputDescriptionVector;
typedef std::vector<OutputDescriptionPtr> OutputDescriptionVector;

// enums

enum LSTMWeightsFormat;

// structs

struct oi_pair;

// classes

class ActivationFunction;
class ArithmeticReduction;
class ArithmeticReductionKeepDims;
class BinaryElementwiseArithmetic;
class BinaryElementwiseComparison;
class BinaryElementwiseLogical;
class BroadcastBase;
class EmbeddingBagOffsetsBase;
class EmbeddingBagPackedBase;
class FFTBase;
class GatherBase;
class IndexReduction;
class LogicalReduction;
class LogicalReductionKeepDims;
class OpAnnotations;
class RNNCellBase;
class ScatterBase;
class ScatterNDBase;
class SubGraphOp;
class UnaryElementwiseArithmetic;

// global functions

std::shared_ptr<ngraph::Node> node_to_get_shape_value_of_indices_from_shape_node(
    const std::shared_ptr<ngraph::Node>& shape_node,
    const std::vector<size_t>& indices
    );

std::shared_ptr<ngraph::Node> node_to_get_shape_value_of_indices_from_shape_source(
    const ngraph::Output<ngraph::Node>& shape_source,
    const std::vector<size_t>& indices
    );

template <class T>
bool normalize_single_value(
    std::vector<T> vec,
    float& value
    );

template <class T>
bool has_op_with_type(const std::shared_ptr<const ngraph::Function>& function);

std::string create_ie_output_name(const ngraph::Output<ngraph::Node>& output);

template <typename T>
bool has_constant_value(
    const std::shared_ptr<ngraph::opset4::Constant>& constant,
    const T value,
    T epsilon = std::numeric_limits<T>::epsilon()
    );

bool get_single_value(
    const std::shared_ptr<op::Constant>& const_node,
    float& value
    );

std::shared_ptr<ngraph::Node> normalize_constant(
    const std::shared_ptr<op::Constant>& constant,
    const PartialShape& shape
    );

std::shared_ptr<ngraph::Node> broadcastTo(
    const Output<Node>& input,
    const Shape& shape
    );

std::shared_ptr<ngraph::Node> reshapeTo(
    const Output<Node>& input,
    const Shape& shape
    );

bool constantIsEqualTo(
    const std::shared_ptr<ngraph::op::Constant>& const_node,
    float value,
    float eps = 1e-5
    );

bool has_f16_constants(const std::shared_ptr<const ngraph::Function>& function);

bool check_for_broadcast(
    const ngraph::Shape& ref_shape,
    const ngraph::Shape& other_shape
    );

std::shared_ptr<ngraph::Node> activation(
    const std::string& activation_name,
    const ngraph::Output<ngraph::Node>& apply_to
    );

bool is_seq_len_provided(
    const std::shared_ptr<Node>& seq_len_input,
    int64_t max_seq_len
    );

std::shared_ptr<Node> try_fold_unary_output(const std::shared_ptr<Node>& node);

std::shared_ptr<Node> clone_try_fold(
    const std::shared_ptr<Node>& node,
    const OutputVector& inputs
    );

template <typename T, typename... Args>
std::shared_ptr<Node> make_try_fold(Args&&... args);

template <class T>
Output<Node> eltwise_fold(
    const Output<Node>& input0,
    const Output<Node>& input1
    );

ActivationFunction get_activation_func_by_name(const std::string& func_name);

std::tuple<element::Type, PartialShape> validate_and_infer_elementwise_args(
    Node* node,
    const op::AutoBroadcastSpec& autob = op::AutoBroadcastSpec()
    );

void validate_seq_input_rank_dimension(const std::vector<ngraph::PartialShape>& input);

std::shared_ptr<Node> NGRAPH_API convert_lstm_node_format(
    const Output<Node>& node,
    LSTMWeightsFormat from_format,
    LSTMWeightsFormat to_format = LSTMWeightsFormat::FICO,
    int64_t axis = 0
    );

} // namespace util

Detailed Documentation

Global Functions

ActivationFunction get_activation_func_by_name(const std::string& func_name)

Gets the activation function by name.

Parameters:

func_name

The function name

UnknownActivationFunction

When provided func_name is unknown.

Returns:

The activation function object.

void validate_seq_input_rank_dimension(const std::vector<ngraph::PartialShape>& input)

Validates static rank and dimension for provided input parameters. Additionally input_size dimension is checked for X and W inputs. Applies to LSTM, GRU and RNN Sequences.

Parameters:

input

Vector with RNNSequence-like op inputs in following order: X, initial_hidden_state, sequence_lengths, W, R and B.

std::shared_ptr<Node> NGRAPH_API convert_lstm_node_format(
    const Output<Node>& node,
    LSTMWeightsFormat from_format,
    LSTMWeightsFormat to_format = LSTMWeightsFormat::FICO,
    int64_t axis = 0
    )

Change data format of provided node.

Parameters:

node

The input node to be permuted.

from_format

Original node weights format.

to_format

Weights format to convert to.

Returns:

Node representing reshaped tensor according to to_format weights format.