Skip to content

Commit 33c4a9a

Browse files
committed
Operation: _update_inputs works now
1 parent ec319b1 commit 33c4a9a

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/TensorFlowNET.Core/Operations/Operation.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,12 @@ public void _update_input(int index, Tensor tensor)
285285
var output = tensor._as_tf_output();
286286

287287
// Reset cached inputs.
288-
_inputs = null;// new InputList(new Tensor[] { tensor }); // is this right? original code: self._inputs_val=None
289-
// TODO: implement below code dependencies
290-
//c_api.UpdateEdge(_graph._c_graph, output, input);
288+
_inputs = null;
289+
// after the c_api call next time _inputs is accessed
290+
// the updated inputs are reloaded from the c_api
291+
c_api.TF_UpdateEdge(_graph, output, input, status);
292+
//var updated_inputs = inputs;
293+
291294
}
292295

293296
private void _assert_same_graph(Tensor tensor)

test/TensorFlowNET.UnitTest/control_flow_ops_test/CondTestCases.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ public void testCondTrue()
1919
var y = tf.constant(5);
2020
var z = control_flow_ops.cond(tf.less(x, y), () => tf.multiply(x, tf.constant(17)),
2121
() => tf.add(y, tf.constant(23)));
22-
//tf.train.export_meta_graph(@"D:\dev\tensorboard\logdir\sharp.meta", as_text: false);
22+
tf.train.export_meta_graph(@"D:\dev\tensorboard\logdir\sharp.meta", as_text: false);
2323
self.assertEquals(eval_scalar(z), 34);
2424
});
2525
}
2626

27-
[Ignore("This Test Fails due to missing edges in the graph!")]
27+
//[Ignore("This Test Fails due to missing edges in the graph!")]
2828
[TestMethod]
2929
public void testCondFalse()
3030
{

0 commit comments

Comments
 (0)