| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 4eccba4 commit 1088e1f
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,7 @@ | |||
| 1 | 1 | using Google.Protobuf; | |
| 2 | 2 | using System; | |
| 3 | 3 | using System.Collections.Generic; | |
| 4 | + using System.IO; | ||
| 4 | 5 | using System.Runtime.InteropServices; | |
| 5 | 6 | using System.Text; | |
| 6 | 7 | ||
@@ -24,5 +25,14 @@ public unsafe TF_Output[] ImportGraphDefWithReturnOutputs(Buffer graph_def, Impo | |||
| 24 | 25 | ||
| 25 | 26 | return return_outputs; | |
| 26 | 27 | } | |
| 28 | + | ||
| 29 | + public Status Import(string file_path) | ||
| 30 | + { | ||
| 31 | + var bytes = File.ReadAllBytes(file_path); | ||
| 32 | + var graph_def = new Tensorflow.Buffer(bytes); | ||
| 33 | + var opts = c_api.TF_NewImportGraphDefOptions(); | ||
| 34 | + c_api.TF_GraphImportGraphDef(_handle, graph_def, opts, Status); | ||
| 35 | + return Status; | ||
| 36 | + } | ||
| 27 | 37 | } | |
| 28 | 38 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,7 @@ | |||
| 1 | 1 | using System; | |
| 2 | 2 | using System.Collections.Generic; | |
| 3 | + using System.IO; | ||
| 4 | + using System.Runtime.InteropServices; | ||
| 3 | 5 | using System.Text; | |
| 4 | 6 | using Tensorflow; | |
| 5 | 7 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,7 @@ | |||
| 1 | 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; | |
| 2 | 2 | using System; | |
| 3 | 3 | using System.Collections.Generic; | |
| 4 | + using System.IO; | ||
| 4 | 5 | using System.Text; | |
| 5 | 6 | using Tensorflow; | |
| 6 | 7 | ||
@@ -35,6 +36,13 @@ public void ImportSavedModel() | |||
| 35 | 36 | }); | |
| 36 | 37 | } | |
| 37 | 38 | ||
| 39 | + [TestMethod] | ||
| 40 | + public void ImportGraphDefFromPbFile() | ||
| 41 | + { | ||
| 42 | + var g = new Graph(); | ||
| 43 | + var status = g.Import("mobilenet/saved_model.pb"); | ||
| 44 | + } | ||
| 45 | + | ||
| 38 | 46 | [TestMethod] | |
| 39 | 47 | public void Save1() | |
| 40 | 48 | { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments