You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

GraphBuildTest.cs 1.2 kB

1234567891011121314151617181920212223242526272829303132333435
  1. using Microsoft.VisualStudio.TestTools.UnitTesting;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. using System.Linq;
  6. using Tensorflow;
  7. using static Tensorflow.Binding;
  8. namespace TensorFlowNET.UnitTest.NativeAPI
  9. {
  10. [TestClass]
  11. public class GraphBuildTest : CApiTest
  12. {
  13. [TestMethod, Ignore("Waiting to merge https://github.com/tensorflow/tensorflow/pull/43383")]
  14. public void UpdateEdge()
  15. {
  16. using var graph = new Graph().as_default();
  17. var one = tf.constant(1, name: "one");
  18. var two = tf.constant(2, name: "two");
  19. var add = tf.add(one, two, name: "add");
  20. var neg = tf.negative(add, name: "neg");
  21. Assert.AreEqual(1, one.consumers().Length);
  22. Assert.AreEqual("add", neg.op.node_def.Input[0]);
  23. // update edge
  24. neg.op._update_input(0, one);
  25. // c_api.TF_UpdateEdge(graph, new TF_Output(c1.op, 0), new TF_Input(neg.op, 0), tf.Status.Handle);
  26. Assert.AreEqual(2, one.consumers().Length);
  27. Assert.AreEqual("one:0", neg.op.node_def.Input[0]);
  28. }
  29. }
  30. }