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

5 years ago
6 years ago
6 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. TensorFlow.NET pack all required libraries in architecture-specific assemblies folders per NuGet standard.
  2. ```powershell
  3. PM> Install-Package TensorFlow.NET
  4. PM> Install-Package SciSharp.TensorFlow.Redist
  5. ```
  6. Add `<RuntimeIdentifier>win-x64</RuntimeIdentifier>` to a `PropertyGroup` in your `.csproj` when targeting `.NET 472`.
  7. ### Run in Linux
  8. Download Linux pre-built library and unzip `libtensorflow.so` and `libtensorflow_framework.so` into current running directory.
  9. To run image recognition in Linux, please ensure some prerequisite libraries is install.
  10. ```shell
  11. sudo apt install libc6-dev
  12. sudo apt install libgdiplus
  13. ```
  14. More information about [System.Drawing on Linux](<https://www.hanselman.com/blog/HowDoYouUseSystemDrawingInNETCore.aspx>).
  15. ### Run TensorFlow with GPU
  16. Before running verify you installed CUDA and cuDNN (TensorFlow v1.15 is compatible with CUDA v10.0 and cuDNN v7.4 , TensorFlow v2.x is compatible with CUDA v10.2 and cuDNN v7.65), and make sure the corresponding cuda version is compatible.
  17. #### Mac OS
  18. There is no GPU support for macOS.
  19. #### GPU for Windows
  20. ```powershell
  21. PM> Install-Package SciSharp.TensorFlow.Redist-Windows-GPU
  22. ```
  23. #### GPU for Linux
  24. ```powershell
  25. PM> Install-Package SciSharp.TensorFlow.Redist-Linux-GPU
  26. ```
  27. ### Download prebuild binary manually
  28. Tensorflow packages are built nightly and uploaded to GCS for all supported platforms. They are uploaded to the [libtensorflow-nightly](https://www.tensorflow.org/install/lang_c) GCS bucket and are indexed by operating system and date built.
  29. ### Build from source for Windows
  30. https://www.tensorflow.org/install/source_windows
  31. Download [Bazel 2.0.0](https://github.com/bazelbuild/bazel/releases/tag/2.0.0) to build tensorflow2.x. We build customized binary to export c_api from this [fork](https://github.com/SciSharp/tensorflow).
  32. Set ENV `BAZEL_VC=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC`.
  33. `pacman -S git patch unzip`
  34. 1. Build static library
  35. `bazel build --config=opt //tensorflow:tensorflow`
  36. 2. Build pip package
  37. `bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package`
  38. 3. Generate pip installation file
  39. `bazel-bin\tensorflow\tools\pip_package\build_pip_package C:/tmp/tensorflow_pkg`
  40. 4. Install from local wheel file.
  41. `pip install C:/tmp/tensorflow_pkg/tensorflow-1.15.0-cp36-cp36m-win_amd64.whl`
  42. ### Build specific version for tf.net
  43. https://github.com/SciSharp/tensorflow
  44. For Linux version, these APIs symbols should also be put into `tensorflow/c/version_script.lds` to be exported.
  45. Please refer to commit `https://github.com/SciSharp/tensorflow/commit/58122da06be3e7707500ad889dfd5c760a3e0424`