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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. [Ignore]
  39. [TestMethod]
  40. public void KMeansClustering()
  41. {
  42. tf.Graph().as_default();
  43. new KMeansClustering() { Enabled = false, train_size = 500, validation_size = 100, test_size = 100, batch_size =100 }.Run();
  44. }
  45. [TestMethod]
  46. public void LinearRegression()
  47. {
  48. tf.Graph().as_default();
  49. new LinearRegression() { Enabled = true }.Run();
  50. }
  51. [TestMethod]
  52. public void LogisticRegression()
  53. {
  54. tf.Graph().as_default();
  55. new LogisticRegression() { Enabled = true, training_epochs=10, train_size = 500, validation_size = 100, test_size = 100 }.Run();
  56. }
  57. [Ignore]
  58. [TestMethod]
  59. public void MetaGraph()
  60. {
  61. tf.Graph().as_default();
  62. new MetaGraph() { Enabled = true }.Run();
  63. }
  64. [Ignore]
  65. [TestMethod]
  66. public void NaiveBayesClassifier()
  67. {
  68. tf.Graph().as_default();
  69. new NaiveBayesClassifier() { Enabled = false }.Run();
  70. }
  71. [Ignore]
  72. [TestMethod]
  73. public void NamedEntityRecognition()
  74. {
  75. tf.Graph().as_default();
  76. new NamedEntityRecognition() { Enabled = true }.Run();
  77. }
  78. [TestMethod]
  79. public void NearestNeighbor()
  80. {
  81. tf.Graph().as_default();
  82. new NearestNeighbor() { Enabled = true, TrainSize = 500, ValidationSize = 100, TestSize = 100 }.Run();
  83. }
  84. [Ignore]
  85. [TestMethod]
  86. public void TextClassificationTrain()
  87. {
  88. tf.Graph().as_default();
  89. new TextClassificationTrain() { Enabled = true, DataLimit=100 }.Run();
  90. }
  91. [Ignore]
  92. [TestMethod]
  93. public void TextClassificationWithMovieReviews()
  94. {
  95. tf.Graph().as_default();
  96. new TextClassificationWithMovieReviews() { Enabled = true }.Run();
  97. }
  98. [Ignore("Loss function optimization is not working yet")]
  99. [TestMethod]
  100. public void NeuralNetXor()
  101. {
  102. tf.Graph().as_default();
  103. Assert.IsTrue(new NeuralNetXor() { Enabled = true }.Run());
  104. }
  105. }
  106. }

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