| 178 | } |
| 179 | |
| 180 | const absl::optional<int> GraphTopologyView::GetNodeIndex( |
| 181 | const absl::string_view node_name) const { |
| 182 | DCHECK(is_initialized()) << "GraphTopologyView is not initialized"; |
| 183 | const auto it = node_name_to_index_.find(node_name); |
| 184 | DCHECK(it != node_name_to_index_.end()) << "Node doesn't exist in a graph"; |
| 185 | return it == node_name_to_index_.end() ? absl::nullopt |
| 186 | : absl::make_optional(it->second); |
| 187 | } |
| 188 | |
| 189 | const absl::optional<int> GraphTopologyView::GetNodeIndex( |
| 190 | const NodeDef& node) const { |