You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+17-6Lines changed: 17 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,7 +48,6 @@ The `tensorflow-core/tensorflow-core-api/.bazelversion` file must be kept in syn
48
48
This allows using [Bazelisk](https://github.com/bazelbuild/bazelisk) which runs the bazel version given in .bazelversion instead of having to
49
49
physically reinstall a specific `bazel` version each time the TensorFlow version changes.
50
50
51
-
52
51
### GPU Support
53
52
54
53
Currently, due to build time constraints, the GPU binaries only support compute capacities 3.5 and 7.0.
@@ -61,6 +60,17 @@ To build for GPU, pass `-Djavacpp.platform.extension=-gpu` to maven. By default,
61
60
for more info. If you add `bazelrc` files, make sure the `TF_CUDA_COMPUTE_CAPABILITIES` value in them matches the value set elsewhere, as it will take
62
61
precedence if present.
63
62
63
+
### Apple Silicon
64
+
65
+
The TensorFlow Java project relies on [GitHub-hosted runners](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners)
66
+
to build and distribute the native binaries for TensorFlow. Unfortunately at the moment, GitHub Actions still does not support runners with a
67
+
Apple Silicon chip (such as M1). Therefore, we cannot distribute the binaries for this platform, so they must be compiled and installed locally on such systems.
68
+
69
+
Please follow the present [procedure](CONTRIBUTING.md#building) for building TensorFlow Java from sources.
70
+
71
+
:warning: As of 12-16-2022, TensorFlow fails to build on XCode command line tools version 14+. If you have such version installed, it might
72
+
be necessary to downgrade it to a [previous version](https://developer.apple.com/download/all/?q=Xcode), like 13.4.1.
73
+
64
74
## Running Tests
65
75
66
76
`ndarray` can be tested using the maven `test` target. `tensorflow-core` and `tensorflow-framework`, however, should be tested using
@@ -136,8 +146,8 @@ The actual classification process is a bit arbitrary and based on the good jugem
136
146
are being wrapped by a higher-level API and therefore are left unclassified, while in Java they are exposed and can be used directly by
137
147
the users.
138
148
139
-
For classifying an op, a`api_def` proto must be added to the `tensorflow-core-api`[folder](https://github.com/tensorflow/java/tree/master/tensorflow-core/tensorflow-core-api/src/bazel/api_def)
140
-
for this purpose, redefining optionally its endpoints or its visibility.
149
+
For classifying an op, an`api_def` proto must be added to the [`tensorflow-core-api/src/bazel/api_def`](https://github.com/tensorflow/java/tree/master/tensorflow-core/tensorflow-core-api/src/bazel/api_def)
150
+
folder for this purpose, redefining optionally its endpoints or its visibility.
141
151
142
152
Writing these protos and trying the guess the right location for each new operation can become a tedious job so an utility program called `java_api_import`
143
153
has been created to help you with this task. This utility is available under the `bazel-bin` folder of `tensorflow-core-api` after the
@@ -147,8 +157,7 @@ initial build. Here is how to invoke it:
For each new operation detected (i.e. any operation that does not have a valid `api_def` proto yet), the utility will suggest you some possible
@@ -157,7 +166,9 @@ will automatically classify the op). It is also possible to enter manually the n
157
166
application will then take care to write the `api_def` proto for each operation classified.
158
167
159
168
Make sure to erase completely the generated source folder of the `tensorflow-core-api` module before rerunning the build so you can see
160
-
if your ops have been classified properly. Don't worry, that second run of the build will be fast ;)
169
+
if your ops have been classified properly. Don't worry, that second run of the build will be faster! Please review the location of the new generated ops
170
+
after rebuilding and make necessary adjustments to the `api_def`protos manually if some of them seems to be in the "wrong" place, making sure to repeat this process
Copy file name to clipboardExpand all lines: README.md
+51-19Lines changed: 51 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,15 +43,30 @@ See [CONTRIBUTING.md](CONTRIBUTING.md#building).
43
43
44
44
## Using Maven Artifacts
45
45
46
-
To include TensorFlow in your Maven application, you first need to add a dependency on either the
47
-
`tensorflow-core` or `tensorflow-core-platform` artifacts. The former could be included multiple times
48
-
for different targeted systems by their classifiers, while the later includes them as dependencies for
49
-
`linux-x86_64`, `macosx-x86_64`, and `windows-x86_64`, with more to come in the future. There are also
50
-
`tensorflow-core-platform-mkl`, `tensorflow-core-platform-gpu`, and `tensorflow-core-platform-mkl-gpu`
51
-
artifacts that depend on artifacts with MKL and/or CUDA support enabled.
46
+
There are two options for adding TensorFlow Java as a dependency to your Maven project: with individual dependencies
47
+
for each targeted platforms or with a single dependency that target them all.
48
+
49
+
### Individual dependencies
50
+
51
+
With this option, you must first add an unclassified dependency to `tensorflow-core-api` and then add one or multiple
52
+
native dependencies to this same artifact with a classifier targeting a specific platform. This option is preferred as
53
+
it minimize the size of your application by only including the TensorFlow builds you need, at the cost of being more
54
+
restrictive.
55
+
56
+
While TensorFlow Java can be compiled for [multiple platforms](https://github.com/tensorflow/java/blob/dc64755ee948c71f1321be27478828a51f1f3cf7/tensorflow-core/pom.xml#L54),
57
+
only binaries for the followings are being **supported and distributed** by this project:
58
+
59
+
-`linux-x86_64`: Linux platforms on Intel chips
60
+
-`linux-x86_64-gpu`: Linux platforms on Intel chips with Cuda GPU support
61
+
-`macosx-x86_64`: MacOS X platforms on Intel chips
62
+
-`windows-x86_64`: Windows platforms on Intel chips
63
+
-`windows-x86_64-gpu`: Windows platforms on Intel chips with Cuda GPU support
64
+
65
+
*Note: No binaries are distributed to run TensorFlow Java on machines with Apple Silicon chips (`macosx-arm64`), these
66
+
should be build from sources. See [here](CONTRIBUTING.md#apple-silicon) for more details.*
52
67
53
68
For example, for building a JAR that uses TensorFlow and is targeted to be deployed only on Linux
54
-
systems, you should add the following dependencies:
69
+
systems with no GPU support, you should add the following dependencies:
55
70
```xml
56
71
<dependency>
57
72
<groupId>org.tensorflow</groupId>
@@ -62,7 +77,7 @@ systems, you should add the following dependencies:
0 commit comments