21.02
|
#include <Graph.h>
Public Member Functions | |
Graph ()=default | |
Graph (GraphID id, std::string name) | |
Constructor. More... | |
Graph (const Graph &)=delete | |
Prevent instances of this class from being copied (As this class contains pointers) More... | |
Graph & | operator= (const Graph &)=delete |
Prevent instances of this class from being copy assigned (As this class contains pointers) More... | |
Graph (Graph &&)=delete | |
Prevent instances of this class from being moved (As this class contains non movable objects) More... | |
Graph & | operator= (Graph &&)=delete |
Prevent instances of this class from being moved (As this class contains non movable objects) More... | |
template<typename NT , typename... Ts> | |
NodeID | add_node (Ts &&... args) |
Adds a node to the graph. More... | |
bool | remove_node (NodeID nid) |
Remove the node with the given ID. More... | |
EdgeID | add_connection (NodeID source, size_t source_idx, NodeID sink, size_t sink_idx) |
Adds a connection between two nodes. More... | |
bool | remove_connection (EdgeID eid) |
Removes an edge (connection) More... | |
std::string | name () const |
Returns graph name. More... | |
GraphID | id () const |
Returns graph id. More... | |
const std::vector< NodeID > & | nodes (NodeType type) |
Returns graph input nodes. More... | |
std::vector< std::unique_ptr< INode > > & | nodes () |
Returns nodes of graph. More... | |
const std::vector< std::unique_ptr< INode > > & | nodes () const |
Returns nodes of graph. More... | |
const std::vector< std::unique_ptr< Edge > > & | edges () const |
Returns edges of graph. More... | |
std::vector< std::unique_ptr< Tensor > > & | tensors () |
Returns tensors of graph. More... | |
const std::vector< std::unique_ptr< Tensor > > & | tensors () const |
Returns tensors of graph. More... | |
const INode * | node (NodeID id) const |
Get node object given its id. More... | |
INode * | node (NodeID id) |
Get node object given its id. More... | |
const Edge * | edge (EdgeID id) const |
Get edge object given its id. More... | |
Edge * | edge (EdgeID id) |
Get edge object given its id. More... | |
const Tensor * | tensor (TensorID id) const |
Get tensor object given its id. More... | |
Tensor * | tensor (TensorID id) |
Get tensor object given its id. More... | |
Graph class.
Represents a multiple source - multiple sink directed graph
|
default |
Constructor.
[in] | id | Graph identification number. Can be used to differentiate between graphs. Default value 0 |
[in] | name | Graph name. Default value empty string |
Definition at line 30 of file Graph.cpp.
Prevent instances of this class from being copied (As this class contains pointers)
Prevent instances of this class from being moved (As this class contains non movable objects)
Adds a connection between two nodes.
[in] | source | ID of the source node |
[in] | source_idx | Output index of the source node |
[in] | sink | ID of the sink node |
[in] | sink_idx | Input index of the sink node |
Definition at line 69 of file Graph.cpp.
References ARM_COMPUTE_ERROR_ON, Edge::consumer_id(), Edge::consumer_idx(), Edge::id(), arm_compute::graph::NullTensorID, Edge::producer_id(), Edge::producer_idx(), enable_tracing::source, and Graph::tensor().
Referenced by GraphBuilder::add_batch_normalization_node(), GraphBuilder::add_bounding_box_transform_node(), GraphBuilder::add_convolution_node(), GraphBuilder::add_deconvolution_node(), GraphBuilder::add_depthwise_convolution_node(), GraphBuilder::add_detection_output_node(), GraphBuilder::add_detection_post_process_node(), GraphBuilder::add_elementwise_node(), GraphBuilder::add_fully_connected_layer(), GraphBuilder::add_generate_proposals_node(), GraphBuilder::add_normalize_planar_yuv_node(), GraphBuilder::add_output_node(), GraphBuilder::add_prelu_node(), GraphBuilder::add_priorbox_node(), GraphBuilder::add_roi_align_node(), GraphBuilder::add_yolo_node(), arm_compute::graph::detail::fuse_convolution_with_batch_normalization(), arm_compute::graph::detail::fuse_depthwise_convolution_with_batch_normalization(), arm_compute::graph::detail::fuse_node_with_activation(), and GroupedConvolutionMutator::mutate().
|
inline |
Adds a node to the graph.
NT | Node operation |
Ts | Arguments to operation |
[in] | args | Node arguments |
Definition at line 235 of file Graph.h.
References GemmTuner::args, INode::forward_descriptors(), Graph::node(), INode::set_graph(), INode::set_id(), and INode::type().
Referenced by GraphBuilder::add_batch_normalization_node(), GraphBuilder::add_bounding_box_transform_node(), GraphBuilder::add_const_node(), GraphBuilder::add_convolution_node(), GraphBuilder::add_deconvolution_node(), GraphBuilder::add_depthwise_convolution_node(), GraphBuilder::add_detection_output_node(), GraphBuilder::add_detection_post_process_node(), GraphBuilder::add_elementwise_node(), GraphBuilder::add_fully_connected_layer(), GraphBuilder::add_generate_proposals_node(), GraphBuilder::add_input_node(), GraphBuilder::add_normalize_planar_yuv_node(), GraphBuilder::add_output_node(), GraphBuilder::add_prelu_node(), GraphBuilder::add_priorbox_node(), GraphBuilder::add_roi_align_node(), GraphBuilder::add_yolo_node(), arm_compute::graph::detail::fuse_convolution_with_batch_normalization(), and arm_compute::graph::detail::fuse_depthwise_convolution_with_batch_normalization().
Get edge object given its id.
[in] | id | Edge ID |
Definition at line 214 of file Graph.cpp.
Referenced by arm_compute::graph::detail::all_inputs_are_visited(), arm_compute::graph::bfs(), arm_compute::graph::dfs(), arm_compute::graph::detail::fuse_layer(), arm_compute::graph::get_driving_nodes(), INode::input(), INode::input_edge(), INode::input_id(), NodeFusionMutator::mutate(), DepthConcatSubTensorMutator::mutate(), Graph::remove_connection(), and INode::set_output_tensor().
const std::vector< std::unique_ptr< Edge > > & edges | ( | ) | const |
Returns edges of graph.
Definition at line 189 of file Graph.cpp.
Referenced by DotGraphPrinter::print().
GraphID id | ( | ) | const |
Returns graph id.
Definition at line 169 of file Graph.cpp.
Referenced by GraphManager::execute_graph(), GraphManager::finalize_graph(), and GraphManager::invalidate_graph().
std::string name | ( | ) | const |
Returns graph name.
Definition at line 164 of file Graph.cpp.
Referenced by DotGraphPrinter::print().
Get node object given its id.
[in] | id | Node ID |
Definition at line 204 of file Graph.cpp.
Referenced by GraphBuilder::add_batch_normalization_node(), GraphBuilder::add_convolution_node(), GraphBuilder::add_deconvolution_node(), GraphBuilder::add_depthwise_convolution_node(), GraphBuilder::add_detection_post_process_node(), GraphBuilder::add_fully_connected_layer(), Graph::add_node(), GraphBuilder::add_normalize_planar_yuv_node(), GraphBuilder::add_scale_layer(), GraphBuilder::add_yolo_node(), arm_compute::graph::bfs(), arm_compute::graph::detail::configure_all_nodes(), ConcatLayer::create_layer(), StackLayer::create_layer(), arm_compute::graph::dfs(), arm_compute::graph::detail::fuse_convolution_with_batch_normalization(), arm_compute::graph::detail::fuse_depthwise_convolution_with_batch_normalization(), DepthConcatSubTensorMutator::mutate(), GroupedConvolutionMutator::mutate(), SplitLayerSubTensorMutator::mutate(), and Graph::remove_node().
Returns graph input nodes.
[in] | type | Type of nodes to return |
Definition at line 174 of file Graph.cpp.
References type.
Referenced by arm_compute::graph::detail::allocate_const_tensors(), arm_compute::graph::bfs(), arm_compute::graph::detail::call_all_const_node_accessors(), arm_compute::graph::detail::configure_all_nodes(), arm_compute::graph::dfs(), arm_compute::graph::force_target_to_graph(), arm_compute::graph::detail::fuse_layer(), InPlaceOperationMutator::mutate(), DepthConcatSubTensorMutator::mutate(), GroupedConvolutionMutator::mutate(), SplitLayerSubTensorMutator::mutate(), DotGraphPrinter::print(), and arm_compute::graph::detail::validate_all_nodes().
std::vector< std::unique_ptr< INode > > & nodes | ( | ) |
const std::vector< std::unique_ptr< INode > > & nodes | ( | ) | const |
Prevent instances of this class from being copy assigned (As this class contains pointers)
Prevent instances of this class from being moved (As this class contains non movable objects)
bool remove_connection | ( | EdgeID | eid | ) |
Removes an edge (connection)
[in] | eid | Connection to remove |
Definition at line 118 of file Graph.cpp.
References Graph::edge(), arm_compute::graph::EmptyEdgeID, and Graph::tensor().
Referenced by Graph::remove_node().
bool remove_node | ( | NodeID | nid | ) |
Remove the node with the given ID.
[in] | nid | ID of the node to remove |
Definition at line 35 of file Graph.cpp.
References Graph::node(), and Graph::remove_connection().
Referenced by arm_compute::graph::detail::fuse_convolution_with_batch_normalization(), arm_compute::graph::detail::fuse_depthwise_convolution_with_batch_normalization(), arm_compute::graph::detail::fuse_node_with_activation(), and GroupedConvolutionMutator::mutate().
Get tensor object given its id.
[in] | id | Tensor ID |
Definition at line 224 of file Graph.cpp.
Referenced by Graph::add_connection(), arm_compute::graph::get_tensor_descriptor(), SplitLayerSubTensorMutator::mutate(), INode::output(), Graph::remove_connection(), and INode::set_output_tensor().
std::vector< std::unique_ptr< Tensor > > & tensors | ( | ) |
Returns tensors of graph.
Definition at line 194 of file Graph.cpp.
Referenced by arm_compute::graph::detail::allocate_all_tensors(), arm_compute::graph::detail::configure_all_tensors(), arm_compute::graph::force_target_to_graph(), GroupedConvolutionMutator::mutate(), and arm_compute::graph::detail::release_unused_tensors().
const std::vector< std::unique_ptr< Tensor > > & tensors | ( | ) | const |