Run the host graph, which now contains a function and check that outputs are as expected. 'T' stands for 'tensor' since the outputs are tensors, not scalars.
| 86 | // outputs are as expected. |
| 87 | // 'T' stands for 'tensor' since the outputs are tensors, not scalars. |
| 88 | void RunT(const std::vector<std::pair<TF_Operation*, TF_Tensor*>>& inputs, |
| 89 | std::initializer_list<TF_Output> outputs, |
| 90 | const std::vector<std::vector<int32_t>>& expected_results) { |
| 91 | // Create a session for this graph |
| 92 | CSession csession(host_graph_, s_); |
| 93 | ASSERT_EQ(TF_OK, TF_GetCode(s_)) << TF_Message(s_); |
| 94 | |
| 95 | // Run |
| 96 | csession.SetInputs(inputs); |
| 97 | csession.SetOutputs(outputs); |
| 98 | csession.Run(s_); |
| 99 | ASSERT_EQ(TF_OK, TF_GetCode(s_)) << TF_Message(s_); |
| 100 | |
| 101 | // Check results |
| 102 | for (int i = 0; i < expected_results.size(); ++i) { |
| 103 | TF_Tensor* out = csession.output_tensor(i); |
| 104 | ASSERT_TRUE(out != nullptr); |
| 105 | EXPECT_EQ(TF_INT32, TF_TensorType(out)); |
| 106 | EXPECT_EQ(1, TF_NumDims(out)); |
| 107 | CompareInt32Tensor(expected_results[i], out); |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | // Run the host graph, which now contains a function and check that |
| 112 | // outputs are as expected. |
nothing calls this directly
no test coverage detected