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

Method GetFanin

tensorflow/core/grappler/graph_view.h:145–165  ·  view source on GitHub ↗

Gets the output port(s) in the immediate fanin of an input port.

Source from the content-addressed store, hash-verified

143
144 // Gets the output port(s) in the immediate fanin of an input port.
145 absl::flat_hash_set<OutputPort> GetFanin(const InputPort& port) const {
146 if (port.port_id >= 0) {
147 OutputPort regular_fanin = GetRegularFanin(port);
148 if (regular_fanin.node == nullptr) {
149 return {};
150 }
151 return {regular_fanin};
152 }
153
154 // Collect fanin for the control input.
155 absl::flat_hash_set<OutputPort> result;
156 const int first_control_port =
157 gtl::FindWithDefault(max_regular_input_port_, port.node, -1) + 1;
158 for (int i = first_control_port; i < port.node->input_size(); ++i) {
159 TensorId tensor_id = ParseTensorName(port.node->input(i));
160
161 auto it = nodes_.find(tensor_id.node());
162 if (it != nodes_.end()) result.emplace(it->second, tensor_id.index());
163 }
164 return result;
165 }
166
167 // Special case: regular (i.e. non-control) input ports can only have one
168 // fanin. If port.port_id is out of range or is a control dependency, then an

Callers

nothing calls this directly

Calls 8

ParseTensorNameFunction · 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

no test coverage detected