23.11
|
Go to the documentation of this file.
24 #ifndef ARM_COMPUTE_GRAPH_GRAPH_H
25 #define ARM_COMPUTE_GRAPH_GRAPH_H
81 template <
typename NT,
typename... Ts>
111 std::string
name()
const;
130 std::vector<std::unique_ptr<INode>> &
nodes();
137 const std::vector<std::unique_ptr<INode>> &
nodes()
const;
144 const std::vector<std::unique_ptr<Edge>> &
edges()
const;
151 std::vector<std::unique_ptr<Tensor>> &
tensors();
158 const std::vector<std::unique_ptr<Tensor>> &
tensors()
const;
225 std::string _name = {};
226 std::vector<std::unique_ptr<INode>> _nodes = {};
227 std::vector<std::unique_ptr<Edge>> _edges = {};
228 std::vector<std::unique_ptr<Tensor>> _tensors = {};
229 std::map<NodeType, std::vector<NodeID>> _tagged_nodes = {};
233 template <
typename NT,
typename... Ts>
239 NodeID nid = _nodes.size();
240 auto node = std::make_unique<NT>(std::forward<Ts>(
args)...);
245 _tagged_nodes[
node->
type()].push_back(nid);
248 for (
auto &output :
node->_outputs)
250 output = create_tensor();
257 _nodes.push_back(std::move(
node));
const Edge * edge(EdgeID id) const
Get edge object given its id.
std::lock_guard< Mutex > lock_guard
Wrapper of lock_guard data-object.
decltype(strategy::transforms) typedef type
const std::vector< std::unique_ptr< Edge > > & edges() const
Returns edges of graph.
GraphID id() const
Returns graph id.
virtual bool forward_descriptors()=0
Forwards descriptor information to outputs if possible.
EdgeID add_connection(NodeID source, size_t source_idx, NodeID sink, size_t sink_idx)
Adds a connection between two nodes.
std::mutex Mutex
Wrapper of Mutex data-object.
std::vector< std::unique_ptr< Tensor > > & tensors()
Returns tensors of graph.
NodeID add_node(Ts &&...args)
Adds a node to the graph.
void set_graph(Graph *g)
Sets the graph that this node is registered to.
virtual NodeType type() const =0
Returns node's type.
const INode * node(NodeID id) const
Get node object given its id.
bool remove_node(NodeID nid)
Remove the node with the given ID.
Copyright (c) 2017-2023 Arm Limited.
const Tensor * tensor(TensorID id) const
Get tensor object given its id.
std::string name() const
Returns graph name.
Graph & operator=(const Graph &)=delete
Prevent instances of this class from being copy assigned (As this class contains pointers)
void set_id(NodeID id)
Sets the node id.
bool remove_connection(EdgeID eid)
Removes an edge (connection)
std::vector< std::unique_ptr< INode > > & nodes()
Returns nodes of graph.