{"id":15176719,"url":"https://github.com/ekrich/stensorflow","last_synced_at":"2025-10-26T13:31:22.685Z","repository":{"id":42645722,"uuid":"191997814","full_name":"ekrich/stensorflow","owner":"ekrich","description":"Scala Native support for the TensorFlow C API on Linux and macOS","archived":false,"fork":false,"pushed_at":"2025-02-06T19:48:49.000Z","size":213,"stargazers_count":41,"open_issues_count":2,"forks_count":3,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-02-06T20:34:52.533Z","etag":null,"topics":["linux","machine-learning","macos","neural-networks","scala","scala-native","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ekrich.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2019-06-14T19:48:05.000Z","updated_at":"2025-02-06T19:48:54.000Z","dependencies_parsed_at":"2024-01-23T00:29:05.292Z","dependency_job_id":"d0b14d0e-e93f-4495-91cf-f9cc17ca7fdc","html_url":"https://github.com/ekrich/stensorflow","commit_stats":{"total_commits":113,"total_committers":3,"mean_commits":"37.666666666666664","dds":"0.33628318584070793","last_synced_commit":"003686b946a0c25e424b23830fd40cdb9f418052"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekrich%2Fstensorflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekrich%2Fstensorflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekrich%2Fstensorflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ekrich%2Fstensorflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ekrich","download_url":"https://codeload.github.com/ekrich/stensorflow/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238337352,"owners_count":19455295,"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":["linux","machine-learning","macos","neural-networks","scala","scala-native","tensorflow"],"created_at":"2024-09-27T13:40:43.178Z","updated_at":"2025-10-26T13:31:17.292Z","avatar_url":"https://github.com/ekrich.png","language":"Scala","readme":"# stensorflow - Scala Native TensorFlow\n![CI](https://github.com/ekrich/stensorflow/workflows/CI/badge.svg)\n\nThis library implements the C TensorFlow API adapted for the Scala Native platform.\n\nScala Native is a unique platform that\nmarries the high level language of Scala but compiles to native code with a\nlightweight managed runtime which includes a state of the art garbage collector.\nThe combination allows for great programming and the ability to use high\nperformance C language libraries like TensorFlow.\n\nScala Native uses the Scala compiler to produce\n[NIR](https://scala-native.readthedocs.io/en/latest/contrib/nir.html)\n(Native Intermediate Representation) that is optimized and then\nconverted to [LLVM IR](http://llvm.org/). Finally LLVM code is optimized\nand compiled by [Clang](http://clang.llvm.org/) to produce a native executable.\n\n## Getting started\n[![Maven Central](https://img.shields.io/maven-central/v/org.ekrich/stensorflow_native0.5_3.svg)](https://maven-badges.herokuapp.com/maven-central/org.ekrich/stensorflow_native0.5_3)\n\nYou can use the Gitter8 template [stensorflow.g8](https://github.com/ekrich/stensorflow.g8#stensorflowg8) to get started. The linked directions will send you back here to install the Tensorflow library below but it should be easier overall.\n\nIf you are already familiar with Scala Native you can jump right in by adding the following dependency in your `sbt` build file. Refer to the `TensorflowTest.scala` source in this repository or in the template referred to above for an example.\n\n```scala\nlibraryDependencies += \"org.ekrich\" %%% \"stensorflow\" % \"x.y.z\"\n```\n\nTo use in `sbt`, replace `x.y.z` with the version from Maven Central badge above.\nAll available versions can be seen at the [Maven Repository](https://mvnrepository.com/artifact/org.ekrich/stensorflow).\n\nOtherwise follow the [Getting Started](https://scala-native.readthedocs.io/en/latest/user/setup.html)\ninstructions for Scala Native if you are not already setup.\n\n## Scala Build Versions\n\n| Scala Version          | Native (0.5.x)       |\n| ---------------------- | :-------------------: |\n| 3.3.x (LTS)            |          ✅           |\n\n\n* Use version `0.5.0` for Scala Native `0.5.x`.\n* Use version `0.3.0` for Scala Native `0.4.9+`.\n\nNote: Refer to release notes for older versions of Scala and Scala Native\n\n## Tensorflow library\n\nThe TensorFlow C library is required and the current version is `2.16.1`\nwith `2.5.0` pre-built for Linux.\n\n* Linux/Ubuntu can TensorFlow following the following directions:\n\nhttps://www.tensorflow.org/install/lang_c\n\nThe essential directions are repeated here replacing `\u003cversion\u003e` with the above:\n\n```\n$ FILENAME=libtensorflow-cpu-linux-x86_64-\u003cversion\u003e.tar.gz\n$ wget -q --no-check-certificate https://storage.googleapis.com/tensorflow/libtensorflow/${FILENAME}\n$ sudo tar -C /usr/local -xzf ${FILENAME}\n$ sudo ldconfig /usr/local/lib\n```\n\n* macOS can install TensorFlow using [Homebrew](https://formulae.brew.sh/formula/libtensorflow) \nwhich will install into the `/usr/local/Cellar/libtensorflow/\u003cversion\u003e` directory.\n\nNote: macOS 12 or greater is recommended to install TensorFlow via\nHomebrew and is used in CI. Tensorflow `2.16.1` is built for macos `13.1` so you\nwill get a linking warning if using an older OS version.\n\n```\n$ brew install libtensorflow\n```\n\n* Other OSes need to have `libtensorflow` available on the system.\n\n## Usage and Help\n[![scaladoc](https://www.javadoc.io/badge/org.ekrich/stensorflow_native0.5_3.svg?label=scaladoc)](https://www.javadoc.io/doc/org.ekrich/stensorflow_native0.5_3)\n[![Discord](https://img.shields.io/discord/633356833498595365.svg?label=\u0026logo=discord\u0026logoColor=ffffff\u0026color=404244\u0026labelColor=6A7EC2)](https://discord.gg/XSj6hQs)\n\nReference the link above for Scaladoc. The documentation is a little sparse but hopefully will improve with time.\n\nAfter `sbt` is installed and any other Scala Native prerequisites are met you can use the following Gitter G8 template instructions to get a fully functional Scala Native application with an example in the body of the main program.\n\n```\n$ sbt new ekrich/stensorflow.g8\n$ cd \u003cdirectory entered after the prompt\u003e\n$ sbt run\n```\n\nIn addition, look at the [stensorflow unit tests](https://github.com/ekrich/stensorflow/blob/main/stensorflow/src/test/scala/org/ekrich/tensorflow/unsafe/TensorflowTest.scala) for other examples of usage.\n\n## TensorFlow References and External Documentation\n\n[TensorFlow Website](https://www.tensorflow.org/)\u003cbr/\u003e\n[TensorFlow for JVM using JNI](https://platanios.org/tensorflow_scala/)\n\n## Tensorflow for Scala Native contributors\n\nThe Language Server `clangd` can be used to help development using VSCode or other editors. For VSCode see the `clangd` plugin on the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd) for more info.\n\nAdd a `compile_flags.txt` with the following content to the `stensorflow/src/main/resources/scala-native` directory.\n\n```\n# Tensorflow Setup\n# Standard path on macOS arm\n-I\n/opt/homebrew/include\n```\n\nChange the path to match your include path. There is a small amount of official documentation that contains info about [compile_flags.txt](https://clang.llvm.org/docs/JSONCompilationDatabase.html). Otherwise some other info can be found online.\n\n## Versions\n\nRelease [0.5.0](https://github.com/ekrich/stensorflow/releases/tag/v0.5.0) - (2024-04-11)\u003cbr/\u003e\nRelease [0.4.0](https://github.com/ekrich/stensorflow/releases/tag/v0.4.0) - (2024-03-01)\u003cbr/\u003e\nRelease [0.3.0](https://github.com/ekrich/stensorflow/releases/tag/v0.3.0) - (2022-11-29)\u003cbr/\u003e\nRelease [0.2.0](https://github.com/ekrich/stensorflow/releases/tag/v0.2.0) - (2021-12-13)\u003cbr/\u003e\nRelease [0.1.0](https://github.com/ekrich/stensorflow/releases/tag/v0.1.0) - (2021-07-02)\u003cbr/\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fekrich%2Fstensorflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fekrich%2Fstensorflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fekrich%2Fstensorflow/lists"}