| 48 | } |
| 49 | |
| 50 | TEST(BenchmarkModelTest, InitializeAndRun) { |
| 51 | const string dir = testing::TmpDir(); |
| 52 | const string filename_pb = io::JoinPath(dir, "graphdef.pb"); |
| 53 | auto root = Scope::NewRootScope().ExitOnError(); |
| 54 | |
| 55 | benchmark_model::InputLayerInfo input; |
| 56 | string output_name; |
| 57 | GraphDef graph_def; |
| 58 | CreateTestGraph(root, &input, &output_name, &graph_def); |
| 59 | string graph_def_serialized; |
| 60 | graph_def.SerializeToString(&graph_def_serialized); |
| 61 | TF_ASSERT_OK( |
| 62 | WriteStringToFile(Env::Default(), filename_pb, graph_def_serialized)); |
| 63 | |
| 64 | std::unique_ptr<Session> session; |
| 65 | std::unique_ptr<GraphDef> loaded_graph_def; |
| 66 | TF_ASSERT_OK(benchmark_model::InitializeSession(1, filename_pb, &session, |
| 67 | &loaded_graph_def)); |
| 68 | std::unique_ptr<StatSummarizer> stats; |
| 69 | stats.reset(new tensorflow::StatSummarizer(*(loaded_graph_def.get()))); |
| 70 | int64 time; |
| 71 | int64 num_runs = 0; |
| 72 | TF_ASSERT_OK(benchmark_model::TimeMultipleRuns( |
| 73 | 0.0, 10, 0.0, {input}, {output_name}, {}, session.get(), stats.get(), |
| 74 | &time, &num_runs)); |
| 75 | ASSERT_EQ(num_runs, 10); |
| 76 | } |
| 77 | |
| 78 | TEST(BenchmarkModeTest, TextProto) { |
| 79 | const string dir = testing::TmpDir(); |
nothing calls this directly
no test coverage detected