{"id":17623679,"url":"https://github.com/zachgrayio/swift-tensorflow-repl","last_synced_at":"2026-01-08T13:06:43.056Z","repository":{"id":90044449,"uuid":"131248123","full_name":"zachgrayio/swift-tensorflow-repl","owner":"zachgrayio","description":"Dockerized Swift for TensorFlow REPL.","archived":false,"fork":false,"pushed_at":"2018-04-28T01:45:25.000Z","size":6,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-05T03:37:35.184Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zachgrayio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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}},"created_at":"2018-04-27T05:09:00.000Z","updated_at":"2018-06-02T14:21:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"a3589b68-71f9-4d81-b726-cf29097da4ce","html_url":"https://github.com/zachgrayio/swift-tensorflow-repl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachgrayio%2Fswift-tensorflow-repl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachgrayio%2Fswift-tensorflow-repl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachgrayio%2Fswift-tensorflow-repl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachgrayio%2Fswift-tensorflow-repl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zachgrayio","download_url":"https://codeload.github.com/zachgrayio/swift-tensorflow-repl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246265115,"owners_count":20749591,"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-10-22T21:23:28.859Z","updated_at":"2026-01-08T13:06:43.038Z","avatar_url":"https://github.com/zachgrayio.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# swift-tensorflow-repl\n\nDockerized [Swift for TensorFlow](https://github.com/tensorflow/swift) REPL based on [swift-tensorflow](https://github.com/zachgrayio/swift-tensorflow). This image is available now on Docker Hub at `zachgray/swift-tensorflow-repl:4.2`.\n\n## Motivation\n\nWith this container, you can run the Swift for TensorFlow REPL with a single command.\n\n## Overview\n\nThis image will allow you to easily take the official [Swift for TensorFlow](https://github.com/tensorflow/swift) for a test drive without worrying about installing dependencies, changing your path, and interfering with your existing Swift/Xcode config.\n\n## Run\n\n*Note: when running this interactive container with the standard `-it`, we also must [run without the default seccomp profile](https://docs.docker.com/engine/security/seccomp/) with `--security-opt seccomp:unconfined` to allow the Swift REPL access to `ptrace` and run correctly.*\n\n#### Run the `swift-tensorflow-repl` container:\n\n```bash\ndocker run --rm --security-opt seccomp:unconfined -it zachgrayio/swift-tensorflow-repl:4.2\n```\n\n#### Observe the output:\n```\nWelcome to Swift version 4.2-dev (LLVM 04bdb56f3d, Clang b44dbbdf44). Type :help for assistance.\n  1\u003e \n```\n\n#### Interact with TensorFlow:\n\n```\n  1\u003e import TensorFlow\n  2\u003e var x = Tensor([[1, 2], [3, 4]])\n2018-04-27 04:30:17.505272: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA\nx: TensorFlow.Tensor\u003cDouble\u003e = [[1.0, 2.0], [3.0, 4.0]]\n  3\u003e x + x\n$R0: TensorFlow.Tensor\u003cDouble\u003e = [[2.0, 4.0], [6.0, 8.0]]\n  4\u003e :exit\n```\n\n## Run with Volume\n\nTo do real work with TensorFlow, you'll likely want to access your local disk. This is accomplished easily in Docker by mounting your current working directory into the container.\n\n#### Run the `swift-tensorflow-repl` container:\n\n```bash\ndocker run --rm --security-opt seccomp:unconfined -itv ${PWD}:/usr/src \\\n    zachgrayio/swift-tensorflow-repl:4.2\n```\n\nFiles in your current working directory are now available; the file `file.txt` will be accessible at path `/usr/src/file.txt`.\n\n## Create a run script (optional)\n\n```bash\nnano tfrepl.sh\n```\n\nPaste:\n\n```bash\n#!/usr/bin/env bash\ndocker run --rm --security-opt seccomp:unconfined -itv ${PWD}:/usr/src \\\n    zachgrayio/swift-tensorflow-repl:4.2\n```\n\n- Press Ctrl + O\n- Press ENTER\n- Press Ctrl + X\n\n```bash\nchmod +x ./tfrepl.sh\n```\n\nRun with `./tfrepl.sh`.\n\n\n## Advanced Usage\n\nYou should make use of the parent image [swift-tensorflow](https://github.com/zachgrayio/swift-tensorflow) and its deeper documentation for advanced use cases such as:\n\n* [Compiling executables](https://github.com/zachgrayio/swift-tensorflow#run-the-compiler)\n* [Passing scripts to the interpreter](https://github.com/zachgrayio/swift-tensorflow#run-the-interpreter)\n* [Importing third-party libraries](https://github.com/zachgrayio/swift-tensorflow#run-with-dependencies-advanced) such as [RxSwift](https://github.com/ReactiveX/RxSwift) into your REPL session\n* Creating and building SPM projects\n\n## License\n\nThis project is [MIT Licensed](https://github.com/zachgrayio/swift-tensorflow-repl/blob/master/LICENSE).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzachgrayio%2Fswift-tensorflow-repl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzachgrayio%2Fswift-tensorflow-repl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzachgrayio%2Fswift-tensorflow-repl/lists"}