| @@ -1,6 +1,7 @@ | |||||
| using Google.Protobuf; | using Google.Protobuf; | ||||
| using System; | using System; | ||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using System.IO; | |||||
| using System.Runtime.InteropServices; | using System.Runtime.InteropServices; | ||||
| using System.Text; | using System.Text; | ||||
| @@ -24,5 +25,14 @@ namespace Tensorflow | |||||
| return return_outputs; | return return_outputs; | ||||
| } | } | ||||
| public Status Import(string file_path) | |||||
| { | |||||
| var bytes = File.ReadAllBytes(file_path); | |||||
| var graph_def = new Tensorflow.Buffer(bytes); | |||||
| var opts = c_api.TF_NewImportGraphDefOptions(); | |||||
| c_api.TF_GraphImportGraphDef(_handle, graph_def, opts, Status); | |||||
| return Status; | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,5 +1,7 @@ | |||||
| using System; | using System; | ||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using System.IO; | |||||
| using System.Runtime.InteropServices; | |||||
| using System.Text; | using System.Text; | ||||
| using Tensorflow; | using Tensorflow; | ||||
| @@ -1,6 +1,7 @@ | |||||
| using Microsoft.VisualStudio.TestTools.UnitTesting; | using Microsoft.VisualStudio.TestTools.UnitTesting; | ||||
| using System; | using System; | ||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using System.IO; | |||||
| using System.Text; | using System.Text; | ||||
| using Tensorflow; | using Tensorflow; | ||||
| @@ -35,6 +36,13 @@ namespace TensorFlowNET.UnitTest | |||||
| }); | }); | ||||
| } | } | ||||
| [TestMethod] | |||||
| public void ImportGraphDefFromPbFile() | |||||
| { | |||||
| var g = new Graph(); | |||||
| var status = g.Import("mobilenet/saved_model.pb"); | |||||
| } | |||||
| [TestMethod] | [TestMethod] | ||||
| public void Save1() | public void Save1() | ||||
| { | { | ||||