TensorFlow.NET
TensorFlow.NET copied to clipboard
control_flow_ops.cond not working as expected
There is a test in the solution 'testCondFalse_ConstOnly()' It asserts one condition but not another. So after modification of the test, I confirm that result comes always from false branch. The test bellow succeeds. `
[TestMethod]
public void testCondFalse_ConstOnly()
{
var graph = tf.Graph().as_default();
using (var sess = tf.Session(graph))
{
var x = tf.constant(2, name: "x");
var y = tf.constant(1, name: "y");
var z = control_flow_ops.cond(tf.greater(x, y),
() => tf.constant(22, name: "t22"),
() => tf.constant(11, name: "f11"));
int result = z.eval(sess);
assertEquals(result, 11);
}
}`
Also, the test bellow fails at first assert.
[Test]
public void ZZZ_cond()
{
using (var graph = tf.Graph().as_default())
{
using (var sess = tf.Session(graph))
{
var z = tf.cond(tf.constant(true),
() => tf.constant(22, name: "t22"),
() => tf.constant(11, name: "f11"));
var result = sess.run(z);
Assert.AreEqual(result, 22);
result = sess.run(z);
Assert.AreEqual(result, 11);
}
}