MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / removeNodeOfOperation

Function removeNodeOfOperation

src/backend/cpu/kernel/Array.hpp:69–91  ·  view source on GitHub ↗

Removes node_index_map whos operation matchs a unary operation \p op.

Source from the content-addressed store, hash-verified

67
68/// Removes node_index_map whos operation matchs a unary operation \p op.
69void removeNodeOfOperation(
70 std::vector<std::shared_ptr<common::Node>> &node_index_map, af_op_t op) {
71 using arrayfire::common::Node;
72
73 for (size_t nid = 0; nid < node_index_map.size(); nid++) {
74 auto &node = node_index_map[nid];
75
76 for (int i = 0;
77 i < Node::kMaxChildren && node->m_children[i] != nullptr; i++) {
78 if (node->m_children[i]->getOp() == op) {
79 // replace moddims
80 auto moddim_node = node->m_children[i];
81 node->m_children[i] = moddim_node->m_children[0];
82 }
83 }
84 }
85
86 node_index_map.erase(remove_if(begin(node_index_map), end(node_index_map),
87 [op](std::shared_ptr<Node> &node) {
88 return node->getOp() == op;
89 }),
90 end(node_index_map));
91}
92
93/// Returns the cloned output_nodes located in the node_clones array
94///

Callers 1

evalMultipleFunction · 0.85

Calls 3

beginFunction · 0.85
endFunction · 0.85
getOpMethod · 0.45

Tested by

no test coverage detected