1 | /* Copyright 2017 The TensorFlow Authors. All Rights Reserved. |
2 | |
3 | Licensed under the Apache License, Version 2.0 (the "License"); |
4 | you may not use this file except in compliance with the License. |
5 | You may obtain a copy of the License at |
6 | |
7 | http://www.apache.org/licenses/LICENSE-2.0 |
8 | |
9 | Unless required by applicable law or agreed to in writing, software |
10 | distributed under the License is distributed on an "AS IS" BASIS, |
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | See the License for the specific language governing permissions and |
13 | limitations under the License. |
14 | ==============================================================================*/ |
15 | |
16 | #include "tensorflow/core/graph/while_context.h" |
17 | |
18 | namespace tensorflow { |
19 | |
20 | WhileContext::WhileContext(StringPiece frame_name, |
21 | std::vector<Node*> enter_nodes, |
22 | std::vector<Node*> exit_nodes, |
23 | OutputTensor cond_output, |
24 | std::vector<OutputTensor> body_inputs, |
25 | std::vector<OutputTensor> body_outputs) |
26 | : frame_name_(frame_name), |
27 | enter_nodes_(std::move(enter_nodes)), |
28 | exit_nodes_(std::move(exit_nodes)), |
29 | cond_output_(cond_output), |
30 | body_inputs_(std::move(body_inputs)), |
31 | body_outputs_(std::move(body_outputs)) { |
32 | const size_t num_loop_vars = enter_nodes_.size(); |
33 | DCHECK_EQ(exit_nodes_.size(), num_loop_vars); |
34 | DCHECK_EQ(body_inputs_.size(), num_loop_vars); |
35 | DCHECK_EQ(body_outputs_.size(), num_loop_vars); |
36 | } |
37 | |
38 | } // namespace tensorflow |
39 | |