Skip to content

Commit 7e46d4f

Browse files
committed
CSession: Revmoed Dispose of Input and Ouput values in DeleteInputValues, ResetOutputValues
They are managed by GC.
1 parent bd18f5d commit 7e46d4f

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

test/TensorFlowNET.UnitTest/CSession.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,7 @@ public void SetInputs(Dictionary<Operation, Tensor> inputs)
4040

4141
private void DeleteInputValues()
4242
{
43-
for (var i = 0; i < input_values_.Count; ++i)
44-
{
45-
input_values_[i].Dispose();
46-
}
43+
//clearing is enough as they will be disposed by the GC unless they are referenced else-where.
4744
input_values_.Clear();
4845
}
4946

@@ -60,11 +57,7 @@ public void SetOutputs(TF_Output[] outputs)
6057

6158
private void ResetOutputValues()
6259
{
63-
for (var i = 0; i < output_values_.Count; ++i)
64-
{
65-
if (output_values_[i] != IntPtr.Zero)
66-
output_values_[i].Dispose();
67-
}
60+
//clearing is enough as they will be disposed by the GC unless they are referenced else-where.
6861
output_values_.Clear();
6962
}
7063

0 commit comments

Comments
 (0)