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.

ExamplesTest.cs 3.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using Microsoft.VisualStudio.TestTools.UnitTesting;
  5. using Tensorflow;
  6. using TensorFlowNET.Examples;
  7. using TensorFlowNET.Examples.CnnTextClassification;
  8. namespace TensorFlowNET.ExamplesTests
  9. {
  10. [TestClass]
  11. public class ExamplesTest
  12. {
  13. [TestMethod]
  14. public void BasicOperations()
  15. {
  16. tf.Graph().as_default();
  17. new BasicOperations() { Enabled = true }.Run();
  18. }
  19. [TestMethod]
  20. public void HelloWorld()
  21. {
  22. tf.Graph().as_default();
  23. new HelloWorld() { Enabled = true }.Run();
  24. }
  25. [TestMethod]
  26. public void ImageRecognition()
  27. {
  28. tf.Graph().as_default();
  29. new HelloWorld() { Enabled = true }.Run();
  30. }
  31. [Ignore]
  32. [TestMethod]
  33. public void InceptionArchGoogLeNet()
  34. {
  35. tf.Graph().as_default();
  36. new InceptionArchGoogLeNet() { Enabled = true }.Run();
  37. }
  38. [TestMethod]
  39. public void KMeansClustering()
  40. {
  41. tf.Graph().as_default();
  42. new KMeansClustering() { Enabled = true, ImportGraph = true, train_size = 500, validation_size = 100, test_size = 100, batch_size =100 }.Run();
  43. }
  44. [TestMethod]
  45. public void LinearRegression()
  46. {
  47. tf.Graph().as_default();
  48. new LinearRegression() { Enabled = true }.Run();
  49. }
  50. [TestMethod]
  51. public void LogisticRegression()
  52. {
  53. tf.Graph().as_default();
  54. new LogisticRegression() { Enabled = true, training_epochs=10, train_size = 500, validation_size = 100, test_size = 100 }.Run();
  55. }
  56. [Ignore]
  57. [TestMethod]
  58. public void MetaGraph()
  59. {
  60. tf.Graph().as_default();
  61. new MetaGraph() { Enabled = true }.Run();
  62. }
  63. [Ignore]
  64. [TestMethod]
  65. public void NaiveBayesClassifier()
  66. {
  67. tf.Graph().as_default();
  68. new NaiveBayesClassifier() { Enabled = false }.Run();
  69. }
  70. [Ignore]
  71. [TestMethod]
  72. public void NamedEntityRecognition()
  73. {
  74. tf.Graph().as_default();
  75. new NamedEntityRecognition() { Enabled = true }.Run();
  76. }
  77. [TestMethod]
  78. public void NearestNeighbor()
  79. {
  80. tf.Graph().as_default();
  81. new NearestNeighbor() { Enabled = true, TrainSize = 500, ValidationSize = 100, TestSize = 100 }.Run();
  82. }
  83. [Ignore]
  84. [TestMethod]
  85. public void TextClassificationTrain()
  86. {
  87. tf.Graph().as_default();
  88. new TextClassificationTrain() { Enabled = true, DataLimit=100 }.Run();
  89. }
  90. [Ignore]
  91. [TestMethod]
  92. public void TextClassificationWithMovieReviews()
  93. {
  94. tf.Graph().as_default();
  95. new TextClassificationWithMovieReviews() { Enabled = true }.Run();
  96. }
  97. [TestMethod]
  98. public void NeuralNetXor()
  99. {
  100. tf.Graph().as_default();
  101. Assert.IsTrue(new NeuralNetXor() { Enabled = true, ImportGraph = false }.Run());
  102. }
  103. [TestMethod]
  104. public void NeuralNetXor_ImportedGraph()
  105. {
  106. tf.Graph().as_default();
  107. Assert.IsTrue(new NeuralNetXor() { Enabled = true, ImportGraph = true }.Run());
  108. }
  109. [TestMethod]
  110. public void ObjectDetection()
  111. {
  112. tf.Graph().as_default();
  113. Assert.IsTrue(new ObjectDetection() { Enabled = true, ImportGraph = true }.Run());
  114. }
  115. }
  116. }

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