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

6 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. ### Run in Linux
  7. Download Linux pre-built library and unzip `libtensorflow.so` and `libtensorflow_framework.so` into current running directory.
  8. To run image recognition in Linux, please ensure some prerequisite libraries is install.
  9. ```shell
  10. sudo apt install libc6-dev
  11. sudo apt install libgdiplus
  12. ```
  13. More information about [System.Drawing on Linux](<https://www.hanselman.com/blog/HowDoYouUseSystemDrawingInNETCore.aspx>).
  14. ### Run TensorFlow with GPU
  15. 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.
  16. #### Mac OS
  17. There is no GPU support for macOS.
  18. #### GPU for Windows
  19. ```powershell
  20. PM> Install-Package SciSharp.TensorFlow.Redist-Windows-GPU
  21. ```
  22. #### GPU for Linux
  23. ```powershell
  24. PM> Install-Package SciSharp.TensorFlow.Redist-Linux-GPU
  25. ```
  26. ### Download prebuild binary manually
  27. We can't found official prebuild binaries for each platform since tensorflow 2.0. If you know where we can download, please PR here.
  28. ### Build from source for Windows
  29. https://www.tensorflow.org/install/source_windows
  30. Download [Bazel 0.29.1](https://github.com/bazelbuild/bazel/releases/tag/0.29.1) to build tensorflow2.x. We build customized binary to export c_api from this [fork](https://github.com/SciSharp/tensorflow).
  31. `pacman -S git patch unzip`
  32. 1. Build static library
  33. `bazel build --config=opt //tensorflow:libtensorflow.so`
  34. 2. Build pip package
  35. `bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package`
  36. 3. Generate pip installation file
  37. `bazel-bin\tensorflow\tools\pip_package\build_pip_package C:/tmp/tensorflow_pkg`
  38. 4. Install from local wheel file.
  39. `pip install C:/tmp/tensorflow_pkg/tensorflow-1.15.0-cp36-cp36m-win_amd64.whl`
  40. ### Export more APIs
  41. Add more api to `c_api.h`
  42. ```c++
  43. TF_CAPI_EXPORT extern void AddControlInput(TF_Graph* graph, TF_Operation* op, TF_Operation* input);
  44. TF_CAPI_EXPORT extern void UpdateEdge(TF_Graph* graph, TF_Output new_src, TF_Input dst, TF_Status* status);
  45. TF_CAPI_EXPORT extern void RemoveAllControlInputs(TF_Graph* graph, TF_Operation* op);
  46. ```
  47. For Linux version, these APIs symbols should also be put into `tensorflow/c/version_script.lds` to be exported.
  48. Please refer to commit `https://github.com/SciSharp/tensorflow/commit/58122da06be3e7707500ad889dfd5c760a3e0424`