Skip to content

Commit 6c53399

Browse files
committed
Split some documentation into CONTRIBUTING.md, so NuGet.org can autofetch my README.md
1 parent 25e35d1 commit 6c53399

3 files changed

Lines changed: 100 additions & 95 deletions

File tree

CONTRIBUTING.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
TensorFlowSharp are bindings to the native TensorFlow library.
2+
3+
You can either use the TensorFlow C-library release binaries, or build
4+
your own from source. Here are some pre-built TensorFlow binaries you
5+
can use for each platform:
6+
7+
- Linux
8+
- CPU-only: https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-1.1.0.tar.gz
9+
- GPU-enabled: https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-linux-x86_64-1.1.0.tar.gz
10+
- Mac: https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-darwin-x86_64-1.1.0.tar.gz
11+
- Windows: https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-1.2.0-rc0.zip
12+
13+
Unpack the above .tar.gz suitable for your system on a prefix that your
14+
system's dynamic linker can use, for example, go to `/usr/local` and unpack there.
15+
16+
Mac note: the package contains a `.so` file, you will need to rename this to `.dylib` for
17+
it to work.
18+
19+
Once you do that, you need to open the solution file on the top
20+
level directory and build. This will produce both the TensorFlowSharp
21+
library as well as compile the tests and samples.
22+
23+
## Building your own native TensorFlow library
24+
25+
You will wan to use Visual Studio 2017 or Visual Studio for Mac to build.
26+
27+
To build the TensorFlow C library from source,
28+
[follow these instructions](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/go/README.md#building-the-tensorflow-c-library-from-source).
29+
30+
This includes checking out the Tensorflow sources, installing Bazel,
31+
and building the core.
32+
33+
Once you do that, you will need to build the shared library.
34+
First, in the tensorflow directory, run:
35+
36+
```bash
37+
./configure
38+
```
39+
40+
and answer the various prompts about your build. Important:
41+
building with CUDA support provides better runtime performance
42+
but has additional dependencies as discussed in the Tensorflow
43+
installation Web page.
44+
45+
Once configured, run:
46+
47+
```bash
48+
bazel build -c opt //tensorflow:libtensorflow.so
49+
```
50+
51+
If you want debug symbols for Tensorflow, while debugging the binding:
52+
53+
```bash
54+
bazel build -c dbg --strip=never //tensorflow:libtensorflow.so
55+
```
56+
57+
You will need the generated library (`libtensorflow.so`) to be installed in a
58+
system accessible location like `/usr/local/lib`
59+
60+
On Linux:
61+
62+
```bash
63+
sudo cp bazel-bin/tensorflow/libtensorflow.so /usr/local/lib/
64+
```
65+
66+
On MacOS:
67+
68+
```bash
69+
sudo cp bazel-bin/tensorflow/libtensorflow.so /usr/local/lib/libtensorflow.dylib
70+
```
71+
72+
## Running the test
73+
74+
I am currently using Visual Studio for Mac to do the development, but this
75+
should work on Windows with VS and Linux with MonoDevelop.
76+
77+
Before the solution will run you will need the shared library generated to
78+
be on a location accessibly by the Mono runtime (for example /usr/local/lib).
79+
80+
While Tensorflow builds a library with the extension .so, you will need
81+
to make sure that it has the proper name for your platform (tensorflow.dll on Windows,
82+
tensorflow.dylib on Mac) and copy that there.
83+
84+
Tensorflow is a 64-bit library, so you will need to use a 64-bit Mono to run,
85+
at home (where I am doing this work), I have a copy of 64-bit Mono on /mono,
86+
so you will want to set that in your project configuration, to do this:
87+
88+
Ensure that your Build/Compiler settings set "Platform Target" to "x64".
89+
90+
Open the solution file in the top directory, and when you hit run, this will
91+
run the API test.

README.md

Lines changed: 8 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ The API binding is pretty much done, and at this point, I am polishing the
1010
API to make it more pleasant to use from C# and F# and resolving some of the
1111
kinks and TODO-items that I left while I was doing the work.
1212

13-
My work-in-progress API documentation [current API
14-
documentation](https://migueldeicaza.github.io/TensorFlowSharp/).
13+
The [current API
14+
documentation](https://migueldeicaza.github.io/TensorFlowSharp/) is here.
1515

1616
# Using TensorFlowSharp
1717

@@ -35,7 +35,7 @@ later, as this package uses some features of newer .NETs. Otherwise,
3535
the package will not be added. Once you do this, you can just use the
3636
TensorFlowSharp nuget
3737

38-
Alternatively, you can [download it](https://www.nuget.org/api/v2/package/TensorFlowSharp/1.2.2) directly.
38+
Alternatively, you can [download it](https://www.nuget.org/packages/TensorFlowSharp/) directly.
3939

4040
## Using TensorFlowSharp
4141

@@ -91,9 +91,11 @@ using (var session = new TFSession())
9191
Console.WriteLine("a*b={0}", multiplyResultValue);
9292
}
9393
```
94+
9495
Here is an F# scripting version of the same example, you can use this in F# Interactive:
96+
9597
```
96-
#r @"packages\TensorFlowSharp.1.2.2\lib\net461\TensorFlowSharp.dll"
98+
#r @"packages\TensorFlowSharp.1.4.0\lib\net461\TensorFlowSharp.dll"
9799
98100
open System
99101
open System.IO
@@ -125,97 +127,9 @@ module AddTwoNumbers =
125127

126128
# Working on TensorFlowSharp
127129

128-
TensorFlowSharp are bindings to the native TensorFlow library.
129-
130-
You can either use the TensorFlow C-library release binaries, or build
131-
your own from source. Here are some pre-built TensorFlow binaries you
132-
can use for each platform:
133-
134-
- Linux
135-
- CPU-only: https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-1.1.0.tar.gz
136-
- GPU-enabled: https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-linux-x86_64-1.1.0.tar.gz
137-
- Mac: https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-darwin-x86_64-1.1.0.tar.gz
138-
- Windows: https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-1.2.0-rc0.zip
139-
140-
Unpack the above .tar.gz suitable for your system on a prefix that your
141-
system's dynamic linker can use, for example, go to `/usr/local` and unpack there.
142-
143-
Mac note: the package contains a `.so` file, you will need to rename this to `.dylib` for
144-
it to work.
145-
146-
Once you do that, you need to open the solution file on the top
147-
level directory and build. This will produce both the TensorFlowSharp
148-
library as well as compile the tests and samples.
149-
150-
## Building your own native TensorFlow library
151-
152-
You will wan to use Visual Studio 2017 or Visual Studio for Mac to build.
153-
154-
To build the TensorFlow C library from source,
155-
[follow these instructions](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/go/README.md#building-the-tensorflow-c-library-from-source).
156-
157-
This includes checking out the Tensorflow sources, installing Bazel,
158-
and building the core.
159-
160-
Once you do that, you will need to build the shared library.
161-
First, in the tensorflow directory, run:
162-
163-
```bash
164-
./configure
165-
```
166-
167-
and answer the various prompts about your build. Important:
168-
building with CUDA support provides better runtime performance
169-
but has additional dependencies as discussed in the Tensorflow
170-
installation Web page.
171-
172-
Once configured, run:
173-
174-
```bash
175-
bazel build -c opt //tensorflow:libtensorflow.so
176-
```
177-
178-
If you want debug symbols for Tensorflow, while debugging the binding:
179-
180-
```bash
181-
bazel build -c dbg --strip=never //tensorflow:libtensorflow.so
182-
```
183-
184-
You will need the generated library (`libtensorflow.so`) to be installed in a
185-
system accessible location like `/usr/local/lib`
186-
187-
On Linux:
188-
189-
```bash
190-
sudo cp bazel-bin/tensorflow/libtensorflow.so /usr/local/lib/
191-
```
192-
193-
On MacOS:
194-
195-
```bash
196-
sudo cp bazel-bin/tensorflow/libtensorflow.so /usr/local/lib/libtensorflow.dylib
197-
```
198-
199-
## Running the test
200-
201-
I am currently using Visual Studio for Mac to do the development, but this
202-
should work on Windows with VS and Linux with MonoDevelop.
203-
204-
Before the solution will run you will need the shared library generated to
205-
be on a location accessibly by the Mono runtime (for example /usr/local/lib).
206-
207-
While Tensorflow builds a library with the extension .so, you will need
208-
to make sure that it has the proper name for your platform (tensorflow.dll on Windows,
209-
tensorflow.dylib on Mac) and copy that there.
210-
211-
Tensorflow is a 64-bit library, so you will need to use a 64-bit Mono to run,
212-
at home (where I am doing this work), I have a copy of 64-bit Mono on /mono,
213-
so you will want to set that in your project configuration, to do this:
214-
215-
Ensure that your Build/Compiler settings set "Platform Target" to "x64".
130+
If you want to work on extending TensorFlowSharp or contribute to its development
131+
read the [CONTRIBUTING.md](CONTRIBUTING.md) file.
216132

217-
Open the solution file in the top directory, and when you hit run, this will
218-
run the API test.
219133

220134
## Possible Contributions
221135

TensorFlowSharp/TensorFlowSharp.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
1212
<ReleaseVersion>0.2</ReleaseVersion>
1313
<PackageId>TensorFlowSharp</PackageId>
14-
<PackageVersion>1.4.0-pre1</PackageVersion>
14+
<PackageVersion>1.4.0</PackageVersion>
1515
<Authors>Miguel de Icaza</Authors>
1616
<PackageLicenseUrl>https://github.com/migueldeicaza/TensorFlowSharp/blob/master/LICENSE</PackageLicenseUrl>
1717
<PackageProjectUrl>https://github.com/migueldeicaza/TensorFlowSharp/</PackageProjectUrl>

0 commit comments

Comments
 (0)