To install Swift for TensorFlow, download one of the packages below and follow the instructions for your operating system. After installation, you can use the full suite of Swift tools, including swift
(Swift REPL/interpreter) and swiftc
(Swift compiler). See here for more details about using Swift for TensorFlow.
Note:
- If you want to modify the Swift for TensorFlow source code or build with a custom version of TensorFlow, see here for instructions on building from source.
- Swift for TensorFlow is an early stage project. It has been released to enable open source development and is not yet ready for general use by machine learning developers.
Packages will be released nightly after automated building is set up.
Download | Date (last commit) |
---|---|
Xcode 10 | October 17, 2018 |
Ubuntu 16.04 | October 17, 2018 |
Older Packages
Download |
---|
June 25, 2018 |
June 22, 2018 |
June 1, 2018 |
May 10, 2018 |
May 3, 2018 |
April 26, 2018 |
Xcode 10 is required.
Download |
---|
August 15, 2018 |
July 24, 2018 |
Download |
---|
July 24, 2018 |
July 19, 2018 |
July 12, 2018 |
June 29, 2018 |
June 25, 2018 |
June 22, 2018 |
June 1, 2018 |
May 10, 2018 |
May 3, 2018 |
April 26, 2018 |
Note: Currently, the Xcode toolchains above only support macOS development. iOS/tvOS/watchOS are not supported.
- macOS 10.13.5 or later
- Xcode 10.0 beta or later
- For GPU toolchains:
- CUDA Toolkit 9.2
- CuDNN 7.1
- An NVIDIA GPU with compute compability 3.5, 6.1 or 7.0
-
Download the latest package release.
-
Run the package installer, which will install an Xcode toolchain into
/Library/Developer/Toolchains/
. -
An Xcode toolchain (
.xctoolchain
) includes a copy of the compiler, lldb, and other related tools needed to provide a cohesive development experience for working in a specific version of Swift. -
Open Xcode’s
Preferences
, navigate toComponents > Toolchains
, and select the installed Swift for TensorFlow toolchain. -
Xcode uses the selected toolchain for building Swift code, debugging, and even code completion and syntax coloring. You’ll see a new toolchain indicator in Xcode’s toolbar when Xcode is using a Swift toolchain. Select the Xcode toolchain to go back to Xcode’s built-in tools.
-
Selecting a Swift toolchain affects the Xcode IDE only. To use the Swift toolchain with command-line tools, add the Swift toolchain to your path as follows:
$ export PATH=/Library/Developer/Toolchains/swift-latest/usr/bin:"${PATH}"
-
CUDA-only: If you downloaded a CUDA GPU version of the toolchain, add the library path(s) to CUDA and CuDNN to
$LD_LIBRARY_PATH
.$ export LD_LIBRARY_PATH=/usr/local/cuda/lib:"${LD_LIBRARY_PATH}"
Packages for Linux are tar archives including a copy of the Swift compiler, lldb, and related tools. You can install them anywhere as long as the extracted tools are in your PATH. Note that nothing prevents Swift from being ported to other Linux distributions beyond the ones mentioned below. These are only the distributions where these binaries have been built and tested.
- Ubuntu 14.04 or 16.04 (64-bit)
- Ubuntu 14.04 or 16.04 (64-bit)
- Install required dependencies:
$ sudo apt-get install clang libcurl3 libicu-dev libpython-dev libncurses5-dev
- Download the latest binary release above.
The swift-tensorflow-<VERSION>-<PLATFORM>.tar.gz
file is the toolchain itself.
- Extract the archive with the following command:
$ tar xzf swift-tensorflow-<VERSION>-<PLATFORM>.tar.gz
This creates a usr/
directory in the location of the archive.
- Add the Swift toolchain to your path as follows:
$ export PATH=$(pwd)/usr/bin:"${PATH}"
You can now execute the swift
command to run the REPL or build Swift projects.