Skip to content

Commit f1bc50e

Browse files
committed
Reverted: DefaultGraphStack: Perf-ops
1 parent 3a42d80 commit f1bc50e

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

src/TensorFlowNET.Core/Graphs/DefaultGraphStack.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,24 @@ namespace Tensorflow
2727
/// </summary>
2828
public class DefaultGraphStack
2929
{
30-
private readonly List<StackModel> stack = new List<StackModel>();
30+
private readonly List<StackModel> _stack = new List<StackModel>();
3131

3232
public void set_controller(Graph @default)
3333
{
34-
if (!stack.Exists(x => x.Graph == @default))
35-
stack.Add(new StackModel {Graph = @default, IsDefault = true});
34+
if (!_stack.Exists(x => x.Graph == @default))
35+
_stack.Add(new StackModel {Graph = @default, IsDefault = true});
3636

37-
foreach (var s in stack)
37+
foreach (var s in _stack)
3838
s.IsDefault = s.Graph == @default;
3939
}
4040

4141
public Graph get_controller()
4242
{
43-
if (stack.Count(x => x.IsDefault) == 0)
44-
stack.Add(new StackModel {Graph = tf.Graph(), IsDefault = true});
45-
for (var i = stack.Count - 1; i >= 0; i--)
43+
if (_stack.Count(x => x.IsDefault) == 0)
44+
_stack.Add(new StackModel {Graph = tf.Graph(), IsDefault = true});
45+
for (var i = _stack.Count - 1; i >= 0; i--)
4646
{
47-
var x = stack[i];
47+
var x = _stack[i];
4848
if (x.IsDefault)
4949
return x.Graph;
5050
}
@@ -54,16 +54,16 @@ public Graph get_controller()
5454

5555
public bool remove(Graph g)
5656
{
57-
if (stack.Count == 0)
57+
if (_stack.Count == 0)
5858
return false;
5959

60-
var sm = stack.Find(model => model.Graph == g);
61-
return sm != null && stack.Remove(sm);
60+
var sm = _stack.Find(model => model.Graph == g);
61+
return sm != null && _stack.Remove(sm);
6262
}
6363

6464
public void reset()
6565
{
66-
stack.Clear();
66+
_stack.Clear();
6767
}
6868

6969
private class StackModel

0 commit comments

Comments
 (0)