MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / erase_candidate

Method erase_candidate

imperative/src/impl/interpreter/interpreter_impl.cpp:1704–1717  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1702}
1703
1704void ChannelImpl::DynamicSublinear::erase_candidate(TensorInfo* ptr) {
1705 // close dtr will just clear candidates, so nothing to erase
1706 if (candidates.empty()) {
1707 ptr->cand_index = UINT_MAX;
1708 return;
1709 }
1710 // some tensors may be erased already, just skip them
1711 if (ptr->cand_index != UINT_MAX) {
1712 std::swap(candidates[ptr->cand_index], candidates.back());
1713 candidates[ptr->cand_index]->cand_index = ptr->cand_index;
1714 candidates.pop_back();
1715 ptr->cand_index = UINT_MAX;
1716 }
1717}
1718
1719void ChannelImpl::DynamicSublinear::update_used_time(TensorInfo* ptr) {
1720 ptr->last_used_time = estimate_timestamp;

Callers 2

real_freeMethod · 0.80
release_tensorMethod · 0.80

Calls 4

swapFunction · 0.85
backMethod · 0.80
emptyMethod · 0.45
pop_backMethod · 0.45

Tested by

no test coverage detected