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

Function FillInputs

tensorflow/core/graph/optimizer_cse.cc:68–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66};
67
68static void FillInputs(const Node* n,
69 gtl::InlinedVector<const Node*, 4>* control_edges,
70 gtl::InlinedVector<std::pair<const Node*, int>, 4>* in) {
71 DCHECK_EQ(in->size(), n->num_inputs());
72 control_edges->clear();
73 for (const Edge* e : n->in_edges()) {
74 if (e->IsControlEdge()) {
75 control_edges->push_back(e->src());
76 } else {
77 (*in)[e->dst_input()] = std::make_pair(e->src(), e->src_output());
78 }
79 }
80 std::sort(control_edges->begin(), control_edges->end());
81 if (n->op_def().is_commutative()) {
82 // For commutative inputs, we sort the input by the input Node*
83 // to get a canonical ordering (so that add(a,b) and add(b, a) will
84 // hash to the same value if is_commutative is true for 'add').
85 std::sort(in->begin(), in->end());
86 }
87}
88
89static size_t kIllegalNodeHash = 0;
90

Callers 2

NodeHashMethod · 0.70
EquivalentMethod · 0.70

Calls 12

sortFunction · 0.85
sizeMethod · 0.45
num_inputsMethod · 0.45
clearMethod · 0.45
IsControlEdgeMethod · 0.45
push_backMethod · 0.45
srcMethod · 0.45
dst_inputMethod · 0.45
src_outputMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
op_defMethod · 0.45

Tested by

no test coverage detected