Skip to content

Commit 098ffdf

Browse files
committed
CondTestCases.testCondTrue passed
1 parent 949ab3e commit 098ffdf

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

test/TensorFlowNET.UnitTest/PythonTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ protected object _eval_tensor(object tensor)
136136
/// <param name="tensors">A Tensor or a nested list/tuple of Tensors.</param>
137137
/// </summary>
138138
/// <returns> tensors numpy values.</returns>
139+
[Obsolete("Why do we need this function? we already have Tensor.eval().")]
139140
public object evaluate(params Tensor[] tensors)
140141
{
141142
// if context.executing_eagerly():

test/TensorFlowNET.UnitTest/control_flow_ops_test/CondTestCases.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,16 @@ public class CondTestCases : PythonTest
1313
[TestMethod]
1414
public void testCondTrue()
1515
{
16-
var x = tf.constant(2);
17-
var y = tf.constant(5);
18-
var z = control_flow_ops.cond(tf.less(x, y), () => tf.multiply(x, tf.constant(17)),
19-
() => tf.add(y, tf.constant(23)));
20-
self.assertEquals(self.evaluate(z), 34);
16+
with(tf.Session(), sess =>
17+
{
18+
var x = tf.constant(2);
19+
var y = tf.constant(5);
20+
var z = control_flow_ops.cond(tf.less(x, y),
21+
() => tf.multiply(x, tf.constant(17)),
22+
() => tf.add(y, tf.constant(23)));
23+
int result = z.eval(sess);
24+
assertEquals(result, 34);
25+
});
2126
}
2227

2328
[Ignore("Todo")]

0 commit comments

Comments
 (0)