diff --git a/src/TensorFlowNET.Core/Operations/ControlFlows/CondContext.cs b/src/TensorFlowNET.Core/Operations/ControlFlows/CondContext.cs
index a0d84e89..f32a6fa7 100644
--- a/src/TensorFlowNET.Core/Operations/ControlFlows/CondContext.cs
+++ b/src/TensorFlowNET.Core/Operations/ControlFlows/CondContext.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using System.Text;
namespace Tensorflow.Operations
@@ -92,13 +93,15 @@ namespace Tensorflow.Operations
switch (original_result)
{
+ case Tensor result:
+ return (original_result, _BuildCondTensor(new[] { result.op }));
case Operation[] results:
return (original_result, _BuildCondTensor(results));
- case Tensor tensor:
- return (original_result, tensor);
case float[] fv:
+ {
var result = ops.convert_to_tensor(fv[0]);
return (original_result, result );
+ }
default:
return (original_result, null);
}
@@ -114,7 +117,7 @@ namespace Tensorflow.Operations
switch (original_result)
{
case Tensor[] results:
- return (original_result, results);
+ return (original_result, new Tensor[] { _BuildCondTensor(results.Select(t=>t.op).ToArray())});
case Operation[] results:
return (original_result, new Tensor[] { _BuildCondTensor (results) });
case float[] fv:
diff --git a/src/TensorFlowNET.Core/Operations/Operation.Input.cs b/src/TensorFlowNET.Core/Operations/Operation.Input.cs
index 9ef89271..26c9c08c 100644
--- a/src/TensorFlowNET.Core/Operations/Operation.Input.cs
+++ b/src/TensorFlowNET.Core/Operations/Operation.Input.cs
@@ -27,9 +27,9 @@ namespace Tensorflow
for (int i = 0; i < NumInputs; i++)
{
- var tf_outpus = Input(i);
- var op = new Operation(tf_outpus.oper);
- retval[i] = op.outputs[tf_outpus.index];
+ var tf_outputs = Input(i);
+ var op = new Operation(tf_outputs.oper);
+ retval[i] = op.outputs[tf_outputs.index];
}
_inputs = new InputList(retval);
diff --git a/src/TensorFlowNET.Core/Operations/control_flow_ops.py.cs b/src/TensorFlowNET.Core/Operations/control_flow_ops.py.cs
index 40b9a461..e0f38c95 100644
--- a/src/TensorFlowNET.Core/Operations/control_flow_ops.py.cs
+++ b/src/TensorFlowNET.Core/Operations/control_flow_ops.py.cs
@@ -142,10 +142,29 @@ namespace Tensorflow
return tpl.ToArray();
});
- }
-
+ }
+
+ ///
+ /// Produces the content of `output_tensor` only after `dependencies`.
+ ///
+ /// In some cases, a user may want the output of an operation to be
+ /// consumed externally only after some other dependencies have run
+ /// first.This function ensures returns `output_tensor`, but only after all
+ /// operations in `dependencies` have run.Note that this means that there is
+ /// no guarantee that `output_tensor` will be evaluated after any `dependencies`
+ /// have run.
+ ///
+ /// See also `tf.tuple` and `tf.group`.
+ ///
+ /// Iterable of operations to run before this op finishes.
+ /// A `Tensor` or `IndexedSlices` that will be returned.
+ /// (Optional) A name for this operation.
+ /// Same as `output_tensor`.
public static Tensor with_dependencies(Operation[] dependencies, Tensor output_tensor, string name = null)
{
+ //TODO: missing original code
+ //if context.executing_eagerly():
+ // return output_tensor
var values = new List