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.7 kB

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