October 28–31, 2019
Please log in

Swift for TensorFlow in 3 hours

Mars Geldard (University of Tasmania), Tim Nugent (Lonely Coffee), Paris Buttfield-Addison (Secret Lab)
1:30pm5:00pm Tuesday, October 29, 2019
Location: Grand Ballroom A/B

Who is this presentation for?

  • ML programmers who want to learn new skills, deep learning engineers, Python programmers seeking to diversify, users of TensorFlow wanting to learn Swift for TensorFlow, and anyone who wants to get into deep learning or Swift


New to TensorFlow


Mars Geldard, Tim Nugent, and Paris Buttfield-Addison are here to prove Swift isn’t just for app developers. Swift for TensorFlow provides the power of TensorFlow with all the advantages of Python (and complete access to Python libraries, as needed) and Swift—the safe, fast, incredibly capable open source programming language.

Swift is a powerful, well supported, open, and now mature programming language. Swift for TensorFlow is brand new, solidly backed, and maturing rapidly. You can’t do everything with Swift for TensorFlow yet, but you can learn a lot and improve your thinking on how and why certain tool sets work. Learn the bleeding edge before it arrives, and pick up valuable Swift skills along the way.

This is a three-hour exploration of everything you need to know to work with Swift, Swift for TensorFlow, and beyond. You’ll leave with the knowledge to use Swift, a programming language that’s great for everything from numeric computing to application development, and Swift for TensorFlow, the official TensorFlow project that brings new tooling, systems design, compilers, and features to the machine learning world, by way of Swift.



  • The basics of Swift and how to get started using a Jupyter notebook (yes, they fully support Swift)
  • Why Swift is a great language for scientific computing and deep learning
  • How Swift can match the performance of manually tuned assembly code in numerical computing
  • How Swift for TensorFlow works, what it’s capable of, and where it’s headed (learn the power of differential operators and being able to ask your types for their gradient)
  • Why Swift for TensorFlow is not just a port of TensorFlow to a different language (embrace differentiable programming)
  • How you can use all your favorite Python libraries, including NumPy, pickle, and beyond, easily and directly from Swift

Specifically, you’ll

  • Begin with a Swift programming tutorial covering how to use Swift as a programming language (Mars, Tim, and Paris use both Apple’s Playgrounds (for macOS devices) and Jupyter notebooks.)
  • Explore Swift for TensorFlow by diving into fundamental machine learning problem solving using TensorFlow and Swift
  • Explore and demonstrate common use cases for TensorFlow using Swift
  • Learn how to use NumPy, the ubiquitous Python library from Swift, to perform common and useful data science operations and integrate the results with Swift for TensorFlow
  • Bring all the components together: Swift programming (in a notebook), showcasing common ML problem-solving processes using Swift for TensorFlow, and integrating Python libraries as needed in a pragmatic manner
  • Discover resources to build on during your journey through Swift, Swift for TensorFlow, and the future of deep learning, differentiable programming, and the future of programming languages

Prerequisite knowledge

  • Experience with Python (useful but not required)

Materials or downloads needed in advance

  • A laptop with any platform (You'll be provided with a link to Jupyter and optionally a local Docker container to run locally with minimal setup needed.)

What you'll learn

  • Learn how to program in Swift in depth, how to use that knowledge in Swift for TensorFlow to perform basic deep learning work, and how to get more knowledge to further both your Swift programming broadly and your use of Swift for TensorFlow specifically
Photo of Mars Geldard

Mars Geldard

University of Tasmania

Marina Rose Geldard (Mars) is a technologist from Down Under in Tasmania. Entering the world of technology relatively late as a mature-age student, she has found her place in the world: an industry where she can apply her lifelong love of mathematics and optimization. She compulsively volunteers at industry events, dabbles in research, and serves on the executive committee for her state’s branch of the Australian Computer Society (ACS) as well as the AUC. She’s writing Practical Artificial Intelligence with Swift for O’Reilly and working on machine learning projects to improve public safety through public CCTV cameras in her hometown of Hobart.

Photo of Tim Nugent

Tim Nugent

Lonely Coffee

Tim Nugent pretends to be a mobile app developer, game designer, tools builder, researcher, and tech author. When he isn’t busy avoiding being found out as a fraud, Tim spends most of his time designing and creating little apps and games he won’t let anyone see. He also spent a disproportionately long time writing his tiny little bio, most of which was taken up trying to stick a witty sci-fi reference in…before he simply gave up. He’s writing Practical Artificial Intelligence with Swift for O’Reilly and building a game for a power transmission company about a naughty quoll. (A quoll is an Australian animal.)

Photo of Paris Buttfield-Addison

Paris Buttfield-Addison

Secret Lab

Paris Buttfield-Addison is a cofounder of Secret Lab, a game development studio based in beautiful Hobart, Australia. Secret Lab builds games and game development tools, including the multi-award-winning ABC Play School iPad games, the BAFTA- and IGF-winning Night in the Woods, the Qantas airlines Joey Playbox games, and the Yarn Spinner narrative game framework. Previously, Paris was a mobile product manager for Meebo (acquired by Google). Paris particularly enjoys game design, statistics, blockchain, machine learning, and human-centered technology. He researches and writes technical books on mobile and game development (more than 20 so far) for O’Reilly; he recently finished writing Practical AI with Swift and is currently working on Head First Swift. He holds a degree in medieval history and a PhD in computing. Paris loves to bring machine learning into the world of practical and useful. You can find him on Twitter as @parisba.

Comments on this page are now closed.


Picture of Paris Buttfield-Addison
Paris Buttfield-Addison | Cofounder
10/27/2019 1:59am PDT


In addition to the earlier notes, it would be useful for you to install a local code editor with Swift support, such as VS Code.

If you are running a macOS device, we also suggest installing Xcode 11.1:



Picture of Paris Buttfield-Addison
Paris Buttfield-Addison | Cofounder
10/22/2019 3:24pm PDT

Hi everyone!

Just some info what you’ll need!

Attendees to the Swift for TensorFlow tutorial will need a Google account, capable of accessing both the Google Drive and the Google Collaboratory (https://colab.research.google.com) service, and authenticating them together. We recommend using a personal Google account. This is all you’ll need!

For the more adventurous, if you want to get going on your own local machine, and you use a macOS or Linux machine, then you can also (please also ensure you have a Google account, as above) install the Swift for TensorFlow toolchain locally on your machine:

WARNING: This will consume a lot of space on your drive. It is not feasible for you to do this at the event while we’re presenting. Please make every effort to do this in advance if you’re going to try for a local install. Please also make sure your Google Account is ready to go!

1. Clone the “swift-jupyter” project: https://github.com/google/swift-jupyter.git

2. Install Docker, and launch it.

3. In the cloned “swift-jupyter” project, execute the following command:

docker build -f docker/Dockerfile -t swift-jupyter .

This will download several gigabytes of material and take a while.

4. Once that’s done, run the following:

docker run -p 8888:8888 —cap-add SYS_PTRACE -v /my/host/notebooks:/notebooks swift-jupyter

Please substitute __/my/host/notebooks_ with a path to a folder you can put the notebooks we’ll be providing at the session in.

5. You can then launch Jupyter Notebooks (with Swift support) via the URL that’s been presented to you!

If you’re running Ubuntu 18.04 (64-bit), you can also install Swift and the Swift for TensorFlow toolchain locally:

  • Install dependencies:

apt-get install python3 python3-venv

  • Create a Python 3 virtual environment within the swift-jupyter clone:

python3 -m venv venv

  • Activate it:

. venv/bin/activate

  • Install the requirements:

pip3 install -r requirements.txt

  • Download and extract the Swift toolchain:


  • Register the Swift toolchain (from within the swift-jupyter folder):

python register.py —sys-prefix —swift-toolchain

  • Then run Jupyter:

jupyter notebook

NOTE: If you’re concerned, scared, or otherwise cannot perform the complex setup, then a Google Account and access to Google Drive and Google Colab will be perfect. Don’t worry if your machine can’t run Docker, and all the other bits, Google Colab is great, and is all you will need to get started. Your experience with running models on. your local machine is likely to be slower than what Google Colab offers unless you machine has a seriously large amount of RAM/GPU/speed. If you’re up for it, we encourage setting up a local install anyway, as it’s fun to play with!

Please post here if you have any questions!


  • O'Reilly
  • TensorFlow
  • Google Cloud
  • IBM
  • Databricks
  • Tensor Networks
  • VMware
  • Amazon Web Services
  • One Convergence
  • Quantiphi
  • Lambda Labs
  • Tech Mahindra
  • cnvrg.io
  • Determined AI
  • Inferencery
  • Manceps, Inc.
  • PerceptiLabs
  • Valohai

Contact us


For conference registration information and customer service


For more information on community discounts and trade opportunities with O’Reilly conferences


For information on exhibiting or sponsoring a conference


For media/analyst press inquires