tensorflow/java

Java bindings for TensorFlow

TensorFlow for Java

What it is – A set of Java‑language bindings that let you run TensorFlow models from any JVM. The repo houses three main artifacts:

  • tensorflow‑core – thin JNI wrapper around the native TensorFlow library. Use this if you only need low‑level access.
  • tensorflow‑framework – a higher‑level API for building and training neural networks directly in Java.
  • tensorflow‑ndarray – a stand‑alone n‑dimensional array library that can be used without the rest of TensorFlow.

Why it matters – Java, Scala, Kotlin and other JVM languages are common in large enterprises. By providing Maven‑style artifacts, TensorFlow‑Java lets those teams adopt ML without leaving their existing build and deployment pipelines.

Getting started – Add the appropriate Maven (or Gradle) dependencies. You can either:

  1. Pick individual native binaries (tensorflow‑core-api + tensorflow‑core-native with a platform classifier) to keep the JAR small, or
  2. Use the single tensorflow‑core‑platform artifact that bundles the API plus native libraries for all supported CPU platforms (Linux x86_64, Linux arm64, macOS arm64).

Example (Maven, Linux‑x86_64, CPU only):

<dependency>
  <groupId>org.tensorflow</groupId>
  <artifactId>tensorflow-core-api</artifactId>
  <version>1.2.0</version>
</dependency>
<dependency>
  <groupId>org.tensorflow</groupId>
  <artifactId>tensorflow-core-native</artifactId>
  <version>1.2.0</version>
  <classifier>linux-x86_64</classifier>
</dependency>

For GPU support add the linux-x86_64-gpu classifier and ensure the NVIDIA driver, CUDA toolkit and cuDNN are installed.

Version compatibility – The table in the README maps each TensorFlow‑Java release to the underlying TensorFlow version and the minimum Java version required (e.g., TF‑Java 1.2.0 works with TensorFlow 2.21.0 and needs Java 11).

Community & contribution – Maintained by the TensorFlow JVM SIG. You can ask questions on the TensorFlow Forum (sig_jvm tag) or the Gitter channel, and contributions follow the usual pull‑request workflow described in CONTRIBUTING.md.

Where to see it in action – Example models are in the companion repository https://github.com/tensorflow/java-models.


All details above are taken directly from the repository’s README.

Related

  • Project
  • Project
  • Project
  • Project
  • Project