| 34 | } |
| 35 | |
| 36 | void Init(int ninputs) { |
| 37 | DCHECK(inputs_.empty()); |
| 38 | DCHECK_GT(ninputs, 0); |
| 39 | |
| 40 | for (int i = 0; i < ninputs; ++i) { |
| 41 | TF_Operation* placeholder = Placeholder( |
| 42 | graph_, s_, ::tensorflow::strings::StrCat("p", i).c_str()); |
| 43 | DCHECK_EQ(TF_OK, TF_GetCode(s_)) << TF_Message(s_); |
| 44 | inputs_.push_back({placeholder, 0}); |
| 45 | } |
| 46 | |
| 47 | original_graph_description_ = GraphDebugString(); |
| 48 | |
| 49 | params_.reset(new TF_WhileParams( |
| 50 | TF_NewWhile(graph_, &inputs_[0], inputs_.size(), s_))); |
| 51 | ASSERT_EQ(TF_OK, TF_GetCode(s_)) << TF_Message(s_); |
| 52 | ASSERT_EQ(original_graph_description_, GraphDebugString()) |
| 53 | << "TF_NewWhile() altered graph"; |
| 54 | |
| 55 | params_->name = "test_loop"; |
| 56 | |
| 57 | // Initialize outputs_ so we can easily detect errors/bugs |
| 58 | outputs_.resize(ninputs, {nullptr, -1}); |
| 59 | } |
| 60 | |
| 61 | void ExpectOK() { |
| 62 | TF_FinishWhile(params_.get(), s_, &outputs_[0]); |
nothing calls this directly
no test coverage detected