Browse Source

CondTestCases.testCondTrue passed

tags/v0.9
Oceania2018 6 years ago
parent
commit
098ffdfaf5
2 changed files with 11 additions and 5 deletions
  1. +1
    -0
      test/TensorFlowNET.UnitTest/PythonTest.cs
  2. +10
    -5
      test/TensorFlowNET.UnitTest/control_flow_ops_test/CondTestCases.cs

+ 1
- 0
test/TensorFlowNET.UnitTest/PythonTest.cs View File

@@ -136,6 +136,7 @@ namespace TensorFlowNET.UnitTest
/// <param name="tensors">A Tensor or a nested list/tuple of Tensors.</param>
/// </summary>
/// <returns> tensors numpy values.</returns>
[Obsolete("Why do we need this function? we already have Tensor.eval().")]
public object evaluate(params Tensor[] tensors)
{
// if context.executing_eagerly():


+ 10
- 5
test/TensorFlowNET.UnitTest/control_flow_ops_test/CondTestCases.cs View File

@@ -13,11 +13,16 @@ namespace TensorFlowNET.UnitTest.control_flow_ops_test
[TestMethod]
public void testCondTrue()
{
var x = tf.constant(2);
var y = tf.constant(5);
var z = control_flow_ops.cond(tf.less(x, y), () => tf.multiply(x, tf.constant(17)),
() => tf.add(y, tf.constant(23)));
self.assertEquals(self.evaluate(z), 34);
with(tf.Session(), sess =>
{
var x = tf.constant(2);
var y = tf.constant(5);
var z = control_flow_ops.cond(tf.less(x, y),
() => tf.multiply(x, tf.constant(17)),
() => tf.add(y, tf.constant(23)));
int result = z.eval(sess);
assertEquals(result, 34);
});
}
[Ignore("Todo")]


Loading…
Cancel
Save