# Swift for Tensorflow rationale

**URL:** https://discourse.julialang.org/t/swift-for-tensorflow-rationale/10563
**Category:** Offtopic
**Created:** [April 26, 2018, 8:07pm UTC](https://discourse.julialang.org/t/swift-for-tensorflow-rationale/10563 "2018-04-26T20:07:16Z")
**Posts on this page:** 12
**Page:** 2

<div class="post-metadata">

### Author: ![xor0110](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xor0110/32/7926_2.png) [@xor0110](https://discourse.julialang.org/u/xor0110)
#### Post date: [April 9, 2019, 4:53pm UTC](https://discourse.julialang.org/t/swift-for-tensorflow-rationale/10563/21 "2019-04-09T16:53:45Z")

</div>

Thanks. I didn’t mean hacking as something negative, I’ve actually been a subscriber to the 2600 Magazine. I mean specifically modifying a language interpreter to implement a new “niche” feature that might even not make it to upstream. It is starting to seem to me that Julia is attaining something special by not just being a modern language based on the LLVM, but by sticking to a few extra principles and clear priorities, and embracing meta-programming early on might turn out to be a huge strategic move for Julia, even if no concrete plans were in sight. I guess this will all become clearer maybe this year!

---

<div class="post-metadata">

### Author: ![ImreSamu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/imresamu/32/20677_2.png) [@ImreSamu](https://discourse.julialang.org/u/ImreSamu)
#### Post date: [February 12, 2021, 8:28pm UTC](https://discourse.julialang.org/t/swift-for-tensorflow-rationale/10563/22 "2021-02-12T20:28:03Z")

</div>

RIP- Swift for TensorFlow Shuts Down ( 2021 - Feb -12 )  
_“Swift for TensorFlow **was an experiment** in the next-generation platform for machine learning, incorporating the latest research across machine learning, compilers, differentiable programming, systems design, and beyond. **It was archived in February 2021**.”_

[https://github.com/tensorflow/swift](https://github.com/tensorflow/swift)

---

<div class="post-metadata">

### Author: ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)
#### Post date: [February 12, 2021, 8:44pm UTC](https://discourse.julialang.org/t/swift-for-tensorflow-rationale/10563/23 "2021-02-12T20:44:36Z")

</div>

I do hope this didn’t come as a surprise to anyone…

---

<div class="post-metadata">

### Author: ![DoktorMike](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/doktormike/32/2736_2.png) [@DoktorMike](https://discourse.julialang.org/u/DoktorMike)
#### Post date: [February 13, 2021, 8:15am UTC](https://discourse.julialang.org/t/swift-for-tensorflow-rationale/10563/24 "2021-02-13T08:15:34Z")

</div>

Looking at the repo it does surprise me. A lot of contributors, well written tutorials, significant code base, and a lot of stars. Admittedly I know nothing about Swift and very little of tensorflow so maybe there’s something I’m missing. In any case making ML a first class citizen in any language would be an awesome development independently of the language IMHO so that’s why I don’t see the rationale of stopping the development?

Edit: just saw this [Welp! Swift for TensorFlow Archived - #8 by ToucheSir](https://discourse.julialang.org/t/welp-swift-for-tensorflow-archived/55182/8)

---

<div class="post-metadata">

### Author: ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)
#### Post date: [February 13, 2021, 4:45pm UTC](https://discourse.julialang.org/t/swift-for-tensorflow-rationale/10563/25 "2021-02-13T16:45:28Z")

</div>

Oh I wasn’t trying to say anything bad about the project, it indeed is an impressive piece of work. I was just referring to Google’s consistent lack of follow-through on things like this.

Just last year when Chris Lattner left they assured everyone that the project was in good hands and strong roadmaps and all that. Then, just over a year later, it’s cancelled.

In some ways it’s worse that the project had such strong documentation and tutorials, significant codebase and stars. If it didn’t have those things, probably much fewer people would have the rug pulled out from under them when it suddenly gets canned.

---

<div class="post-metadata">

### Author: ![DoktorMike](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/doktormike/32/2736_2.png) [@DoktorMike](https://discourse.julialang.org/u/DoktorMike)
#### Post date: [February 13, 2021, 8:35pm UTC](https://discourse.julialang.org/t/swift-for-tensorflow-rationale/10563/26 "2021-02-13T20:35:46Z")

</div>

I would definitely agree with that sentiment. I never cared for Google’s way of doing software development or indeed many other aspects of their business methods. It did say in the link though that most of the differential stuff is getting out into Swift. But must be tough for the devs to see their baby go away.

---

<div class="post-metadata">

### Author: ![bpr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bpr/32/2710_2.png) [@bpr](https://discourse.julialang.org/u/bpr)
#### Post date: [February 13, 2021, 9:16pm UTC](https://discourse.julialang.org/t/swift-for-tensorflow-rationale/10563/27 "2021-02-13T21:16:00Z")

</div>

The tragedy to me is that had Julia been chosen as the language for this, rather than Swift, the work done would probably live on even if/when Google pulled the plug. Swift is a nice language, but ML and autodiff and the like is not what the existing Swift community is about. This was a great opportunity lost for Google, but, as said above, no surprise.

---

<div class="post-metadata">

### Author: ![apo383](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/apo383/32/11272_2.png) [@apo383](https://discourse.julialang.org/u/apo383)
#### Post date: [February 13, 2021, 10:05pm UTC](https://discourse.julialang.org/t/swift-for-tensorflow-rationale/10563/29 "2021-02-13T22:05:31Z")

</div>

I don’t look at it as too bad Google dropped another project, but rather that the project has received the ultimate vindication. The AD capability has been upstreamed to Swift proper, as requested by core Swift team, and carried out by the key S4TF people. Google may no longer be supporting it officially, but some of their devs are still participating as part of the upstreaming team. Had Chris Lattner stayed at Google Brain, we could envisioned the same thing happening, just maybe sooner. But it’s exciting that Swift is now differentiable at ground level. This also vindicate Julia’s approach, which has shared similar philosophies.

Some nice Swift syntax:

```swift
func f(_ x: Float) -> Float {
    x * x
}
let dfdx = gradient(of: f)
dfdx(3) // 6

```

---

<div class="post-metadata">

### Author: ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)
#### Post date: [February 13, 2021, 10:51pm UTC](https://discourse.julialang.org/t/swift-for-tensorflow-rationale/10563/30 "2021-02-13T22:51:36Z")

</div>

Are there any sizeable projects in Swift right now that use this AD capability?

---

<div class="post-metadata">

### Author: ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)
#### Post date: [February 14, 2021, 12:39am UTC](https://discourse.julialang.org/t/swift-for-tensorflow-rationale/10563/31 "2021-02-14T00:39:23Z")

</div>

Richard Wei of Apple’s CoreML team says work continues on the AD front, so I assume this means that Apple will be taking advantage of this for their own purposes.

> **[Differentiable programming for gradient-based machine learning](https://forums.swift.org/t/differentiable-programming-for-gradient-based-machine-learning/42147/101)**
>
> The work definitely continues! We are currently working on differentiable programming's ABI stability and module stability, and fixing various bugs. We'd welcome contributors too — here's some project ideas about differentiable programming for...

That probably means its safe from bitrot.

---

<div class="post-metadata">

### Author: ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)
#### Post date: [February 14, 2021, 2:20am UTC](https://discourse.julialang.org/t/swift-for-tensorflow-rationale/10563/32 "2021-02-14T02:20:12Z")

</div>

not sure what’s especially “nice” about this when this is the same for other languages:

```julia
julia> f(x::Number) = x*x

julia> dfdx(x) = gradient(f,x)[1]
dfdx (generic function with 1 method)

julia> dfdx(3)
6

julia> dfdx(3.0)
6.0

```

```julia
In [1]: from jax import grad

In [2]: f = lambda x: x*x

In [3]: dfdx = grad(f)

In [4]: dfdx(3.0)
Out[4]: DeviceArray(6., dtype=float32)

```

---

<div class="post-metadata">

### Author: ![apo383](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/apo383/32/11272_2.png) [@apo383](https://discourse.julialang.org/u/apo383)
#### Post date: [February 14, 2021, 5:20am UTC](https://discourse.julialang.org/t/swift-for-tensorflow-rationale/10563/33 "2021-02-14T05:20:18Z")

</div>

I didn’t mean nicer, just nice, and specifically similarly as nice as Flux.

I also don’t mean to promote Swift, which I know little about, so much as to put context on S4TF being archived. I also know little about Jax, but I do have some questions. Just how much of numpy and python have they recreated, enough that people don’t run into the limitations inherent to cython/pypy/numba? Can they autodiff through ODE integrators (I believe they can do reverse adjoints)? And even though they say it is composable, how far does that go, can you autodiff with a new custom type, or is it limited to Float32/64? Is Jax as promising as Julia?

As for Swift, I’m not sure what the limitations are, but it seems sensible to have AD built into a high level language. I suspect Swift is currently the most direct path to go from prototyping an algorithm that uses differential programming, to distributing on consumer phones.

[Previous page](https://discourse.julialang.org/t/swift-for-tensorflow-rationale/10563.md?page=1)
