MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Swap

Method Swap

tensorflow/core/kernels/incr_save_restore_ops.h:115–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113 }
114
115 void Swap(std::unordered_map<T, uint64> &indices) {
116 std::vector<std::unordered_map<T, uint64>> tmp_maps;
117 tmp_maps.resize(part_count_);
118 for (int i = 0; i < part_count_; i++) {
119 hash_maps_[i].Swap(tmp_maps[i]);
120 }
121
122 indices.clear();
123 for (int i = 0; i < part_count_; i++) {
124 for (auto it : tmp_maps[i]) {
125 auto indiceIt = indices.find(it.first);
126 if (indiceIt == indices.end()) {
127 indices[it.first] = it.second;
128 } else {
129 indices[it.first] += it.second;
130 }
131 }
132 }
133 }
134
135 void Clear() {
136 for (size_t i = 0; i < part_count_; i++) {

Callers 3

TESTFunction · 0.45
SwapIndicesMethod · 0.45
AddLeafNodesMethod · 0.45

Calls 4

resizeMethod · 0.45
clearMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by 1

TESTFunction · 0.36