What features are landing into Apple Swift language?

85 views
Skip to first unread message

Rahul

unread,
Dec 29, 2019, 5:22:04 AM12/29/19
to Swift for TensorFlow
I have some queries regarding the plan about what will land into new version Apple Swift from S4TF? 

I hope other people might also be interested in this information. 😀 It would be really helpful if someone please answer my following queries. 

Q1. Is TensorFlow (imported as `import TensorFlow`) also going into master branch of Apple Swift or just differentiability in compiler (importable as `import Differentiable`)?
Q2. Will others also be able to build their new libraries on top of Differentiable feature of Swift? Furthermore, will these libraries also be as performant as TensorFlow (if it's porting to Apple Swift)?
Q3. Is Python library for interoperability also going into Apple Swift?
Q4. Lastly, is there any goal list of which features will go into Apple Swift from S4TF? Can somebody please share it?

PS: If there's some more information somebody else wants to ask and I might've missed please do ask about it in this thread. I will also be definitely interested. 😊 

Best.
Rahul Bhalley

Brad Larson

unread,
Dec 30, 2019, 5:03:10 PM12/30/19
to Swift for TensorFlow
I can take a stab at answering these questions, but others might be able to provide more specifics on some of these points. For an overview of the upstreaming process, there is the Upstreaming Swift AutoDiff plan that Richard has laid out. That has a good diagram of all the parts to be upstreamed and a planned sequence for these components. A brief overview of the feature gating and evolution process can be found here.

Q1. Is TensorFlow (imported as `import TensorFlow`) also going into master branch of Apple Swift or just differentiability in compiler (importable as `import Differentiable`)?

Automatic differentiation is the feature that is going through the Swift evolution process to hopefully become incorporated with the core language. The higher-level machine learning APIs don't need to be part of the core toolchain, and should be best served as one or more independent libraries.
 
Q2. Will others also be able to build their new libraries on top of Differentiable feature of Swift? Furthermore, will these libraries also be as performant as TensorFlow (if it's porting to Apple Swift)?

Automatic differentiation stands on its own as a feature, and has significant utility outside of its application with the higher-level Swift for TensorFlow APIs. Not only can other frameworks be built on top of it, that's the ideal outcome. There's been some really interesting work recently on differentiable molecular dynamics, for example, and a few other potential applications outside of machine learning are listed here.

When it comes to performance, it might not always make sense to compare these different frameworks that have different objectives. How does a molecular dynamics framework compare to a control system? If we restrict the discussion to machine learning: Swift as a language has the potential to generate very fast binaries, but end-to-end performance of a machine learning application can be a function of a lot of factors, such as runtime overhead, accelerator utilization, and so on. Right now, training a ResNet on an image classification dataset is noticeably faster when defined in Python using TensorFlow 2.0 (using a graph) than in Swift for TensorFlow because of the latter's reliance on the eager-mode TensorFlow runtime. Swift can be much faster than Python in many situations, but other components matter. That's why we're investing effort to significantly improve the performance of and interaction with other parts of the system.
 
Q3. Is Python library for interoperability also going into Apple Swift?

It was my understanding, per the latest discussion about the Python module, that there was hesitation from the community to include it in the standard toolchain distribution. It's part of the Swift for TensorFlow toolchain distribution, but the PythonKit package provides equivalent functionality for a standard toolchain. You can still have Python interoperability without that module being part of the core toolchain distribution.
 
Q4. Lastly, is there any goal list of which features will go into Apple Swift from S4TF? Can somebody please share it?

The above-linked upstreaming plan I think does a pretty good job of laying out what ideally would be integrated into the core Swift language. This is all still subject to the Swift evolution process, so the plans may change, but I'm hopeful that the value and design of automatic differentiation will help it to become part of the core language.

Again, others might be able to add color to what I've described.

Rahul

unread,
Jan 3, 2020, 1:47:02 PM1/3/20
to Swift for TensorFlow
Great. Thanks!
Reply all
Reply to author
Forward
0 new messages