{"id":14958711,"url":"https://github.com/tensorflow/java","last_synced_at":"2025-05-14T05:10:31.667Z","repository":{"id":40338455,"uuid":"207384523","full_name":"tensorflow/java","owner":"tensorflow","description":"Java bindings for TensorFlow","archived":false,"fork":false,"pushed_at":"2025-04-11T19:13:48.000Z","size":19914,"stargazers_count":867,"open_issues_count":170,"forks_count":214,"subscribers_count":34,"default_branch":"master","last_synced_at":"2025-05-08T00:09:45.136Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tensorflow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-09-09T19:07:20.000Z","updated_at":"2025-05-05T18:36:36.000Z","dependencies_parsed_at":"2024-05-31T21:06:03.534Z","dependency_job_id":"d44c8670-e0b4-4c9a-8de1-10c1b9aed8c6","html_url":"https://github.com/tensorflow/java","commit_stats":{"total_commits":752,"total_committers":86,"mean_commits":8.744186046511627,"dds":0.7061170212765957,"last_synced_commit":"068cf8c370b90b83ac71ef692cdf5debca1f20b6"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tensorflow%2Fjava","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tensorflow%2Fjava/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tensorflow%2Fjava/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tensorflow%2Fjava/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tensorflow","download_url":"https://codeload.github.com/tensorflow/java/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254076848,"owners_count":22010611,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T13:17:56.948Z","updated_at":"2025-05-14T05:10:31.629Z","avatar_url":"https://github.com/tensorflow.png","language":"Java","readme":"# TensorFlow for Java\n\n## Welcome to the Java world of TensorFlow!\n\nTensorFlow can run on any JVM for building, training and running machine learning models. It comes with \na series of utilities and frameworks that help achieve most of the tasks common to data scientists \nand developers working in this domain. Java and other JVM languages, such as Scala or Kotlin, are \nfrequently used in small-to-large enterprises all over the world, which makes TensorFlow a strategic \nchoice for adopting machine learning at a large scale.\n\n## This Repository\n\nIn the early days, the Java language bindings for TensorFlow were hosted in the [main repository](https://github.com/tensorflow/tensorflow)\nand released only when a new version of the core library was ready to be distributed, which happens only\na few times a year. Now, all Java-related code has been moved to this repository so that it can evolve and \nbe released independently from official TensorFlow releases. In addition, most of the build tasks have been\nmigrated from Bazel to Maven, which is more familiar for most Java developers.\n\nThe following describes the layout of the repository and its different artifacts:\n\n* `tensorflow-core`\n  * All artifacts that build up the core language bindings of TensorFlow for Java\n  * Intended audience: projects that provide their own APIs or frameworks on top of \n    TensorFlow and just want a thin layer to access the TensorFlow native library from the JVM\n    \n* `tensorflow-framework`\n  * Primary API for building and training neural networks with TensorFlow\n  * Intended audience: neural network developers\n  * For more information: [tensorflow-framework/README.md](tensorflow-framework/README.md)\n\n*Note: The NdArray Library module has now its own [repository](https://github.com/tensorflow/java-ndarray) and has been moved out of TensorFlow Java.*\n\n## Communication\n\nThis repository is maintained by TensorFlow JVM Special Interest Group (SIG). You can easily contact the group\nby posting to the [TensorFlow Forum](https://discuss.tensorflow.org), adding the `sig_jvm` tag, or by writing to us on\nthe [sig-jvm Gitter channel](https://gitter.im/tensorflow/sig-jvm). You can also simply send pull requests \nand raise issues to this repository.\n\n## Building Sources\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md#building).\n\n## Using Maven Artifacts\n\nThere are two options for adding TensorFlow Java as a dependency to your Maven project: with individual dependencies \nfor each targeted platforms or with a single dependency that target them all.\n\n### Individual dependencies\n\nWith this option, you must first add a dependency to `tensorflow-core-api` and then one or multiple\ndependencies to `tensorflow-core-native` with a classifier targeting a specific platform. This option is preferred as \nit minimize the size of your application by only including the TensorFlow builds you need, at the cost of being more \nrestrictive. \n\nWhile TensorFlow Java can be compiled for [multiple platforms](https://github.com/tensorflow/java/blob/master/tensorflow-core/pom.xml#L54),\nonly binaries for the followings are being **supported and distributed** by this project:\n\n- `linux-x86_64`: Linux platforms on Intel/AMD chips\n- `linux-x86_64-gpu`: Linux platforms on Intel/AMD chips with Cuda GPU support\n- `linux-arm64`: Linux platforms on Arm chips\n- `macosx-x86_64`: MacOS X platforms on Intel/AMD chips\n- `macosx-arm64`: MacOS X platforms on Apple Silicon chips\n- `windows-x86_64`: Windows platforms on Intel/AMD chips\n\nFor example, for building a JAR that uses TensorFlow and is targeted to be deployed only on Linux\nsystems with no GPU support, you should add the following dependencies:\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003eorg.tensorflow\u003c/groupId\u003e\n  \u003cartifactId\u003etensorflow-core-api\u003c/artifactId\u003e\n  \u003cversion\u003e1.0.0-rc.2\u003c/version\u003e\n\u003c/dependency\u003e\n\u003cdependency\u003e\n  \u003cgroupId\u003eorg.tensorflow\u003c/groupId\u003e\n  \u003cartifactId\u003etensorflow-core-native\u003c/artifactId\u003e\n  \u003cversion\u003e1.0.0-rc.2\u003c/version\u003e\n  \u003cclassifier\u003elinux-x86_64\u003c/classifier\u003e\n\u003c/dependency\u003e\n```\n\nOn the other hand, if you plan to deploy your JAR on more platforms, you need additional\nnative dependencies as follows:\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003eorg.tensorflow\u003c/groupId\u003e\n  \u003cartifactId\u003etensorflow-core-api\u003c/artifactId\u003e\n  \u003cversion\u003e1.0.0-rc.2\u003c/version\u003e\n\u003c/dependency\u003e\n\u003cdependency\u003e\n  \u003cgroupId\u003eorg.tensorflow\u003c/groupId\u003e\n  \u003cartifactId\u003etensorflow-core-native\u003c/artifactId\u003e\n  \u003cversion\u003e1.0.0-rc.2\u003c/version\u003e\n  \u003cclassifier\u003elinux-x86_64-gpu\u003c/classifier\u003e\n\u003c/dependency\u003e\n\u003cdependency\u003e\n  \u003cgroupId\u003eorg.tensorflow\u003c/groupId\u003e\n  \u003cartifactId\u003etensorflow-core-native\u003c/artifactId\u003e\n  \u003cversion\u003e1.0.0-rc.2\u003c/version\u003e\n  \u003cclassifier\u003emacosx-arm64\u003c/classifier\u003e\n\u003c/dependency\u003e\n\u003cdependency\u003e\n  \u003cgroupId\u003eorg.tensorflow\u003c/groupId\u003e\n  \u003cartifactId\u003etensorflow-core-native\u003c/artifactId\u003e\n  \u003cversion\u003e1.0.0-rc.2\u003c/version\u003e\n  \u003cclassifier\u003ewindows-x86_64\u003c/classifier\u003e\n\u003c/dependency\u003e\n```\n\nOnly one dependency can be added per platform, meaning that you cannot add native dependencies to both `linux-x86_64` and \n`linux-x86_64-gpu` within the same project.\n\nTo use an NVIDIA GPU, you need to install the NVIDIA device driver, CUDA Toolkit, and cuDNN.\nFor Ubuntu 24.04, you can install them with the following command:\n```sudo apt-get install -y nvidia-driver-550 nvidia-cuda-toolkit nvidia-cudnn```\n\n### Single dependency\n\nIn some cases, it might be preferable to add a single dependency that includes transitively all the artifacts \nrequired to run TensorFlow Java on any [supported platforms](README.md#individual-dependencies)\n\n- `tensorflow-core-platform`: Includes `tensorflow-core-api`, plus native artifacts for `linux-x86_64`, `linux-x86_64-arm64`, `macosx-arm64`, `macosx-x86_64` and `windows-x86_64`\n\nFor example, to run TensorFlow Java on any CPU platform for which a binary is being distributed by this project, you can \nsimply add this dependency to your application:\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003eorg.tensorflow\u003c/groupId\u003e\n  \u003cartifactId\u003etensorflow-core-platform\u003c/artifactId\u003e\n  \u003cversion\u003e1.0.0-rc.2\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nBe aware though that the builds of TensorFlow are quite voluminous and including too many native dependencies may\nsignificantly increase the size of your application. So it is good practice to limit your dependencies to\nthe platforms you are targeting. For this purpose these artifacts include profiles that follow\nthe conventions established on this page:\n* [Reducing the Number of Dependencies](https://github.com/bytedeco/javacpp-presets/wiki/Reducing-the-Number-of-Dependencies)\n\n### Snapshots\n\nSnapshots of TensorFlow Java artifacts are automatically distributed after each update in the code. To use them, you need\nto add Sonatype OSS repository in your pom.xml, like the following\n\n```xml\n\u003crepositories\u003e\n    \u003crepository\u003e\n        \u003cid\u003etensorflow-snapshots\u003c/id\u003e\n        \u003curl\u003ehttps://oss.sonatype.org/content/repositories/snapshots/\u003c/url\u003e\n        \u003csnapshots\u003e\n            \u003cenabled\u003etrue\u003c/enabled\u003e\n        \u003c/snapshots\u003e\n    \u003c/repository\u003e\n\u003c/repositories\u003e\n\u003cdependencies\u003e\n    \u003c!-- Example of dependency, see section above for more options --\u003e\n    \u003cdependency\u003e\n        \u003cgroupId\u003eorg.tensorflow\u003c/groupId\u003e\n        \u003cartifactId\u003etensorflow-core-platform\u003c/artifactId\u003e\n        \u003cversion\u003e1.0.0-SNAPSHOT\u003c/version\u003e\n    \u003c/dependency\u003e\n\u003c/dependencies\u003e\n```\n\n## TensorFlow/Java Version Support\n\nThis table shows the mapping between TensorFlow, TensorFlow Java and minimum supported Java versions.\n\n| TensorFlow Java Version | TensorFlow Version | Minimum Java Version |\n|-------------------------|--------------------| --------------- |\n| 0.2.0                   | 2.3.1              | 8 |\n| 0.3.0                   | 2.4.1              | 8 |\n| 0.3.1                   | 2.4.1              | 8 |\n| 0.3.2                   | 2.4.1              | 8 |\n| 0.3.3                   | 2.4.1              | 8 |\n| 0.4.0                   | 2.7.0              | 8 |\n| 0.4.1                   | 2.7.1              | 8 |\n| 0.4.2                   | 2.7.4              | 8 |\n| 0.5.0                   | 2.10.1             | 11 |\n| 1.0.0-rc.1              | 2.16.1             | 11 |\n| 1.0.0-rc.2              | 2.16.2             | 11 |\n| 1.0.0-SNAPSHOT          | 2.16.2             | 11 |\n\n## How to Contribute?\n\nContributions are welcome, guidelines are located in [CONTRIBUTING.md](CONTRIBUTING.md).\n\n## Code and Usage Examples\n\nPlease look at this repository: https://github.com/tensorflow/java-models\n","funding_links":[],"categories":["人工智能"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftensorflow%2Fjava","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftensorflow%2Fjava","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftensorflow%2Fjava/lists"}