| 992 | } |
| 993 | |
| 994 | inline gtl::iterator_range<NodeIter> Graph::op_nodes() const { |
| 995 | // Note that NodeId 0 is always valid since we don't let the source |
| 996 | // node be removed from the graph. |
| 997 | // |
| 998 | // The current implementation of Graph maintains the invariant that the |
| 999 | // first two nodes are the source and sink nodes, and all other nodes are op |
| 1000 | // nodes. This method (op_nodes()) relies on this invariant. |
| 1001 | NodeIter begin(this, 0); |
| 1002 | NodeIter end(this, num_node_ids()); |
| 1003 | if (begin != end) { |
| 1004 | ++begin; |
| 1005 | } |
| 1006 | if (begin != end) { |
| 1007 | ++begin; |
| 1008 | } |
| 1009 | return gtl::make_range(begin, end); |
| 1010 | } |
| 1011 | |
| 1012 | inline void Node::set_assigned_device_name_index(int index) { |
| 1013 | graph_->CheckDeviceNameIndex(index); |