MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / fuse_layer

Function fuse_layer

src/graph/mutators/NodeFusionMutator.cpp:320–342  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

318
319template <typename N1, typename N2, typename F, typename... Args>
320void fuse_layer(Graph &g, std::function<bool(INode &)> const &prec, const F fuse_fcn, Args &&...optional_arguments)
321{
322 // Note that fused nodes may be added to the end of the node list.
323 // Instead of only looping over the original list of nodes, we loop over the current node list which could be growing.
324 // This is intentional as it probes the newly added fused nodes for further fusing opportunities.
325 for (unsigned int i = 0; i < g.nodes().size(); ++i)
326 {
327 auto node = g.node(i);
328 // Check if the node is of type N1 and not a branching node
329 if (node && node->type() == N1::node_type && node->output_edges().size() == 1)
330 {
331 const auto output_edge_id = *node->output_edges().begin();
332 const auto output_edge = g.edge(output_edge_id);
333
334 // Check if following node is a type N2 node
335 if ((output_edge != nullptr) && (output_edge->consumer() != nullptr) &&
336 (output_edge->consumer()->type() == N2::node_type) && prec(*output_edge->producer()))
337 {
338 fuse_fcn(g, output_edge, optional_arguments...);
339 }
340 }
341 }
342}
343
344template <typename N1, typename F, typename... Args>
345void fuse_layer(Graph &g, std::function<bool(INode &)> const &prec, const F fuse_fcn, Args &&...optional_arguments)

Callers

nothing calls this directly

Calls 7

nodeMethod · 0.80
edgeMethod · 0.80
consumerMethod · 0.80
producerMethod · 0.80
sizeMethod · 0.45
typeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected