From 7e46d4fa937b2e5db7e8027b18df061ea19afbf8 Mon Sep 17 00:00:00 2001 From: Eli Belash Date: Tue, 27 Aug 2019 23:37:04 +0300 Subject: [PATCH] CSession: Revmoed Dispose of Input and Ouput values in DeleteInputValues, ResetOutputValues They are managed by GC. --- test/TensorFlowNET.UnitTest/CSession.cs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/test/TensorFlowNET.UnitTest/CSession.cs b/test/TensorFlowNET.UnitTest/CSession.cs index 33e88286..ae57b075 100644 --- a/test/TensorFlowNET.UnitTest/CSession.cs +++ b/test/TensorFlowNET.UnitTest/CSession.cs @@ -40,10 +40,7 @@ namespace TensorFlowNET.UnitTest private void DeleteInputValues() { - for (var i = 0; i < input_values_.Count; ++i) - { - input_values_[i].Dispose(); - } + //clearing is enough as they will be disposed by the GC unless they are referenced else-where. input_values_.Clear(); } @@ -60,11 +57,7 @@ namespace TensorFlowNET.UnitTest private void ResetOutputValues() { - for (var i = 0; i < output_values_.Count; ++i) - { - if (output_values_[i] != IntPtr.Zero) - output_values_[i].Dispose(); - } + //clearing is enough as they will be disposed by the GC unless they are referenced else-where. output_values_.Clear(); }