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.

GraphTest.cs 1.1 kB

6 years ago
6 years ago
6 years ago
6 years ago
1234567891011121314151617181920212223242526272829303132333435
  1. using Microsoft.VisualStudio.TestTools.UnitTesting;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. using Tensorflow;
  6. namespace TensorFlowNET.UnitTest
  7. {
  8. [TestClass]
  9. public class GraphTest
  10. {
  11. [TestMethod]
  12. public void Graph()
  13. {
  14. var s = new Status();
  15. var graph = tf.get_default_graph();
  16. // Make a placeholder operation.
  17. var feed = c_test_util.Placeholder(graph, s);
  18. Assert.AreEqual("feed", feed.name);
  19. Assert.AreEqual("Placeholder", feed.optype);
  20. //Assert.AreEqual("", feed.device);
  21. Assert.AreEqual(1, feed.NumOutputs);
  22. Assert.AreEqual(TF_DataType.TF_INT32, feed.OutputType);
  23. Assert.AreEqual(1, feed.OutputListLength);
  24. Assert.AreEqual(0, feed.NumInputs);
  25. Assert.AreEqual(0, feed.NumConsumers);
  26. Assert.AreEqual(0, feed.NumControlInputs);
  27. Assert.AreEqual(0, feed.NumControlOutputs);
  28. AttrValue attr_value = null;
  29. c_test_util.GetAttrValue(feed, "dtype", ref attr_value, s);
  30. }
  31. }
  32. }

tensorflow框架的.NET版本,提供了丰富的特性和API,可以借此很方便地在.NET平台下搭建深度学习训练与推理流程。

Contributors (1)