| @@ -88,14 +88,14 @@ namespace Tensorflow.Operations | |||||
| _values.Add(result.name); | _values.Add(result.name); | ||||
| _external_values[result.name] = result; | _external_values[result.name] = result; | ||||
| } | } | ||||
| // TODO: how to do 'with' here?? | |||||
| //with(ops.control_dependencies(null), ctrl => | |||||
| //{ | |||||
| var (r0, r1) = control_flow_ops._SwitchRefOrTensor(result, _pred); | |||||
| result = new[]{r0, r1}[_branch]; | |||||
| if (_outer_context != null) | |||||
| _outer_context.AddInnerOp(result.op); | |||||
| //}); | |||||
| with(ops.control_dependencies(null), ctrl => | |||||
| { | |||||
| var (r0, r1) = control_flow_ops._SwitchRefOrTensor(result, _pred); | |||||
| result = new[] { r0, r1 }[_branch]; | |||||
| if (_outer_context != null) | |||||
| _outer_context.AddInnerOp(result.op); | |||||
| }); | |||||
| result.op.graph.prevent_fetching(result.op); | result.op.graph.prevent_fetching(result.op); | ||||
| result.op._set_control_flow_context(this); | result.op._set_control_flow_context(this); | ||||
| @@ -22,7 +22,7 @@ namespace Tensorflow.Operations | |||||
| /// 4. A ControlFlowContext has _context_stack. | /// 4. A ControlFlowContext has _context_stack. | ||||
| /// Pushed and popped by ctxt.Enter() and ctxt.Exit() | /// Pushed and popped by ctxt.Enter() and ctxt.Exit() | ||||
| /// </summary> | /// </summary> | ||||
| public abstract class ControlFlowContext : IPython, IControlFlowContext | |||||
| public abstract class ControlFlowContext : Python, IPython, IControlFlowContext | |||||
| { | { | ||||
| /// <summary> | /// <summary> | ||||
| /// The predicate tensor in this branch | /// The predicate tensor in this branch | ||||
| @@ -35,7 +35,8 @@ namespace Tensorflow | |||||
| }; | }; | ||||
| } | } | ||||
| var condition = math_ops.reduce_all(gen_math_ops.equal(x, y)); | |||||
| var eq = gen_math_ops.equal(x, y); | |||||
| var condition = math_ops.reduce_all(eq); | |||||
| var x_static = tensor_util.constant_value(x); | var x_static = tensor_util.constant_value(x); | ||||
| var y_static = tensor_util.constant_value(y); | var y_static = tensor_util.constant_value(y); | ||||
| return control_flow_ops.Assert(condition, data); | return control_flow_ops.Assert(condition, data); | ||||