23.11
|
#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 |
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, Tensor::bind_edge(), Edge::consumer_id(), Edge::consumer_idx(), Edge::id(), arm_compute::graph::NullTensorID, Edge::producer_id(), Edge::producer_idx(), 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_pad_with_convolution(), GroupedConvolutionMutator::mutate(), and arm_compute::graph::detail::transfer_driving_nodes_and_remove_old_node().
|
inline |
Adds a node to the graph.
NT | Node operation |
Ts | Arguments to operation |
[in] | args | Node arguments |
Definition at line 234 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 223 of file Graph.cpp.
References Graph::id().
Get edge object given its id.
[in] | id | Edge ID |
Definition at line 218 of file Graph.cpp.
References Graph::id().
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_driver_nodes(), arm_compute::graph::get_driving_nodes(), INode::input(), INode::input_edge(), INode::input_id(), NodeFusionMutator::mutate(), Graph::remove_connection(), and INode::set_output_tensor().
const std::vector< std::unique_ptr< Edge > > & edges | ( | ) | const |
GraphID id | ( | ) | const |
Returns graph id.
Definition at line 173 of file Graph.cpp.
Referenced by Graph::edge(), GraphManager::execute_graph(), GraphManager::finalize_graph(), GraphManager::invalidate_graph(), Graph::node(), and Graph::tensor().
std::string name | ( | ) | const |
Get node object given its id.
[in] | id | Node ID |
Definition at line 213 of file Graph.cpp.
References Graph::id().
Get node object given its id.
[in] | id | Node ID |
Definition at line 208 of file Graph.cpp.
References Graph::id().
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(), arm_compute::graph::detail::fuse_layer(), SplitLayerSubTensorMutator::mutate(), DepthConcatSubTensorMutator::mutate(), GroupedConvolutionMutator::mutate(), and Graph::remove_node().
const std::vector< std::unique_ptr< INode > > & nodes | ( | ) |
const std::vector<std::unique_ptr<INode> >& nodes | ( | ) | const |
Returns nodes of graph.
Returns graph input nodes.
[in] | type | Type of nodes to return |
Definition at line 178 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(), SplitLayerSubTensorMutator::mutate(), DepthConcatSubTensorMutator::mutate(), GroupedConvolutionMutator::mutate(), and arm_compute::graph::detail::validate_all_nodes().
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 122 of file Graph.cpp.
References Edge::consumer(), Edge::consumer_idx(), Graph::edge(), arm_compute::graph::EmptyEdgeID, Edge::producer(), Edge::tensor(), and Tensor::unbind_edge().
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(), INode::output_edges(), Graph::remove_connection(), and INode::type().
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_pad_with_convolution(), GroupedConvolutionMutator::mutate(), and arm_compute::graph::detail::transfer_driving_nodes_and_remove_old_node().
Get tensor object given its id.
[in] | id | Tensor ID |
Definition at line 233 of file Graph.cpp.
References Graph::id().
Get tensor object given its id.
[in] | id | Tensor ID |
Definition at line 228 of file Graph.cpp.
References Graph::id().
Referenced by Graph::add_connection(), arm_compute::graph::get_tensor_descriptor(), INode::output(), and INode::set_output_tensor().
const std::vector< std::unique_ptr< Tensor > > & tensors | ( | ) |
Returns tensors of graph.
Definition at line 198 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 |
Returns tensors of graph.