From 0bcddfdfd72e0c465214e1ecb489bf1eccdfcf50 Mon Sep 17 00:00:00 2001 From: Eli Belash Date: Fri, 30 Aug 2019 20:55:24 +0300 Subject: [PATCH] DefaultGraphStack: Minor perf-op --- src/TensorFlowNET.Core/Graphs/DefaultGraphStack.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TensorFlowNET.Core/Graphs/DefaultGraphStack.cs b/src/TensorFlowNET.Core/Graphs/DefaultGraphStack.cs index 4d843d6b..3dc77859 100644 --- a/src/TensorFlowNET.Core/Graphs/DefaultGraphStack.cs +++ b/src/TensorFlowNET.Core/Graphs/DefaultGraphStack.cs @@ -39,7 +39,7 @@ namespace Tensorflow public Graph get_controller() { - if (_stack.Count(x => x.IsDefault) == 0) + if (_stack.Count == 0 || _stack.Count(x => x.IsDefault) == 0) _stack.Add(new StackModel {Graph = tf.Graph(), IsDefault = true}); for (var i = _stack.Count - 1; i >= 0; i--) {