| 21 | Operation::Operation(Node* n) : inputs_(GetInputs(n)), node_(n) {} |
| 22 | |
| 23 | Output Operation::input(int32 i) const { |
| 24 | CHECK_NOTNULL(node_); |
| 25 | CHECK_GE(i, 0); |
| 26 | CHECK_LT(i, node_->num_inputs()); |
| 27 | // Handle the case where the input was unknown at the time this |
| 28 | // Operation was constructed. |
| 29 | if (inputs_[i].first == nullptr && inputs_[i].second == -1) { |
| 30 | for (const Edge* e : node_->in_edges()) { |
| 31 | if (e->IsControlEdge()) continue; |
| 32 | if (e->dst_input() == i) { |
| 33 | return Output(e->src(), e->src_output()); |
| 34 | } |
| 35 | } |
| 36 | } |
| 37 | return Output(inputs_[i].first, inputs_[i].second); |
| 38 | } |
| 39 | |
| 40 | Output Operation::output(int32 i) const { |
| 41 | CHECK_NOTNULL(node_); |