Class ov::Node¶
-
class Node : public std::enable_shared_from_this<Node>¶
Nodes are the backbone of the graph of Value dataflow. Every node has zero or more nodes as arguments and one value, which is either a tensor or a (possibly empty) tuple of values.
Subclassed by ov::op::Op, ov::pass::pattern::op::Pattern
Public Functions
-
virtual void validate_and_infer_types()¶
Verifies that attributes and inputs are consistent and computes output shapes and element types. Must be implemented by concrete child classes so that it can be run any number of times.
Throws if the node is invalid.
-
virtual const ov::op::AutoBroadcastSpec &get_autob() const¶
- Returns
the autobroadcasr spec
-
virtual bool has_evaluate() const¶
Allows to get information about availability of evaluate method for the current operation.
-
virtual bool evaluate(ov::TensorVector &output_values, const ov::TensorVector &input_values) const¶
Evaluates the op on input_values putting results in output_values.
- Parameters
output_values – Tensors for the outputs to compute. One for each result
input_values – Tensors for the inputs. One for each inputs.
- Returns
true if successful
-
virtual bool evaluate(ov::TensorVector &output_values, const ov::TensorVector &input_values, const ov::EvaluationContext &evaluationContext) const¶
Evaluates the op on input_values putting results in output_values.
- Parameters
output_values – Tensors for the outputs to compute. One for each result
input_values – Tensors for the inputs. One for each inputs.
evaluation_context – Storage of additional settings and attributes that can be used when evaluating the op.
- Returns
true if successful
-
inline virtual OutputVector decompose_op() const¶
Decomposes the FusedOp into a sub-graph consisting of core openvino ops.
- Returns
A vector of nodes comprising the sub-graph. The order of output tensors must match the match output tensors of the FusedOp
-
virtual const type_info_t &get_type_info() const = 0¶
Returns the NodeTypeInfo for the node’s class. During transition to type_info, returns a dummy type_info for Node if the class has not been updated yet.
-
void set_arguments(const NodeVector &arguments)¶
Sets/replaces the arguments with new arguments.
-
void set_arguments(const OutputVector &arguments)¶
Sets/replaces the arguments with new arguments.
-
void set_argument(size_t position, const Output<Node> &argument)¶
Sets/replaces the arguments with new arguments.
-
void set_output_size(size_t output_size)¶
Sets the number of outputs.
-
virtual std::string description() const¶
Get the string name for the type of the node, such as
Add
orMultiply
. The class name, must not contain spaces as it is used for codegen.- Returns
A const reference to the node’s type name
-
const std::string &get_name() const¶
Get the unique name of the node.
- Returns
A const reference to the node’s unique name.
-
void set_friendly_name(const std::string &name)¶
Sets a friendly name for a node. This does not overwrite the unique name of the node and is retrieved via get_friendly_name(). Used mainly for debugging. The friendly name may be set exactly once.
- Parameters
name – is the friendly name to set
-
const std::string &get_friendly_name() const¶
Gets the friendly name for a node. If no friendly name has been set via set_friendly_name then the node’s unique name is returned.
- Returns
A const reference to the node’s friendly name.
-
virtual std::ostream &write_description(std::ostream &os, uint32_t depth = 0) const¶
Writes a description of a node to a stream.
- Parameters
os – The stream; should be returned
depth – How many levels of inputs to describe
- Returns
The stream os
-
const std::vector<std::shared_ptr<Node>> &get_control_dependencies() const¶
Get control dependencies registered on the node.
This node cannot execute until node executes.
Remove the dependency of this node on node.
-
void clear_control_dependencies()¶
Remove all dependencies from this node.
-
void clear_control_dependents()¶
Remove this node as a dependency from all dependent nodes.
This node absorbs the control dependencies of source_node.
This node becomes a dependent of every node dependent on source_node.
This node’s control dependencies are replaced by replacement.
-
size_t get_output_size() const¶
Returns the number of outputs from the node.
-
const element::Type &get_output_element_type(size_t i) const¶
Returns the element type for output i.
-
const element::Type &get_element_type() const¶
Checks that there is exactly one output and returns its element type.
-
const PartialShape &get_output_partial_shape(size_t i) const¶
Returns the partial shape for output i.
-
Output<const Node> get_default_output() const¶
Return the output to use when converting to an Output<Node> with no index specified. Throws when not supported.
-
virtual size_t get_default_output_index() const¶
Returns the output of the default output, or throws if there is none.
-
size_t no_default_index() const¶
Throws no default.
-
descriptor::Tensor &get_output_tensor(size_t i) const¶
Returns the tensor for output or input i.
-
size_t get_input_size() const¶
Returns the number of inputs for the op.
-
const PartialShape &get_input_partial_shape(size_t i) const¶
Returns the partial shape of input i.
True if this and node have one output with same element type and shape.
-
NodeVector get_users(bool check_is_used = false) const¶
Get all the nodes that uses the current node.
-
inline bool operator<(const Node &other) const¶
Use instance ids for comparison instead of memory addresses to improve determinism.
-
std::vector<Input<Node>> inputs()¶
- Returns
A vector containing a handle for each of this node’s inputs, in order.
-
std::vector<Input<const Node>> inputs() const¶
- Returns
A vector containing a handle for each of this node’s inputs, in order.
-
std::vector<Output<Node>> input_values() const¶
- Returns
A vector containing the values for each input
-
std::vector<Output<Node>> outputs()¶
- Returns
A vector containing a handle for each of this node’s outputs, in order.
-
std::vector<Output<const Node>> outputs() const¶
- Returns
A vector containing a handle for each of this node’s outputs, in order.
-
Input<Node> input(size_t input_index)¶
- Throws
std::out_of_range – if the node does not have at least
input_index+1
inputs.- Returns
A handle to the
input_index
th input of this node.
-
Input<const Node> input(size_t input_index) const¶
- Throws
std::out_of_range – if the node does not have at least
input_index+1
inputs.- Returns
A handle to the
input_index
th input of this node.
-
virtual void validate_and_infer_types()¶