Hacker News new | ask | show | jobs
by melling 2526 days ago
Does Swift have an equivalent to Python‘s numpy?

It seems to lack a nice way of doing vector and matrix operations.

1 comments

They built in Python interop so that you can use numpy in TFSwift
Bridges always have trolls under them.

If you don't see the troll, that doesn't mean it isn't there, it's just waiting for you to cross.

Doesn’t that introduce serious overhead compared to first class native arrays as in Julia or FORTRAN?
My impression is that this is to bootstrap adoption, there is a Swift-native TensorFlow package being developed also.
Bridging into NumPy isn’t going to be useful unless it covers some AD system too (XLA?).
XLA is a compiler for array code. It doesn't come with AD -- you need a wrapper like TF or JAX (or Swift, I guess) for that.
I was imagining the FFI emitting XLA code needed to implement the TF/JAX routines behind the scenes, but it's wild speculation.
Correct: you can call Python from Swift OR you can use AD but not both at the same time.