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

Method GetFaninEdges

tensorflow/core/grappler/graph_view.h:299–316  ·  view source on GitHub ↗

Gets all the edges in the immediate fanin of a node. Include the controlling edges iff include_controlling_edges is true.

Source from the content-addressed store, hash-verified

297 // Gets all the edges in the immediate fanin of a node. Include the
298 // controlling edges iff include_controlling_edges is true.
299 absl::flat_hash_set<Edge> GetFaninEdges(
300 const NodeDefT& node, bool include_controlling_edges) const {
301 absl::flat_hash_set<Edge> result;
302 const int max_input_port =
303 include_controlling_edges
304 ? node.input_size() - 1
305 : gtl::FindWithDefault(max_regular_input_port_, &node, -1);
306 for (int i = 0; i <= max_input_port; ++i) {
307 TensorId tensor_id = ParseTensorName(node.input(i));
308
309 auto it = nodes_.find(tensor_id.node());
310 if (it != nodes_.end()) {
311 result.emplace(/*src=*/OutputPort(it->second, tensor_id.index()),
312 /*dst=*/InputPort(const_cast<NodeDefT*>(&node), i));
313 }
314 }
315 return result;
316 }
317
318 protected:
319 explicit GraphViewInternal(GraphDefT* graph) : graph_(graph) {}

Callers 3

CheckGraphFunction · 0.80
UpdateMergeMethod · 0.80

Calls 10

ParseTensorNameFunction · 0.85
OutputPortClass · 0.85
InputPortClass · 0.85
input_sizeMethod · 0.45
inputMethod · 0.45
findMethod · 0.45
nodeMethod · 0.45
endMethod · 0.45
emplaceMethod · 0.45
indexMethod · 0.45

Tested by 2

CheckGraphFunction · 0.64