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.

README.md 3.5 kB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. # TensorFlow.NET
  2. TensorFlow.NET provides .NET Standard binding for [TensorFlow](https://www.tensorflow.org/). It's the full complete binding in CSharp language for TensorFlow API. It allows .NET developers to develop, train and deploy Machine Learning models in .NET standard which is running on cross-platform.
  3. [![Join the chat at https://gitter.im/publiclab/publiclab](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/sci-sharp/community)
  4. [![Tensorflow.NET](https://ci.appveyor.com/api/projects/status/wx4td43v2d3f2xj6?svg=true)](https://ci.appveyor.com/project/Haiping-Chen/tensorflow-net)
  5. [![codecov](https://codecov.io/gh/SciSharp/NumSharp/branch/master/graph/badge.svg)](https://codecov.io/gh/SciSharp/NumSharp)
  6. [![NuGet](https://img.shields.io/nuget/dt/TensorFlow.NET.svg)](https://www.nuget.org/packages/TensorFlow.NET)
  7. [![Documentation Status](https://readthedocs.org/projects/tensorflownet/badge/?version=latest)](https://tensorflownet.readthedocs.io/en/latest/?badge=latest)
  8. TensorFlow.NET is a member project of [SciSharp STACK](https://github.com/SciSharp).
  9. ![tensors_flowing](docs/assets/tensors_flowing.gif)
  10. ### Why should we use TensorFlow.NET ?
  11. `SciSharp STASK`'s mission is to create a zero learning curve on the .NET based technology stack Machine Learning tool library. Let's take a look at a comparison picture and you can see why TensorFlow.NET is the tool that is the most comfortable for you.
  12. ![pythn vs csharp](docs/assets/syntax-comparision.png)
  13. SciSharp's philosophy allows a large number of machine learning code written in python to be quickly migrated to .NET, allowing a large number of .NET Developers to use more updated models.
  14. ### How to use
  15. Install TensorFlow.NET through NuGet.
  16. ```sh
  17. PM> Install-Package TensorFlow.NET
  18. ```
  19. If you are using Linux or Mac OS, please download the pre-compiled dll [here](tensorflowlib) and place it in the working folder. This is only need for Linux and Mac OS, and already packed into NuGet for Windows.
  20. Import tensorflow.net.
  21. ```cs
  22. using Tensorflow;
  23. ```
  24. Add two constants.
  25. ```cs
  26. // Create a Constant op
  27. var a = tf.constant(4.0f);
  28. var b = tf.constant(5.0f);
  29. var c = tf.add(a, b);
  30. using (var sess = tf.Session())
  31. {
  32. var o = sess.run(c);
  33. }
  34. ```
  35. Feed placeholder.
  36. ```cs
  37. // Create a placeholder op
  38. var a = tf.placeholder(tf.float32);
  39. var b = tf.placeholder(tf.float32);
  40. var c = tf.add(a, b);
  41. using(var sess = tf.Session())
  42. {
  43. var feed_dict = new Dictionary<Tensor, object>();
  44. feed_dict.Add(a, 3.0f);
  45. feed_dict.Add(b, 2.0f);
  46. var o = sess.run(c, feed_dict);
  47. }
  48. ```
  49. Read the docs & book [The Definitive Guide to Tensorflow.NET](https://tensorflownet.readthedocs.io/en/latest/FrontCover.html).
  50. ### More examples:
  51. * [Hello World](test/TensorFlowNET.Examples/HelloWorld.cs)
  52. * [Basic Operations](test/TensorFlowNET.Examples/BasicOperations.cs)
  53. * [Image Recognition](test/TensorFlowNET.Examples/ImageRecognition.cs)
  54. * [Linear Regression](test/TensorFlowNET.Examples/LinearRegression.cs)
  55. * [Text Classification](test/TensorFlowNET.Examples/TextClassificationWithMovieReviews.cs)
  56. * [CNN Text Classification](test/TensorFlowNET.Examples/CnnTextClassification.cs)
  57. * [Naive Bayes Classification](test/TensorFlowNET.Examples/NaiveBayesClassifier.cs)
  58. * [Named Entity Recognition](test/TensorFlowNET.Examples/NamedEntityRecognition.cs)
  59. Star me or raise issue on [Github](https://github.com/SciSharp/TensorFlow.NET) feel free.
  60. Scan QR code to join Tencent TIM group:
  61. ![SciSharp STACK](docs/TIM.jpg)

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