Ask Jeremy & Chris anything about Swift 4 TensorFlow

Post your questions for Jeremy and Chris Lattner about Swift 4 TensorFlow (which will be covered in lessons 13 and 14). Questions with the most upvotes will be answered at the end of class this evening.

Background: posts on Swift

And on why you need to keep learning new languages: You should assume that whatever specific libraries and software you learn today will be obsolete in a year or two. Just think about the number of changes of libraries and technology stacks that occur all the time in the world of web programming — and yet this is a much more mature and slow-growing area than deep learning. So we strongly believe that the focus in learning needs to be on understanding the underlying techniques and how to apply them in practice, and how to quickly build expertise in new tools and techniques as they are released.Jeremy, in 2017

Here’s some thought starters from a slide Jeremy will show at the end of the class:


After going through some of the Swift documentation, it seems like it is a very versatile language for many use cases. If I understand correctly deep learning, robotics, web development, and systems programming all seem well under its purview.

Do you foresee Swift’s influence flourishing in all these separate areas and allowing for a tighter and more fluid development environment between disciplines? (e.g. Using Swift to deploy models instead of Python/Swift + JavaScript + other frameworks, or a better robotics stack.)

Where do you see Swift’s limitations and what languages do you think are most important as synergistic partners to Swift? What should we learn to be prepared for this?

  1. Is it worth it/recommended to learn how to build models with TF 2.0 as a precursor to Swift4TF … or is Swift 4 TensorFlow so completely different that the effort would be better placed on starting with it?

  2. Where is the best place to start your journey into < insert your answer from #1 here>?


To preface my questions: I don’t know Swift, at all. And maybe you’ll answer my questions during the lecture.

  • Why are you saying that Python’s days are numbered?
  • What makes Swift better than Python for DL?
  • What about PyTorch? Why Swift 4 TF and not PyTorch?

Does it make sense to spend efforts learning and writing in Swift only, or does it worth to have some understanding of C++ as well to be good in numerical computations programming? It seems that C/C++ still here for many years and still pretty widespread. (Recently I’ve even seen a C++ course announced on Udacity).


Is swift a good language to implement graph convolution library in? Why or why not how, is it better than pytorch or julia in this regard. Thanks!


Long term, where do you see the machine learning/artificial intelligence field going? Can you talk about how you see software and hardware evolving in the future?

What is MLIR and how it is related to S4TF? Will MLIR enable deep learning in different hardware platforms? Is MLIR for any programming language or just S4TF?

In one of Jeremy’s tweets, he mentioned that MLIR + S4TF is the next step in deep learning. I would like to know what Jeremy meant by that.

Many thanks!


Assuming someone has 0 knowledge of swift, what would be the most efficient way to learn it and get up to speed with using S4TF?


As S4TF evolves, what do you think will be the first kind machine learning work, accessible to people who don’t have access to big corporate data centers, where S4TF’s particular strengths will make it a better choice than the more traditional Python-based frameworks?


One great resource is the online Swift Language book on I’d recommend starting with a Swift tour to get a brief overview of lots of different things.



What will S4TF + MLAI/XLA mean for the deployability of models? For example, will it make it easier to train a model on eg a large TPU cluster, then produce inference-focused saved models for desktop, mobile & embedded applications with fewer steps?


Do you think swift will make deep learning debugging easier ?


All of the lectures (as I recall) were streamed using Windows. Is there a good story for Swift on Windows or does Jeremy plan to use an alternative approach for these lessons?

I have no stake in this (I use Ubuntu) but this will probably impact a good portion of the students.

All lectures are streamed on a Windows computer, but Jeremy uses a jupyter notebook through an Ubuntu system I believe. So I think Ubuntu is going to be the main OS for most things including Swift.

1 Like

what’s the fuss about swift compiler infra and ‘Multi-Level Intermediate Representation’ - where is this different from known compilers / interpreters and where is the big advantage for Deep Learning?

Some ways I tried self answering this:

  • speed: as fast as C but swift is much nicer to use
  • debugging: in python we often call C libraries, so we do not know what’s going on. In swift we can debug all the way down the stack?
  • It’s not about the infra really: rather, swift is well designed and has types (better than python)
  • …?

check this thread: Best book, podcast, tutorial a.o. for swift architecture & design


For someone who is just getting comfortable with the landscape of deep learning and coding in Python+Pytorch/Fastai (also Keras/Tensorflow for that matter !) , do you think jumping into swift now will be a good move? Or we should first get comfortable with Pytorch/Python/Fast ai to the point where we can be good practitioners/coders in this stack and then think of moving into Swift?
Don’t want to end up learning bits and pieces of everything but not comfortable (or fluent) in anything.

1 Like

Is Jeremy going to follow established Swift coding and naming conventions? :stuck_out_tongue:

I’m saying this a bit tongue-in-cheek, but I do worry that a lot of people will be exposed to Swift for the first time through Jeremy’s code examples, and in my opinion, they’re not representative of how most Swift code is being written currently. (For example, almost none of Jeremy’s published Swift code uses named parameters.)

There are some efforts in the Swift community to come up with an “official” style guide, but in the mean time here is one that is commonly used, in case anyone is interested in one opinion of how to write readable Swift code: