Returns a vector of the non-control input edges to a node, indexed by ID.
| 284 | |
| 285 | // Returns a vector of the non-control input edges to a node, indexed by ID. |
| 286 | Status Node::input_edges(std::vector<const Edge*>* input_edges) const { |
| 287 | input_edges->clear(); |
| 288 | input_edges->resize(num_inputs(), nullptr); |
| 289 | |
| 290 | for (const Edge* edge : in_edges()) { |
| 291 | if (edge->IsControlEdge()) continue; |
| 292 | if (edge->dst_input() < 0 || edge->dst_input() >= num_inputs()) { |
| 293 | return errors::Internal("Invalid edge input number ", edge->dst_input()); |
| 294 | } |
| 295 | if ((*input_edges)[edge->dst_input()] != nullptr) { |
| 296 | return errors::Internal("Duplicate edge input number: ", |
| 297 | edge->dst_input()); |
| 298 | } |
| 299 | (*input_edges)[edge->dst_input()] = edge; |
| 300 | } |
| 301 | |
| 302 | for (int i = 0; i < num_inputs(); ++i) { |
| 303 | if ((*input_edges)[i] == nullptr) { |
| 304 | return errors::InvalidArgument("Missing edge input number: ", i); |
| 305 | } |
| 306 | } |
| 307 | return Status::OK(); |
| 308 | } |
| 309 | |
| 310 | Status Node::input_node(int idx, Node** n) const { |
| 311 | const Edge* e; |