An explicit `num_opers` is needed so that we can distinguish between the case of no operations specified (-1) and the case of an empty set of operations specified (0).
| 175 | // case of no operations specified (-1) and the case of an empty set of |
| 176 | // operations specified (0). |
| 177 | void DefineT(int num_opers, const std::vector<TF_Operation*>& opers, |
| 178 | const std::vector<TF_Output>& inputs, |
| 179 | const std::vector<TF_Output>& outputs, |
| 180 | const std::vector<string>& output_names, |
| 181 | bool expect_failure = false) { |
| 182 | ASSERT_EQ(func_, nullptr); |
| 183 | const char** output_names_ptr = ToArray(output_names); |
| 184 | func_ = TF_GraphToFunction(func_graph_, func_name_, false, num_opers, |
| 185 | num_opers == -1 ? nullptr : opers.data(), |
| 186 | inputs.size(), inputs.data(), outputs.size(), |
| 187 | outputs.data(), output_names_ptr, |
| 188 | /*opts=*/nullptr, /*description=*/nullptr, s_); |
| 189 | delete[] output_names_ptr; |
| 190 | if (expect_failure) { |
| 191 | ASSERT_EQ(func_, nullptr); |
| 192 | return; |
| 193 | } |
| 194 | |
| 195 | ASSERT_EQ(TF_OK, TF_GetCode(s_)) << TF_Message(s_); |
| 196 | ASSERT_NE(func_, nullptr); |
| 197 | ASSERT_EQ(std::string(func_name_), std::string(TF_FunctionName(func_))); |
| 198 | TF_GraphCopyFunction(host_graph_, func_, nullptr, s_); |
| 199 | ASSERT_EQ(TF_OK, TF_GetCode(s_)) << TF_Message(s_); |
| 200 | } |
| 201 | |
| 202 | TF_Operation* Use(const std::vector<TF_Operation*>& inputs) { |
| 203 | return UseT(ToOutput(inputs)); |
nothing calls this directly
no test coverage detected