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

Function cloneNodes

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

Clones node_index_map and update the child pointers

Source from the content-addressed store, hash-verified

24
25/// Clones node_index_map and update the child pointers
26std::vector<std::shared_ptr<common::Node>> cloneNodes(
27 const std::vector<common::Node *> &node_index_map,
28 const std::vector<common::Node_ids> &ids) {
29 using arrayfire::common::Node;
30 // find all moddims in the tree
31 std::vector<std::shared_ptr<Node>> node_clones;
32 node_clones.reserve(node_index_map.size());
33 transform(begin(node_index_map), end(node_index_map),
34 back_inserter(node_clones), [](Node *n) { return n->clone(); });
35
36 for (common::Node_ids id : ids) {
37 auto &children = node_clones[id.id]->m_children;
38 for (int i = 0; i < Node::kMaxChildren && children[i] != nullptr; i++) {
39 children[i] = node_clones[id.child_ids[i]];
40 }
41 }
42 return node_clones;
43}
44
45/// Sets the shape of the buffer node_index_map under the moddims node to the
46/// new shape

Callers 1

evalMultipleFunction · 0.85

Calls 4

beginFunction · 0.85
endFunction · 0.85
transformFunction · 0.70
cloneMethod · 0.45

Tested by

no test coverage detected