diff --git a/test/TensorFlowNET.UnitTest/control_flow_ops_test/CondTestCases.cs b/test/TensorFlowNET.UnitTest/control_flow_ops_test/CondTestCases.cs index 75e35716..14b6d686 100644 --- a/test/TensorFlowNET.UnitTest/control_flow_ops_test/CondTestCases.cs +++ b/test/TensorFlowNET.UnitTest/control_flow_ops_test/CondTestCases.cs @@ -19,10 +19,10 @@ namespace TensorFlowNET.UnitTest.control_flow_ops_test with(tf.Session(graph), sess => { var x = tf.constant(2, name: "x"); - var y = tf.constant(5, name: "y"); + var y = tf.constant(5, name: "y"); - var z = control_flow_ops.cond(tf.less(x, y), - () => tf.constant(22, name: "t22"), + var z = control_flow_ops.cond(tf.less(x, y), + () => tf.constant(22, name: "t22"), () => tf.constant(55, name: "f55")); int result = z.eval(sess); @@ -40,8 +40,8 @@ namespace TensorFlowNET.UnitTest.control_flow_ops_test var x = tf.constant(2, name: "x"); var y = tf.constant(1, name: "y"); - var z = control_flow_ops.cond(tf.less(x, y), - () => tf.constant(22, name: "t22"), + var z = control_flow_ops.cond(tf.less(x, y), + () => tf.constant(22, name: "t22"), () => tf.constant(11, name: "f11")); int result = z.eval(sess); @@ -52,42 +52,36 @@ namespace TensorFlowNET.UnitTest.control_flow_ops_test [TestMethod] public void testCondTrue() { - var graph = tf.Graph().as_default(); + tf.Graph().as_default(); - with(tf.Session(graph), sess => - { - var x = tf.constant(2, name: "x"); - var y = tf.constant(5, name: "y"); + var x = tf.constant(2, name: "x"); + var y = tf.constant(5, name: "y"); - var z = control_flow_ops.cond(tf.less(x, y), - () => tf.multiply(x, 17), - () => tf.add(y, 23)); + var z = control_flow_ops.cond(tf.less(x, y), + () => tf.multiply(x, 17), + () => tf.add(y, 23)); - int result = z.eval(sess); - assertEquals(result, 34); - }); + var result = evaluate(z); + assertEquals(result, 34); } [TestMethod] public void testCondFalse() { - var graph = tf.Graph().as_default(); + tf.Graph().as_default(); - with(tf.Session(graph), sess => - { - var x = tf.constant(2); - var y = tf.constant(1); + var x = tf.constant(2); + var y = tf.constant(1); - var z = control_flow_ops.cond(tf.less(x, y), - () => tf.multiply(x, 17), - () => tf.add(y, 23)); + var z = control_flow_ops.cond(tf.less(x, y), + () => tf.multiply(x, 17), + () => tf.add(y, 23)); - int result = z.eval(sess); - assertEquals(result, 24); - }); + var result = evaluate(z); + assertEquals(result, 24); } - // NOTE: all other test python test cases of this class are either not needed due to strong typing or dest a deprecated api + // NOTE: all other python test cases of this class are either not needed due to strong typing or test a deprecated api } }