MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / TEST

Function TEST

tensorflow/tools/benchmark/benchmark_model_test.cc:50–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50TEST(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
78TEST(BenchmarkModeTest, TextProto) {
79 const string dir = testing::TmpDir();

Callers

nothing calls this directly

Calls 12

TmpDirFunction · 0.85
CreateTestGraphFunction · 0.85
WriteStringToFileFunction · 0.85
DefaultFunction · 0.85
InitializeSessionFunction · 0.85
TimeMultipleRunsFunction · 0.85
WriteTextProtoFunction · 0.85
ExitOnErrorMethod · 0.80
JoinPathFunction · 0.50
SerializeToStringMethod · 0.45
resetMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected