Data Structures | Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes
ngraph::op::util::SubGraphOp Class Reference

Abstract base class for sub-graph based ops, i.e ops that have sub-graph. More...

#include <sub_graph_base.hpp>

Inheritance diagram for ngraph::op::util::SubGraphOp:
Inheritance graph
[legend]
Collaboration diagram for ngraph::op::util::SubGraphOp:
Collaboration graph
[legend]

Data Structures

class  BodyOutputDescription
 Produces an output from a specific iteration. More...
 
class  ConcatOutputDescription
 Produces an output by concatenating an output from each iteration. More...
 
class  InputDescription
 Describes a connection between a SubGraphOp input and the body. More...
 
class  InvariantInputDescription
 Describes a body input initialized from a SubGraphOp input on the first iteration, and invariant thereafter. More...
 
class  MergedInputDescription
 Describes a body input initialized from a SubGraphOp input on the first iteration, and then a body output thereafter. More...
 
class  OutputDescription
 Describes how a SubGraphOp output is produced from the body. More...
 
class  SliceInputDescription
 Describes a body input formed from slices of an input to SubGraphOp. More...
 

Public Member Functions

virtual std::shared_ptr< Functionget_function ()
 
virtual std::shared_ptr< const Functionget_function () const
 
virtual void set_function (const std::shared_ptr< Function > &func)
 
const std::vector< std::shared_ptr< InputDescription > > & get_input_descriptions () const
 
std::vector< std::shared_ptr< InputDescription > > & get_input_descriptions ()
 
const std::vector< std::shared_ptr< OutputDescription > > & get_output_descriptions () const
 
std::vector< std::shared_ptr< OutputDescription > > & get_output_descriptions ()
 
virtual void set_sliced_input (const std::shared_ptr< Parameter > &parameter, const Output< Node > &value, int64_t start, int64_t stride, int64_t part_size, int64_t end, int64_t axis)
 Indicate that a body parameter comes from slices of a value. More...
 
virtual void set_merged_input (const std::shared_ptr< Parameter > &body_parameter, const Output< Node > &initial_value, const Output< Node > &successive_value)
 Indicates that a body parameter has an initial value in the first iteration and computed value thereafter. More...
 
virtual void set_invariant_input (const std::shared_ptr< Parameter > &body_parameter, const Output< Node > &value)
 Indicates that a body parameter has an invariant value during iteration that may depend on values computed outside of the iteration. More...
 
virtual Output< Nodeget_iter_value (const Output< Node > &body_value, int64_t iteration=-1)
 Gets a value for a particular iteration point. More...
 
virtual Output< Nodeget_concatenated_slices (const Output< Node > &value, int64_t start, int64_t stride, int64_t part_size, int64_t end, int64_t axis)
 Concatenates slices from all iterations. More...
 
 SubGraphOp (const SubGraphOp &)=delete
 
 SubGraphOp (SubGraphOp &&)=default
 
SubGraphOpoperator= (const SubGraphOp &)=delete
 
SubGraphOpoperator= (SubGraphOp &&)=default
 
int64_t get_num_iterations () const
 
- Public Member Functions inherited from ngraph::Node
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. More...
 
void constructor_validate_and_infer_types ()
 
virtual bool visit_attributes (AttributeVisitor &)
 
virtual const op::AutoBroadcastSpecget_autob () const
 
virtual bool evaluate (const HostTensorVector &output_values, const HostTensorVector &input_values) const
 Evaluates the op on input_values putting results in output_values. More...
 
virtual bool evaluate_lower (const HostTensorVector &output_values) const
 
virtual bool evaluate_upper (const HostTensorVector &output_values) const
 
virtual bool constant_fold (OutputVector &output_values, const OutputVector &inputs_values)
 
virtual OutputVector decompose_op () const
 Decomposes the FusedOp into a sub-graph consisting of core ngraph ops. More...
 
virtual const type_info_tget_type_info () const =0
 
const char * get_type_name () const
 
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_type (size_t i, const element::Type &element_type, const PartialShape &pshape)
 
void set_output_size (size_t output_size)
 Sets the number of outputs.
 
void invalidate_values ()
 
virtual void revalidate_and_infer_types ()
 
virtual std::string description () const
 Get the string name for the type of the node, such as Add or Multiply. The class name, must not contain spaces as it is used for codegen. More...
 
const std::string & get_name () const
 Get the unique name of the node. More...
 
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. More...
 
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. More...
 
virtual bool is_dynamic () const
 
size_t get_instance_id () const
 
virtual std::ostream & write_description (std::ostream &os, uint32_t depth=0) const
 Writes a description of a node to a stream. More...
 
const std::vector< std::shared_ptr< Node > > & get_control_dependencies () const
 Get control dependencies registered on the node.
 
const std::vector< Node * > & get_control_dependents () const
 Get nodes dependent on this node.
 
void add_control_dependency (std::shared_ptr< Node > node)
 This node cannot execute until node executes.
 
void remove_control_dependency (std::shared_ptr< Node > node)
 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.
 
void add_node_control_dependencies (std::shared_ptr< Node > source_node)
 This node absorbs the control dependencies of source_node.
 
void add_node_control_dependents (std::shared_ptr< Node > source_node)
 This node becomes a dependent of every node dependent on source_node.
 
void transfer_control_dependents (std::shared_ptr< Node > replacement)
 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::Typeget_output_element_type (size_t i) const
 Returns the element type for output i.
 
const element::Typeget_element_type () const
 Checks that there is exactly one output and returns its element type.
 
const Shapeget_output_shape (size_t i) const
 Returns the shape for output i.
 
const PartialShapeget_output_partial_shape (size_t i) const
 Returns the partial shape for output i.
 
Output< const Nodeget_default_output () const
 
Output< Nodeget_default_output ()
 
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.
 
const Shapeget_shape () const
 Checks that there is exactly one output and returns its shape.
 
descriptor::Tensorget_output_tensor (size_t i) const
 Returns the tensor for output or input i.
 
descriptor::Tensorget_input_tensor (size_t i) const
 
size_t get_input_size () const
 Returns the number of inputs for the op.
 
const element::Typeget_input_element_type (size_t i) const
 Returns the element type of input i.
 
const Shapeget_input_shape (size_t i) const
 Returns the shape of input i.
 
const PartialShapeget_input_partial_shape (size_t i) const
 Returns the partial shape of input i.
 
Nodeget_input_node_ptr (size_t index) const
 
std::shared_ptr< Nodeget_input_node_shared_ptr (size_t index) const
 
Output< Nodeget_input_source_output (size_t i) const
 
virtual std::shared_ptr< Nodeclone_with_new_inputs (const OutputVector &inputs) const =0
 
std::shared_ptr< Nodecopy_with_new_inputs (const OutputVector &new_args) const
 
std::shared_ptr< Nodecopy_with_new_inputs (const OutputVector &inputs, const std::vector< std::shared_ptr< Node >> &control_dependencies) const
 
bool has_same_type (std::shared_ptr< const Node > node) const
 True if this and node have one output with same element type and shape.
 
RTMap & get_rt_info ()
 
const RTMap & get_rt_info () const
 
const std::unordered_set< std::string > & get_provenance_tags () const
 
void add_provenance_tag (const std::string &tag)
 
template<typename T >
void add_provenance_tags (T tag_set)
 
void add_provenance_tags_above (const OutputVector &base, const std::unordered_set< std::string > &tag_set)
 Adds tag_set to this node and all intermediate nodes above base.
 
void remove_provenance_tag (const std::string &tag)
 
void add_provenance_group_member (const std::shared_ptr< Node > &node)
 Add node to additional nodes that receive tags.
 
void remove_provenance_group_member (const std::shared_ptr< Node > &node)
 Remove node to additional nodes that receive tags.
 
void replace_provenance_group_member (const std::shared_ptr< Node > &current_node, const std::shared_ptr< Node > &replacement_node)
 Replace current_node with replacement_node and transfer tags.
 
const std::set< std::shared_ptr< Node > > & get_provenance_group_members () const
 
std::shared_ptr< Nodeadd_provenance_group_members_above (const OutputVector &base)
 Add all nodes between this node and nodes in base as additional nodes to receive provenance tags.
 
void merge_provenance_tags_from (const std::shared_ptr< const Node > &source)
 
void transfer_provenance_tags (const std::shared_ptr< Node > &replacement)
 Transfer provenance tags to replacement.
 
NodeVector get_users (bool check_is_used=false) const
 Get all the nodes that uses the current node.
 
virtual size_t get_version () const
 
virtual std::shared_ptr< Nodeget_default_value () const
 
bool operator< (const Node &other) const
 Use instance ids for comparison instead of memory addresses to improve determinism.
 
std::vector< Input< Node > > inputs ()
 
std::vector< Input< const Node > > inputs () const
 
std::vector< Output< Node > > input_values () const
 
std::vector< Output< Node > > outputs ()
 
std::vector< Output< const Node > > outputs () const
 
Input< Nodeinput (size_t input_index)
 
Input< const Nodeinput (size_t input_index) const
 
Output< Nodeinput_value (size_t input_index) const
 
Output< Nodeoutput (size_t output_index)
 
Output< const Nodeoutput (size_t output_index) const
 
void set_op_annotations (std::shared_ptr< ngraph::op::util::OpAnnotations > op_annotations)
 
std::shared_ptr< ngraph::op::util::OpAnnotationsget_op_annotations () const
 
virtual bool match_value (pattern::Matcher *matcher, const Output< Node > &pattern_value, const Output< Node > &graph_value)
 
virtual bool match_node (pattern::Matcher *matcher, const Output< Node > &graph_value)
 

Data Fields

 NGRAPH_RTTI_DECLARATION
 
- Data Fields inherited from ngraph::Node
NGRAPH_DEPRECATED("The tensor name was deprecated. Use get_input_tensor(i).get_names() instead.") const std std::unordered_set< descriptor::Tensor * > liveness_new_list
 Returns the tensor name for input i.
 
std::unordered_set< descriptor::Tensor * > liveness_free_list
 

Protected Member Functions

Input< Nodeinput_for_value (const Output< Node > &value)
 
 SubGraphOp (const OutputVector &args)
 
- Protected Member Functions inherited from ngraph::op::Op
 Op (const OutputVector &arguments)
 
- Protected Member Functions inherited from ngraph::Node
 Node ()=default
 Construct an unitialized Node.
 
 Node (const Node &)
 Copying a node.
 
Nodeoperator= (const Node &)
 Assignment operator.
 
 Node (size_t output_size)
 Construct an unitialized Node. More...
 
 Node (const OutputVector &arguments, size_t output_size=1)
 Constructor for Node subclasses that have metaclasses. More...
 
void safe_delete (NodeVector &nodes, bool recurse)
 Moves nodes that would be deleted from inputs to nodes to avoid stack overflows on deep networks.
 
void set_input_is_relevant_to_shape (size_t i, bool relevant=true)
 Marks an input as being relevant or irrelevant to the output shapes of this node. More...
 
void set_input_is_relevant_to_value (size_t i, bool relevant=true)
 Marks an input as being relevant or irrelevant to the output values of this node. More...
 

Protected Attributes

int64_t m_num_iterations
 
std::shared_ptr< Functionm_body
 
std::vector< std::shared_ptr< op::util::SubGraphOp::InputDescription > > m_input_descriptions
 
std::vector< std::shared_ptr< op::util::SubGraphOp::OutputDescription > > m_output_descriptions
 

Additional Inherited Members

- Public Types inherited from ngraph::Node
using type_info_t = DiscreteTypeInfo
 
using RTMap = std::map< std::string, std::shared_ptr< Variant > >
 

Detailed Description

Abstract base class for sub-graph based ops, i.e ops that have sub-graph.

Member Function Documentation

◆ get_concatenated_slices()

virtual Output<Node> ngraph::op::util::SubGraphOp::get_concatenated_slices ( const Output< Node > &  value,
int64_t  start,
int64_t  stride,
int64_t  part_size,
int64_t  end,
int64_t  axis 
)
virtual

Concatenates slices from all iterations.

Parameters
valueThe value supplying slice values from each iteration.
startFirst index on axis of the slicing
strideStepping of the slice
part_sizeSize of the slice on axis
endThe last index on axis of the slicing
axisThe axis to slice along
Returns
The concatenated slices.

Reimplemented in ngraph::op::v5::Loop.

◆ get_input_descriptions() [1/2]

std::vector<std::shared_ptr<InputDescription> >& ngraph::op::util::SubGraphOp::get_input_descriptions ( )
inline
Returns
a reference to the input descriptions. Can add input descriptions before validation.

◆ get_input_descriptions() [2/2]

const std::vector<std::shared_ptr<InputDescription> >& ngraph::op::util::SubGraphOp::get_input_descriptions ( ) const
inline
Returns
a reference to the input descriptions.

◆ get_iter_value()

virtual Output<Node> ngraph::op::util::SubGraphOp::get_iter_value ( const Output< Node > &  body_value,
int64_t  iteration = -1 
)
virtual

Gets a value for a particular iteration point.

Parameters
body_valueThe value
iterationThe iteration that supplies the value. Negative values are from the last iteration. Default value -1 (the last iteration).
Returns
The iterator value.

◆ get_output_descriptions() [1/2]

std::vector<std::shared_ptr<OutputDescription> >& ngraph::op::util::SubGraphOp::get_output_descriptions ( )
inline
Returns
a reference to the output descriptions. Can add output descriptions before validation.

◆ get_output_descriptions() [2/2]

const std::vector<std::shared_ptr<OutputDescription> >& ngraph::op::util::SubGraphOp::get_output_descriptions ( ) const
inline
Returns
a reference to the output descriptions.

◆ set_invariant_input()

virtual void ngraph::op::util::SubGraphOp::set_invariant_input ( const std::shared_ptr< Parameter > &  body_parameter,
const Output< Node > &  value 
)
virtual

Indicates that a body parameter has an invariant value during iteration that may depend on values computed outside of the iteration.

Parameters
body_parameterThe body parameter
valueThe value supplied as an input to the block

◆ set_merged_input()

virtual void ngraph::op::util::SubGraphOp::set_merged_input ( const std::shared_ptr< Parameter > &  body_parameter,
const Output< Node > &  initial_value,
const Output< Node > &  successive_value 
)
virtual

Indicates that a body parameter has an initial value in the first iteration and computed value thereafter.

Parameters
[in]body_parameterThe body parameter
initial_valueValue for the parameter in first iteration. This will be added as an input to Loop.
successive_valueValue for the parameter in successive iterations. The value is what is active in the most recent completed iteration.

◆ set_sliced_input()

virtual void ngraph::op::util::SubGraphOp::set_sliced_input ( const std::shared_ptr< Parameter > &  parameter,
const Output< Node > &  value,
int64_t  start,
int64_t  stride,
int64_t  part_size,
int64_t  end,
int64_t  axis 
)
virtual

Indicate that a body parameter comes from slices of a value.

Parameters
parameterThe parameter to receive the slices
valueThe value to be sliced. This will be added as an input to SubGraphOp.
startFirst index on axis of the slicing
strideStepping of the slice
part_sizeSize of the slice on axis
endThe last index on axis of the slicing
axisThe axis to slice along

Field Documentation

◆ m_num_iterations

int64_t ngraph::op::util::SubGraphOp::m_num_iterations
protected
Initial value:
=
-1

The documentation for this class was generated from the following file: