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

Method soft_reset_keep_pool

cactus/graph/graph_execute.cpp:769–803  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

767}
768
769void CactusGraph::soft_reset_keep_pool() {
770 std::set<size_t> cached_node_ids;
771 for (const auto& cache_entry : weight_cache_) {
772 cached_node_ids.insert(cache_entry.second);
773 }
774
775 for (size_t pid : persistent_node_ids_) {
776 cached_node_ids.insert(pid);
777 }
778
779 size_t max_preserved_id = 0;
780 for (const auto& node : nodes_) {
781 if ((node->op_type == OpType::INPUT && node->output_buffer.external_data) ||
782 cached_node_ids.count(node->id)) {
783 max_preserved_id = std::max(max_preserved_id, node->id);
784 }
785 }
786
787 auto preserved_nodes = std::move(nodes_);
788
789 nodes_.clear();
790 node_index_map_.clear();
791
792 for (auto& node : preserved_nodes) {
793 if ((node->op_type == OpType::INPUT && node->output_buffer.external_data) ||
794 cached_node_ids.count(node->id)) {
795 size_t index = nodes_.size();
796 node_index_map_[node->id] = index;
797 nodes_.push_back(std::move(node));
798 }
799 }
800
801 next_node_id_ = max_preserved_id + 1;
802 debug_nodes_.clear();
803}

Callers 1

forward_visionMethod · 0.80

Calls 2

sizeMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected