_ControlDependenciesController: fixed a bug related to stack ordertags/v0.9
| @@ -10,18 +10,8 @@ namespace Tensorflow | |||||
| { | { | ||||
| public IControlFlowContext _control_flow_context; | public IControlFlowContext _control_flow_context; | ||||
| private Queue<_ControlDependenciesController> _graph_control_dependencies_stack = new Queue<_ControlDependenciesController>(); | |||||
| public Queue<_ControlDependenciesController> _control_dependencies_stack | |||||
| { | |||||
| get | |||||
| { | |||||
| return _graph_control_dependencies_stack; | |||||
| } | |||||
| set | |||||
| { | |||||
| _graph_control_dependencies_stack = value; | |||||
| } | |||||
| } | |||||
| // represents the nested with(...) statements | |||||
| public List<_ControlDependenciesController> _control_dependencies_stack { get; set; } = new List<_ControlDependenciesController>(); | |||||
| /// <summary> | /// <summary> | ||||
| /// For an op that takes `input_ops` as inputs, compute control inputs. | /// For an op that takes `input_ops` as inputs, compute control inputs. | ||||
| @@ -122,12 +112,12 @@ namespace Tensorflow | |||||
| public void _push_control_dependencies_controller(_ControlDependenciesController controller) | public void _push_control_dependencies_controller(_ControlDependenciesController controller) | ||||
| { | { | ||||
| _control_dependencies_stack.Enqueue(controller); | |||||
| _control_dependencies_stack.Add(controller); | |||||
| } | } | ||||
| public void _pop_control_dependencies_controller(_ControlDependenciesController controller) | public void _pop_control_dependencies_controller(_ControlDependenciesController controller) | ||||
| { | { | ||||
| _control_dependencies_stack.Dequeue(); | |||||
| _control_dependencies_stack.RemoveAt(_control_dependencies_stack.Count-1); | |||||
| } | } | ||||
| /// <summary> | /// <summary> | ||||
| @@ -13,7 +13,7 @@ namespace Tensorflow | |||||
| private Graph _graph; | private Graph _graph; | ||||
| private List<ITensorOrOperation> _control_inputs_val; | private List<ITensorOrOperation> _control_inputs_val; | ||||
| private List<ITensorOrOperation> _seen_nodes; | private List<ITensorOrOperation> _seen_nodes; | ||||
| private Queue<_ControlDependenciesController> _old_stack; | |||||
| private List<_ControlDependenciesController> _old_stack; | |||||
| private bool _new_stack; | private bool _new_stack; | ||||
| private IControlFlowContext _old_control_flow_context; | private IControlFlowContext _old_control_flow_context; | ||||
| @@ -73,7 +73,7 @@ namespace Tensorflow | |||||
| { | { | ||||
| // Clear the control_dependencies graph. | // Clear the control_dependencies graph. | ||||
| _old_stack = _graph._control_dependencies_stack; | _old_stack = _graph._control_dependencies_stack; | ||||
| _graph._control_dependencies_stack = new Queue<_ControlDependenciesController>(); | |||||
| _graph._control_dependencies_stack = new List<_ControlDependenciesController>(); | |||||
| // Clear the control_flow_context too. | // Clear the control_flow_context too. | ||||
| _old_control_flow_context = _graph._get_control_flow_context(); | _old_control_flow_context = _graph._get_control_flow_context(); | ||||
| @@ -161,7 +161,6 @@ namespace TensorFlowNET.UnitTest | |||||
| AssertItemsEqual(b_1.op.control_inputs, b_2.op.control_inputs); | AssertItemsEqual(b_1.op.control_inputs, b_2.op.control_inputs); | ||||
| } | } | ||||
| [Ignore("Fails")] | |||||
| [TestMethod] | [TestMethod] | ||||
| public void TestClear() | public void TestClear() | ||||
| { | { | ||||