Browse Source

Operation: _update_inputs works now

tags/v0.9
Meinrad Recheis 6 years ago
parent
commit
33c4a9a45a
2 changed files with 8 additions and 5 deletions
  1. +6
    -3
      src/TensorFlowNET.Core/Operations/Operation.cs
  2. +2
    -2
      test/TensorFlowNET.UnitTest/control_flow_ops_test/CondTestCases.cs

+ 6
- 3
src/TensorFlowNET.Core/Operations/Operation.cs View File

@@ -285,9 +285,12 @@ namespace Tensorflow
var output = tensor._as_tf_output();
// Reset cached inputs.
_inputs = null;// new InputList(new Tensor[] { tensor }); // is this right? original code: self._inputs_val=None
// TODO: implement below code dependencies
//c_api.UpdateEdge(_graph._c_graph, output, input);
_inputs = null;
// after the c_api call next time _inputs is accessed
// the updated inputs are reloaded from the c_api
c_api.TF_UpdateEdge(_graph, output, input, status);
//var updated_inputs = inputs;

}

private void _assert_same_graph(Tensor tensor)


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

@@ -19,12 +19,12 @@ namespace TensorFlowNET.UnitTest.control_flow_ops_test
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)));
//tf.train.export_meta_graph(@"D:\dev\tensorboard\logdir\sharp.meta", as_text: false);
tf.train.export_meta_graph(@"D:\dev\tensorboard\logdir\sharp.meta", as_text: false);
self.assertEquals(eval_scalar(z), 34);
});
}
[Ignore("This Test Fails due to missing edges in the graph!")]
//[Ignore("This Test Fails due to missing edges in the graph!")]
[TestMethod]
public void testCondFalse()
{


Loading…
Cancel
Save