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

Function CopyExport

tensorflow/contrib/session_bundle/session_bundle_test.cc:56–80  ·  view source on GitHub ↗

Copy the base half_plus_two to `export_path`. Outputs the files using the passed names (typically the constants above). The Twiddler can be used to update the MetaGraphDef before output.

Source from the content-addressed store, hash-verified

54// Outputs the files using the passed names (typically the constants above).
55// The Twiddler can be used to update the MetaGraphDef before output.
56Status CopyExport(const string& export_path, const string& variables_filename,
57 const string& meta_graph_def_filename,
58 const MetaGraphDefTwiddler& twiddler) {
59 TF_RETURN_IF_ERROR(Env::Default()->CreateDir(export_path));
60 const string orig_path = test_util::TestSrcDirPath(kExportPath);
61 {
62 const string source = io::JoinPath(orig_path, kVariablesFilename);
63 const string sink = io::JoinPath(export_path, variables_filename);
64
65 string data;
66 TF_RETURN_IF_ERROR(ReadFileToString(Env::Default(), source, &data));
67 TF_RETURN_IF_ERROR(WriteStringToFile(Env::Default(), sink, data));
68 }
69 {
70 const string source = io::JoinPath(orig_path, kMetaGraphDefFilename);
71 const string sink = io::JoinPath(export_path, meta_graph_def_filename);
72
73 MetaGraphDef graph_def;
74 TF_RETURN_IF_ERROR(ReadBinaryProto(Env::Default(), source, &graph_def));
75 twiddler(&graph_def);
76 TF_RETURN_IF_ERROR(
77 WriteStringToFile(Env::Default(), sink, graph_def.SerializeAsString()));
78 }
79 return Status::OK();
80}
81
82string MakeSerializedExample(float x) {
83 tensorflow::Example example;

Callers 1

SetupExportMethod · 0.85

Calls 8

DefaultFunction · 0.85
TestSrcDirPathFunction · 0.85
ReadFileToStringFunction · 0.85
WriteStringToFileFunction · 0.85
ReadBinaryProtoFunction · 0.85
JoinPathFunction · 0.50
CreateDirMethod · 0.45
SerializeAsStringMethod · 0.45

Tested by

no test coverage detected