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

6 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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 in 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. #### Run in Mac OS
  17. There is no GPU support for macOS.
  18. #### Tensorflow GPU for Windows
  19. ```powershell
  20. PM> Install-Package SciSharp.TensorFlow.Redist-Windows-GPU
  21. ```
  22. #### Tensorflow GPU for Linux
  23. ```powershell
  24. PM> Install-Package SciSharp.TensorFlow.Redist-Linux-GPU
  25. ```
  26. ### Download prebuild binary manually
  27. Here are some pre-built TensorFlow binaries you can use for each platform:
  28. - Linux
  29. - CPU-only: https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-1.15.0.tar.gz
  30. - GPU-enabled: https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-linux-x86_64-1.15.0.tar.gz
  31. - Mac: https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-darwin-x86_64-1.15.0.tar.gz
  32. - Windows
  33. - CPU-only: https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-1.15.0.zip
  34. - GPU-enabled: https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-windows-x86_64-1.15.0.zip
  35. ### Build from source for Windows
  36. https://www.tensorflow.org/install/source_windows
  37. `pacman -S git patch unzip`
  38. 1. Build static library
  39. `bazel build --config=opt //tensorflow:libtensorflow.so`
  40. 2. Build pip package
  41. `bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package`
  42. 3. Generate pip installation file
  43. `bazel-bin\tensorflow\tools\pip_package\build_pip_package C:/tmp/tensorflow_pkg`
  44. 4. Install from local wheel file.
  45. `pip install C:/tmp/tensorflow_pkg/tensorflow-1.15.0-cp36-cp36m-win_amd64.whl`
  46. ### Export more APIs
  47. Add more api to `c_api.h`
  48. ```c++
  49. TF_CAPI_EXPORT extern void AddControlInput(TF_Graph* graph, TF_Operation* op, TF_Operation* input);
  50. TF_CAPI_EXPORT extern void UpdateEdge(TF_Graph* graph, TF_Output new_src, TF_Input dst, TF_Status* status);
  51. TF_CAPI_EXPORT extern void RemoveAllControlInputs(TF_Graph* graph, TF_Operation* op);
  52. ```
  53. For Linux version, these APIs symbols should also be put into `tensorflow/c/version_script.lds` to be exported.
  54. Please refer to commit `https://github.com/SciSharp/tensorflow/commit/58122da06be3e7707500ad889dfd5c760a3e0424`