Browse Source

testing with a running model

pull/858/head
Luke Bollam 4 years ago
parent
commit
1ff67ab327
3 changed files with 13 additions and 4 deletions
  1. +1
    -1
      src/TensorFlowNET.Core/Sessions/Session.cs
  2. +10
    -1
      src/TensorFlowNet.Benchmarks/Leak/SavedModelCleanup.cs
  3. +2
    -2
      src/TensorFlowNet.Benchmarks/Program.cs

+ 1
- 1
src/TensorFlowNET.Core/Sessions/Session.cs View File

@@ -39,7 +39,7 @@ namespace Tensorflow

public static Session LoadFromSavedModel(string path)
{
using var graph = new Graph();
var graph = new Graph();
using var status = new Status();
using var opt = c_api.TF_NewSessionOptions();



+ 10
- 1
src/TensorFlowNet.Benchmarks/Leak/SavedModelCleanup.cs View File

@@ -6,6 +6,7 @@ using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Tensorflow.NumPy;
using static Tensorflow.Binding;

namespace Tensorflow.Benchmark.Leak
@@ -21,7 +22,15 @@ namespace Tensorflow.Benchmark.Leak

for (var i = 0; i < 1024; i++)
{
using var sess = Session.LoadFromSavedModel(ClassifierModelPath);
using (var sess = Session.LoadFromSavedModel(ClassifierModelPath)) {
using (var g = sess.graph.as_default()) {
var inputOp = g.OperationByName("inference_input");
var outputOp = g.OperationByName("StatefulPartitionedCall");

var inp = np.zeros(new Shape(new int[] { 1, 96, 2 }));
var ops = g.OperationByName("StatefulPartitionedCall");
}
}
}
}
}


+ 2
- 2
src/TensorFlowNet.Benchmarks/Program.cs View File

@@ -14,8 +14,8 @@ namespace TensorFlowBenchmark
{
print(tf.VERSION);

/*new SavedModelCleanup().Run();
new RepeatDataSetCrash().Run();
new SavedModelCleanup().Run();
/*new RepeatDataSetCrash().Run();
new GpuLeakByCNN().Run();*/

if (args?.Length > 0)


Loading…
Cancel
Save