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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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. namespace TensorFlowNET.ExamplesTests
  8. {
  9. [TestClass]
  10. public class ExamplesTest
  11. {
  12. [TestMethod]
  13. public void BasicOperations()
  14. {
  15. tf.Graph().as_default();
  16. new BasicOperations() { Enabled = true }.Run();
  17. }
  18. [TestMethod]
  19. public void HelloWorld()
  20. {
  21. tf.Graph().as_default();
  22. new HelloWorld() { Enabled = true }.Run();
  23. }
  24. [TestMethod]
  25. public void ImageRecognition()
  26. {
  27. tf.Graph().as_default();
  28. new HelloWorld() { Enabled = true }.Run();
  29. }
  30. [Ignore]
  31. [TestMethod]
  32. public void InceptionArchGoogLeNet()
  33. {
  34. tf.Graph().as_default();
  35. new InceptionArchGoogLeNet() { Enabled = true }.Run();
  36. }
  37. [Ignore]
  38. [TestMethod]
  39. public void KMeansClustering()
  40. {
  41. tf.Graph().as_default();
  42. new KMeansClustering() { Enabled = true, IsImportingGraph = 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 NaiveBayesClassifier()
  59. {
  60. tf.Graph().as_default();
  61. new NaiveBayesClassifier() { Enabled = false }.Run();
  62. }
  63. [Ignore]
  64. [TestMethod]
  65. public void NamedEntityRecognition()
  66. {
  67. tf.Graph().as_default();
  68. new NamedEntityRecognition() { Enabled = true }.Run();
  69. }
  70. [TestMethod]
  71. public void NearestNeighbor()
  72. {
  73. tf.Graph().as_default();
  74. new NearestNeighbor() { Enabled = true, TrainSize = 500, ValidationSize = 100, TestSize = 100 }.Run();
  75. }
  76. [Ignore]
  77. [TestMethod]
  78. public void WordCnnTextClassification()
  79. => new CnnTextClassification { Enabled = true, ModelName = "word_cnn", DataLimit =100 }.Run();
  80. [Ignore]
  81. [TestMethod]
  82. public void CharCnnTextClassification()
  83. => new CnnTextClassification { Enabled = true, ModelName = "char_cnn", DataLimit = 100 }.Run();
  84. [Ignore]
  85. [TestMethod]
  86. public void TextClassificationWithMovieReviews()
  87. {
  88. tf.Graph().as_default();
  89. new BinaryTextClassification() { Enabled = true }.Run();
  90. }
  91. [TestMethod]
  92. public void NeuralNetXor()
  93. {
  94. tf.Graph().as_default();
  95. Assert.IsTrue(new NeuralNetXor() { Enabled = true, IsImportingGraph = false }.Run());
  96. }
  97. [TestMethod]
  98. public void NeuralNetXor_ImportedGraph()
  99. {
  100. tf.Graph().as_default();
  101. Assert.IsTrue(new NeuralNetXor() { Enabled = true, IsImportingGraph = true }.Run());
  102. }
  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. }