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

Method AddFanouts

tensorflow/core/grappler/graph_view.h:337–355  ·  view source on GitHub ↗

TODO(lyandy): Checks for self loops, Switch control dependencies, fanins exist, and all regular fanins come before controlling fanins.

Source from the content-addressed store, hash-verified

335 // TODO(lyandy): Checks for self loops, Switch control dependencies, fanins
336 // exist, and all regular fanins come before controlling fanins.
337 void AddFanouts(NodeDefT* node) {
338 int max_input_port = -1;
339 for (int i = 0; i < node->input_size(); ++i) {
340 TensorId tensor_id = ParseTensorName(node->input(i));
341 OutputPort output(nodes_[tensor_id.node()], tensor_id.index());
342
343 if (output.port_id < 0) {
344 fanouts_[output].emplace(node, -1);
345 } else {
346 max_input_port = i;
347 max_regular_output_port_[output.node] =
348 std::max(max_regular_output_port_[output.node], output.port_id);
349 fanouts_[output].emplace(node, i);
350 }
351 }
352 if (max_input_port > -1) {
353 max_regular_input_port_[node] = max_input_port;
354 }
355 }
356
357 // Access to the mutable internal state for MutableGraphView.
358 absl::flat_hash_map<absl::string_view, NodeDefT*>& nodes() { return nodes_; }

Callers

nothing calls this directly

Calls 7

ParseTensorNameFunction · 0.85
maxFunction · 0.50
input_sizeMethod · 0.45
inputMethod · 0.45
nodeMethod · 0.45
indexMethod · 0.45
emplaceMethod · 0.45

Tested by

no test coverage detected