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.

PlaceholderTest.cs 598 B

6 years ago
6 years ago
6 years ago
1234567891011121314151617181920212223242526
  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 PlaceholderTest : Python
  10. {
  11. [TestMethod]
  12. public void placeholder()
  13. {
  14. var x = tf.placeholder(tf.int32);
  15. var y = x * 3;
  16. with(tf.Session(), sess =>
  17. {
  18. var result = sess.run(y,
  19. new FeedItem(x, 2));
  20. Assert.AreEqual((int)result, 6);
  21. });
  22. }
  23. }
  24. }

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