Is Swift for TensorFlow the future of Machine Learning Development?
In his excellent blog post last week, MIT PhD Jameson Toole lists the reasons why he and other members of the machine learning and data science community had pretty much settled on Python until now:
- Syntax that’s beginner friendly
- A great scripting language
- Performance optimization is possible, using lower-level libraries in C
- Ability to build entire systems end-to-end
- Great community support for scientific-computing packages like Numpy, Pandas, Matplotlib, and Jupyter notebooks
- Frameworks like Flask and Django that can be used to build applications to scale to hundreds of millions of users
Despite all of this, and despite having been satisfied with Python for almost 10 years, Toole says that he doesn’t think he’ll still be using it another decade from now. He thinks he’ll be using Swift.
“I’d planned on clinging to my Numpy arrays forever, but these days, it’s harder and harder to complete projects without leaving the boundaries of Python. It’s no longer a good-enough solution.” -Jameson Toole
The reasons Toole gives to justify the need to reexamine Python have to do, in part, with an ever-increasing emphasis on neural networks and deep learning, combined with a shift towards mobile-first AI applications. Toole makes the case that both of these developments call for high-performance computing in ways that stretch Python too far.
If a change is needed, then why choose Swift for TensorFlow?
First, of course, TensorFlow is one of the more popular open-source frameworks for machine learning. Other popular ML frameworks are Amazon Machine Learning, Accord.net, Shogun, Torch, Caffe, Microsoft Cognitive Toolkit, and the Apache ecosystem (Singa, Mahout, Spark MLib).
So far, TensorFlow seems to be getting the most traction. It was initially launched by the Google Brain team under Apache 2.0 open source, using a Python-based interface. TensorFlow is used extensively for research and production at Google, and has been used in many Google products, like speech recognition, gmail and photos. It’s available on 64-bit Linux, macOS, Windows, and mobile computing platforms, including Android and iOS.
Which brings us now to Swift . . .
Swift is an open-source project that seems to represent an attempt by Google to change the default tools used by the entire machine learning and data science ecosystem, so it’s a big deal.
Toole believes that Chris Lattner and his team at Google have “checked the boxes” on what would be required to achieve broad adoption. Success factors would include:
- Readable, efficient syntax
- Scripting capabilities
- Notebook-like interfaces
- A large, active community, building third-party libraries
- A clean, automated way of compiling code for specialized hardware – everything from TPUs to mobile chips
- An open-source compiler and static typing, making it possible to target specialized AI chipsets at the build stage.
- Native execution on mobile
- Great performance, closer to C
Here’s a link to the Swift for TensorFlow unveiling this month at the TensorFlow 2018 Dev Summit, presented by Chris Lattner and Richard Wei.
In his launch presentation, Chris highlights full performance of graphs, ability to use native language control flow, built-in support for automatic differentiation, ability to detect errors in your code without even running it, plus Python interoperability, including full access to Python APIs. Google plans to release open source for the Swift Evolution design environment this month.
Judge for yourself. The presentation starts off a little rocky, but then gets to the point pretty fast. Total viewing time: 14 minutes.
Jim Griffin is the Americas Director of Cartesian DataSciences.
iOS Developer at Revolut
4yAt first glance Python for Tensorflow seems to be much more readable by doing linear/sequential code. So I think python remains first choice in Tensorflow.