Swift for TensorFlow

Welcome to the Swift for TensorFlow development community!

Swift for TensorFlow is a new way to develop machine learning models. It gives you the power of TensorFlow directly integrated into the Swift programming language. With Swift, you can write the following imperative code, and Swift automatically turns it into a single TensorFlow Graph and runs it with the full performance of TensorFlow Sessions on CPU, GPU and TPU.

import TensorFlow

var x = Tensor([[1, 2], [3, 4]])

for i in 1...5 {
  x += x ⊗ x


Swift combines the flexibility of Eager Execution with the high performance of Graphs and Sessions. Behind the scenes, Swift analyzes your Tensor code and automatically builds graphs for you. Swift also catches type errors and shape mismatches before running your code, and has Automatic Differentiation built right in. We believe that machine learning tools are so important that they deserve a first-class language and a compiler.

Open Source

We have released Swift for TensorFlow as an open-source project on GitHub!

Our documentation repository contains a project overview and technical papers explaining specific areas in depth. There are also instructions for installing pre-built packages (for macOS and Ubuntu) as well as a simple usage tutorial.

Moving forward, we will use an open design model and all discussions will be public.

Sign up here to join the community Google group, which we will use for announcements and general discussion.