Google Announces Open Source Swift for TensorFlow
In March of this year, Google publicly demonstrated Swift for TensorFlow at the TensorFlow Developer Summit. Recently, TensorFlow official website announced that Swift for TensorFlow has been open sourced on GitHub.
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.
Swift for TensorFlow provides TensorFlow with a new programming model that combines the TensorFlow calculation diagram with Eager Execution’s flexibility and expressiveness, while also focusing on improving the usability of each layer of the entire software architecture.
The design is based on an algorithm called “Graph Program Extraction”, which allows you to easily implement code using the Eager Execution-style programming model while retaining the high-performance advantages of the TensorFlow calculation graph.
Implementing the reliable Graph Program Extraction algorithm has high requirements for the design of programming languages. After analysis and discussion, Google chose Swift as the main language. They integrate advanced autodifferentiation directly into the Swift language and compiler. Here are the details of using Swift as the TensorFlow programming language:
https://github.com/tensorflow/swift/blob/master/docs/WhySwiftForTensorFlow.md
Google also wrote some documents detailing the theory and implementation. The address is as follows:
The “Swift for TensorFlow Design Overview” document describes the main components of the project and how they are combined. Google also introduced in depth the integration of Python and Swift, and everyone can use any Python API directly through Swift code.
At present, the project has macOS and Linux installation packages, as well as development guides that teach you how to obtain the source code. At present, this project is still in the early stage of development. Everyone can participate in the discussion of their design plans and work together to promote the development of this project.