@@ -44,17 +44,17 @@ See [CONTRIBUTING.md](CONTRIBUTING.md#building).
44
44
## Using Maven Artifacts
45
45
46
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.
47
+ for each targeted platform or with a single dependency that targets them all.
48
48
49
49
### Individual dependencies
50
50
51
51
With this option, you must first add a dependency to ` tensorflow-core-api ` and then one or multiple
52
52
dependencies to ` tensorflow-core-native ` 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
53
+ it minimizes the size of your application by only including the TensorFlow builds you need, at the cost of being more
54
54
restrictive.
55
55
56
56
While TensorFlow Java can be compiled for [ multiple platforms] ( https://github.com/tensorflow/java/blob/master/tensorflow-core/pom.xml#L54 ) ,
57
- only binaries for the followings are being ** supported and distributed** by this project:
57
+ only binaries for the following are being ** supported and distributed** by this project:
58
58
59
59
- ` linux-x86_64 ` : Linux platforms on Intel/AMD chips
60
60
- ` linux-x86_64-gpu ` : Linux platforms on Intel/AMD chips with Cuda GPU support
@@ -80,6 +80,12 @@ systems with no GPU support, you should add the following dependencies:
80
80
<classifier >linux-x86_64</classifier >
81
81
</dependency >
82
82
```
83
+ Or Gradle:
84
+ ``` groovy
85
+ def tfVersion = '1.0.0'
86
+ implementation "org.tensorflow:tensorflow-core-api:$tfVersion"
87
+ implementation "org.tensorflow:tensorflow-core-native:$tfVersion:linux-x86_64"
88
+ ```
83
89
84
90
On the other hand, if you plan to deploy your JAR on more platforms, you need additional
85
91
native dependencies as follows:
@@ -108,13 +114,21 @@ native dependencies as follows:
108
114
<classifier >windows-x86_64</classifier >
109
115
</dependency >
110
116
```
117
+ Or Gradle:
118
+ ``` groovy
119
+ def tfVersion = '1.0.0'
120
+ implementation "org.tensorflow:tensorflow-core-api:$tfVersion"
121
+ implementation "org.tensorflow:tensorflow-core-native:$tfVersion:linux-x86_64-gpu"
122
+ implementation "org.tensorflow:tensorflow-core-native:$tfVersion:macosx-arm64"
123
+ implementation "org.tensorflow:tensorflow-core-native:$tfVersion:windows-x86_64"
124
+ ```
111
125
112
126
Only one dependency can be added per platform, meaning that you cannot add native dependencies to both ` linux-x86_64 ` and
113
127
` linux-x86_64-gpu ` within the same project.
114
128
115
129
To use an NVIDIA GPU, you need to install the NVIDIA device driver, CUDA Toolkit, and cuDNN.
116
130
For Ubuntu 24.04, you can install them with the following command:
117
- ``` sudo apt-get install -y nvidia-driver-550 nvidia-cuda-toolkit nvidia-cudnn ```
131
+ ``` sudo apt install -y nvidia-driver-550 nvidia-cuda-toolkit nvidia-cudnn ```
118
132
119
133
### Single dependency
120
134
@@ -132,6 +146,10 @@ simply add this dependency to your application:
132
146
<version >1.0.0</version >
133
147
</dependency >
134
148
```
149
+ Or Gradle:
150
+ ``` groovy
151
+ implementation "org.tensorflow:tensorflow-core-platform:1.0.0"
152
+ ```
135
153
136
154
Be aware though that the builds of TensorFlow are quite voluminous and including too many native dependencies may
137
155
significantly increase the size of your application. So it is good practice to limit your dependencies to
@@ -163,6 +181,20 @@ to add Sonatype OSS repository in your pom.xml, like the following
163
181
</dependency >
164
182
</dependencies >
165
183
```
184
+ Or Gradle:
185
+ ``` groovy
186
+ repositories {
187
+ mavenCentral()
188
+ maven {
189
+ url = uri("https://oss.sonatype.org/content/repositories/snapshots")
190
+ }
191
+ }
192
+
193
+ dependencies {
194
+ // Example of dependency, see section above for more options
195
+ implementation "org.tensorflow:tensorflow-core-platform:1.1.0-SNAPSHOT"
196
+ }
197
+ ```
166
198
167
199
## TensorFlow/Java Version Support
168
200
0 commit comments