Gets all the input ports in the immediate fanout of a node. Include the controlled nodes iff include_controlled_nodes is true.
| 204 | // Gets all the input ports in the immediate fanout of a node. Include the |
| 205 | // controlled nodes iff include_controlled_nodes is true. |
| 206 | absl::flat_hash_set<InputPort> GetFanouts( |
| 207 | const NodeDefT& node, bool include_controlled_nodes) const { |
| 208 | absl::flat_hash_set<InputPort> result; |
| 209 | |
| 210 | OutputPort port; |
| 211 | port.node = const_cast<NodeDefT*>(&node); |
| 212 | const int first_port_id = include_controlled_nodes ? -1 : 0; |
| 213 | const int last_port_id = |
| 214 | gtl::FindWithDefault(max_regular_output_port_, &node, -1); |
| 215 | |
| 216 | for (int i = first_port_id; i <= last_port_id; ++i) { |
| 217 | port.port_id = i; |
| 218 | auto it = fanouts_.find(port); |
| 219 | if (it != fanouts_.end()) { |
| 220 | result.insert(it->second.begin(), it->second.end()); |
| 221 | } |
| 222 | } |
| 223 | return result; |
| 224 | } |
| 225 | |
| 226 | // Gets all the output ports in the immediate fanin of a node. Include the |
| 227 | // controlling nodes iff include_controlling_nodes is true. |