“Swift for TensorFlow” to be developed on “tensorflow” branch on apple/swift on GitHub

The Swift for TensorFlow project is an exciting endeavor that is a great example of the kind of expansion of Swift to more domains and applications that was enabled and envisioned by making Swift open source.

For bringup reasons the Swift compiler work for Swift for TensorFlow has been going on at the GitHub fork google/swift. @Chris_Lattner3 and I both feel that moving the work on that fork to be directly developed on apple/swift is beneficial to the Swift community for two reasons:

  • From an engineering perspective it re-concentrates active collaborative work on the Swift compiler into a central place.

  • It helps allay concerns about a distinct language fork of Swift for TensorFlow being developed outside the primary Swift repository.

While Swift for TensorFlow may inevitably contain changes specific for the needs of the TensorFlow domain, @Chris_Lattner3 and I believe that the vast majority of the work going into Swift for TensorFlow aligns with the core goals of the Swift project and ideally would be eventually “upstreamed” into the Swift master branch. In the meantime as an intermediate step, the Swift for TensorFlow work will be moving from google/swift to a new feature branch on apple/swift titled tensorflow.

Some key operational points:

  • The tensorflow branch will be tracking master very closely.

  • Google plans on looking into wiring up CI support for the branch as part of the newly announced Community-Hosted Continuous Integration.

  • New language features being developed in the tensorflow branch will eventually go through the Swift evolution process as part of being considered for being pulled into master.

  • Both @Chris_Lattner3 and I hope that the tensorflow branch will eventually go away, with TensorFlow-specific bits existing in master but potentially conditionalized under feature guards. The work will start out in the tensorflow branch given that it is relatively new and undergoing significant iteration and churn.

  • TensorFlow work related to changes to the Swift compiler will be discussed on the Development > Compiler section of the Swift forum, just like any other compiler work.

  • Bug reports related to the Swift for TensorFlow support in the compiler can be filed in the Swift bug tracker against the “Swift for TensorFlow” component.

The tensorflow branch will be created imminently after this post. My thanks for @Chris_Lattner3 for bringing this work back to the primary Swift repository.



Fantastic Ted, we’re looking forward to working even more closely with the Swift community. It will be exciting to see Swift gain capabilities that appeal to the machine learning and numeric programming communities.



This may be a silly question, but wouldn’t that create a Swift dialect? I haven’t looked that much into the main project yet, but is the project also meant to be integrated into actual Apps? For instance I could imagine an App on top of the project that might generate some graphs visually or something along the lines (again I haven’t looked into it that closely). Then we wouldn’t be able to build native macOS app and publish them on the AppStore since Apple is not allowing us to ship App’s to the AppStore that are not build with the toolchain other than the one comes with Xcode. Can someone please clarify that for me?! :slight_smile:

I think this is more specific to supporting a specific platform (such as Linux versus Darwin, which have differences too) rather than a whole new dialect. @Chris_Lattner3 and I think many of the “TensorFlow-specific” pieces likely aren’t specific to TensorFlow at all, and those that are will be tied to that compute story that is inherently platform-specific. Exactly where the cards will fall depends on how the story evolves.

1 Like

No. When we are done, the only thing that is specific to TensorFlow is the Tensor and related types defined in the TensorFlow module. Swift will be buildable with a configure flag that enables the TensorFlow specific logic. A Swift build without that logic just won’t be able to “import TensorFlow”, just like not all Swift builds can “import Darwin”.

The Python, auto-differentiation, and other pieces of the project should still work just fine. This is possible because we have an intentional and clean layering, as is outlined in our design doc.



That’s great news! @Chris_Lattner3, should/could the current “Swift for TensorFlow” Google Group be moved to the new Related Projects section in the Swift Forums announced yesterday? This could help concentrate all Swift Evolution discussion in one place.


We’re moving the compiler engineering pieces and general swift user questions to the Swift forum as Ted indicated, but currently prefer to keep the machine learning specific discussions on TensorFlow lists.


1 Like

Likewise, we plan to keep github/tensorflow/swift as the landing page for the project. Machine learning researchers don’t necessarily care about the ins and outs of the Swift open source project. The programming language is just an implementation detail to many of them, the high level APIs (which we haven’t built yet) are what matters the most. This is analogous to how Apple maintains Xcode as its product that incorporates Swift OSS.



This is a great development. Many thanks.

good job.

Community CI is set up!

Terms of Service

Privacy Policy

Cookie Policy