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

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