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

Function SwapFanoutsMapValues

tensorflow/core/grappler/mutable_graph_view.cc:177–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175}
176
177void SwapFanoutsMapValues(FanoutsMap* fanouts,
178 const MutableGraphView::OutputPort& from_port,
179 const FanoutsMap::iterator& from_fanouts,
180 const MutableGraphView::OutputPort& to_port,
181 const FanoutsMap::iterator& to_fanouts) {
182 const bool from_exists = from_fanouts != fanouts->end();
183 const bool to_exists = to_fanouts != fanouts->end();
184
185 if (from_exists && to_exists) {
186 std::swap(from_fanouts->second, to_fanouts->second);
187 } else if (from_exists) {
188 fanouts->emplace(to_port, std::move(from_fanouts->second));
189 fanouts->erase(from_port);
190 } else if (to_exists) {
191 fanouts->emplace(from_port, std::move(to_fanouts->second));
192 fanouts->erase(to_port);
193 }
194}
195
196void SwapRegularFanoutsAndMaxPortValues(FanoutsMap* fanouts,
197 MaxOutputPortsMap* max_output_ports,

Callers 2

SwapNodeNamesMethod · 0.85

Calls 3

endMethod · 0.45
emplaceMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected