MCPcopy Create free account
hub / github.com/cactus-compute/cactus / compute_persistent_node

Function compute_persistent_node

cactus/graph/graph_ops_tensor.cpp:447–470  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

445}
446
447void compute_persistent_node(GraphNode& node, const std::vector<std::unique_ptr<GraphNode>>& nodes, const std::unordered_map<size_t, size_t>& node_index_map) {
448 if (node.input_ids.empty()) {
449 return;
450 }
451
452 auto it = node_index_map.find(node.input_ids[0]);
453
454 if (it != node_index_map.end()) {
455 const auto& input_buffer = nodes[it->second]->output_buffer;
456
457 if (!node.output_buffer.get_data()) {
458 node.output_buffer.allocate();
459 }
460
461 std::memcpy(node.output_buffer.get_data(),
462 input_buffer.get_data(),
463 input_buffer.byte_size);
464 } else {
465 if (node.output_buffer.get_data()) {
466 return;
467 }
468 throw std::runtime_error("PERSISTENT node input not found and not populated - this should not happen");
469 }
470}

Callers

nothing calls this directly

Calls 2

get_dataMethod · 0.80
allocateMethod · 0.80

Tested by

no test coverage detected