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

Function TEST

tensorflow/core/util/dump_graph_test.cc:27–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25namespace {
26
27TEST(DumpGraph, DumpGraphToFileSuccess) {
28 Graph graph(OpRegistry::Global());
29 Node* node;
30 TF_CHECK_OK(NodeBuilder("A", "NoOp").Finalize(&graph, &node));
31
32 setenv("TF_DUMP_GRAPH_PREFIX", testing::TmpDir().c_str(), 1);
33 string ret = DumpGraphToFile("graph", graph);
34 EXPECT_EQ(ret, io::JoinPath(testing::TmpDir(), "graph.pbtxt"));
35 ret = DumpGraphToFile("graph", graph);
36 EXPECT_EQ(ret, io::JoinPath(testing::TmpDir(), "graph_1.pbtxt"));
37
38 GraphDef gdef;
39 TF_CHECK_OK(ReadTextProto(
40 Env::Default(), io::JoinPath(testing::TmpDir(), "graph.pbtxt"), &gdef));
41 string read, written;
42 gdef.AppendToString(&read);
43 graph.ToGraphDefDebug().AppendToString(&written);
44 EXPECT_EQ(read, written);
45}
46
47TEST(DumpGraph, DumpGraphToFileNoEnvPrefix) {
48 Graph graph(OpRegistry::Global());

Callers

nothing calls this directly

Calls 12

TmpDirFunction · 0.85
DumpGraphToFileFunction · 0.85
ReadTextProtoFunction · 0.85
DefaultFunction · 0.85
DumpFunctionDefToFileFunction · 0.85
c_strMethod · 0.80
ToGraphDefDebugMethod · 0.80
NodeBuilderClass · 0.50
setenvFunction · 0.50
JoinPathFunction · 0.50
unsetenvFunction · 0.50
FinalizeMethod · 0.45

Tested by

no test coverage detected