Gets all the output ports in the immediate fanin of a node. Include the controlling nodes iff include_controlling_nodes is true.
| 226 | // Gets all the output ports in the immediate fanin of a node. Include the |
| 227 | // controlling nodes iff include_controlling_nodes is true. |
| 228 | absl::flat_hash_set<OutputPort> GetFanins( |
| 229 | const NodeDefT& node, bool include_controlling_nodes) const { |
| 230 | absl::flat_hash_set<OutputPort> result; |
| 231 | const int max_input_port = |
| 232 | include_controlling_nodes |
| 233 | ? node.input_size() - 1 |
| 234 | : gtl::FindWithDefault(max_regular_input_port_, &node, -1); |
| 235 | for (int i = 0; i <= max_input_port; ++i) { |
| 236 | TensorId tensor_id = ParseTensorName(node.input(i)); |
| 237 | |
| 238 | auto it = nodes_.find(tensor_id.node()); |
| 239 | if (it != nodes_.end()) result.emplace(it->second, tensor_id.index()); |
| 240 | } |
| 241 | return result; |
| 242 | } |
| 243 | |
| 244 | // Gets the number of ports in the immediate fanin of a node. Count the |
| 245 | // controlling nodes iff include_controlling_nodes is true. |