From 34ed75132fe18f00fb0dded4e2d68fe5e2c8157f Mon Sep 17 00:00:00 2001 From: Oceania2018 Date: Thu, 1 Aug 2019 15:39:57 -0500 Subject: [PATCH] release v0.10.7.2. --- src/TensorFlowNET.Core/Graphs/Graph.cs | 4 ++-- src/TensorFlowNET.Core/Sessions/Session.cs | 14 ++++++++++---- src/TensorFlowNET.Core/TensorFlowNET.Core.csproj | 6 +++--- src/TensorFlowNET.Core/Tensors/Tensor.cs | 9 +++++---- .../ImageProcessing/RetrainImageClassifier.cs | 4 ++-- 5 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/TensorFlowNET.Core/Graphs/Graph.cs b/src/TensorFlowNET.Core/Graphs/Graph.cs index 2acc0bb7..7121e0be 100644 --- a/src/TensorFlowNET.Core/Graphs/Graph.cs +++ b/src/TensorFlowNET.Core/Graphs/Graph.cs @@ -445,12 +445,12 @@ namespace Tensorflow public void Dispose() { - if (_handle != IntPtr.Zero) + /*if (_handle != IntPtr.Zero) c_api.TF_DeleteGraph(_handle); _handle = IntPtr.Zero; - GC.SuppressFinalize(this); + GC.SuppressFinalize(this);*/ } /// diff --git a/src/TensorFlowNET.Core/Sessions/Session.cs b/src/TensorFlowNET.Core/Sessions/Session.cs index 3e7dca84..c85e0598 100644 --- a/src/TensorFlowNET.Core/Sessions/Session.cs +++ b/src/TensorFlowNET.Core/Sessions/Session.cs @@ -83,13 +83,19 @@ namespace Tensorflow public void Dispose() { - if (_session != IntPtr.Zero) + IntPtr h = IntPtr.Zero; + lock (this) + { + h = _session; + _session = IntPtr.Zero; + } + if (h != IntPtr.Zero) { var status = new Status(); - c_api.TF_DeleteSession(_session, status); + c_api.TF_DeleteSession(h, status); + status.Check(true); } - - _session = IntPtr.Zero; + GC.SuppressFinalize(this); } diff --git a/src/TensorFlowNET.Core/TensorFlowNET.Core.csproj b/src/TensorFlowNET.Core/TensorFlowNET.Core.csproj index 23200f72..00097ecc 100644 --- a/src/TensorFlowNET.Core/TensorFlowNET.Core.csproj +++ b/src/TensorFlowNET.Core/TensorFlowNET.Core.csproj @@ -5,7 +5,7 @@ TensorFlow.NET Tensorflow 1.14.0 - 0.10.7 + 0.10.7.2 Haiping Chen, Meinrad Recheis SciSharp STACK true @@ -17,7 +17,7 @@ TensorFlow, NumSharp, SciSharp, MachineLearning, TensorFlow.NET, C# Google's TensorFlow full binding in .NET Standard. Docs: https://tensorflownet.readthedocs.io - 0.10.7.0 + 0.10.7.2 Changes since v0.9.0: 1. Added full connected Convolution Neural Network example. @@ -36,7 +36,7 @@ Docs: https://tensorflownet.readthedocs.io 14. Fix TF_String endcode and decode. 15. Fix Tensor memory leak. 7.2 - 0.10.7.0 + 0.10.7.2 LICENSE true true diff --git a/src/TensorFlowNET.Core/Tensors/Tensor.cs b/src/TensorFlowNET.Core/Tensors/Tensor.cs index ab5dfcc2..606b8999 100644 --- a/src/TensorFlowNET.Core/Tensors/Tensor.cs +++ b/src/TensorFlowNET.Core/Tensors/Tensor.cs @@ -135,7 +135,9 @@ namespace Tensorflow { var status = new Status(); var output = _as_tf_output(); - return c_api.TF_GraphGetTensorNumDims(op.graph, output, status); + int ndim = c_api.TF_GraphGetTensorNumDims(op.graph, output, status); + status.Check(); + return ndim; } else { @@ -394,15 +396,14 @@ namespace Tensorflow public void Dispose() { - IntPtr h=IntPtr.Zero; + IntPtr h = IntPtr.Zero; lock (this) { h = _handle; - _handle=IntPtr.Zero; + _handle = IntPtr.Zero; } if (h != IntPtr.Zero) c_api.TF_DeleteTensor(h); - GC.SuppressFinalize(this); } diff --git a/test/TensorFlowNET.Examples/ImageProcessing/RetrainImageClassifier.cs b/test/TensorFlowNET.Examples/ImageProcessing/RetrainImageClassifier.cs index 37cb6071..187c4cc5 100644 --- a/test/TensorFlowNET.Examples/ImageProcessing/RetrainImageClassifier.cs +++ b/test/TensorFlowNET.Examples/ImageProcessing/RetrainImageClassifier.cs @@ -83,10 +83,10 @@ namespace TensorFlowNET.Examples.ImageProcess #region For debug purpose // predict images - Predict(null); + // Predict(null); // load saved pb and test new images. - Test(null); + // Test(null); #endregion