Gets the output port(s) in the immediate fanin of an input port.
| 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 |
nothing calls this directly
no test coverage detected