MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / test_multi_graph_dump_load

Function test_multi_graph_dump_load

src/serialization/test/serializer_oss.cpp:59–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57}
58
59void test_multi_graph_dump_load(GraphDumpFormat format) {
60 auto fname = GET_OUTPUT_FILE(format);
61
62 auto dump = [&]() {
63 auto cn = CompNode::load("cpu0");
64 auto graph = ComputingGraph::make();
65 auto x = opr::ImmutableTensor::make(*graph, 1926.0817f, {cn});
66 x.rename("varz");
67 auto dumper = GraphDumper::make(OutputFile::make_fs(fname.c_str()), format);
68 // dump twice
69 dumper->dump({x});
70 dumper->dump({x});
71 };
72 auto load = [&]() {
73 GraphLoader::LoadConfig load_config = {};
74 auto loader = GraphLoader::make(InputFile::make_fs(fname.c_str()), format);
75 // load twice
76 loader->load(load_config, false);
77 loader = GraphLoader::make(loader->reset_file(), loader->format());
78 loader->load(load_config, false);
79 };
80
81 dump();
82 load();
83}
84
85void test_metadata(GraphDumpFormat format) {
86 auto fname = GET_OUTPUT_FILE(format);

Callers 1

TESTFunction · 0.85

Calls 7

renameMethod · 0.80
loadFunction · 0.50
makeFunction · 0.50
dumpMethod · 0.45
loadMethod · 0.45
reset_fileMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected