Hacker News new | ask | show | jobs
by codesushi42 2550 days ago
Thanks. What is the advantage of using Swift over implementing a custom TF op in C++, and using its generated Python wrapper in Jupyter? Just not having to deal with C++?
1 comments

Not needing to know both Python and C++.

If you need to debug something, you don't need to use some mixture of pdb and gdb.

Swift is a relatively young language, meaning it does not (yet) have weird hairy bits to work around design decisions made 20 years ago.

Similarly, Swift is still getting defined in many areas. There is (theoretically) the opportunity to influence language design decisions to patterns that mesh better with ML needs.

This is largely my paraphrasing of the reasons stated by Jeremy https://www.fast.ai/2019/03/06/fastai-swift/

Yes, but at the cost of portability. You won't be able to run the same model on Android for instance.

You're still debugging in two places; in Swift and Python. Debugging Swift is probably easier than C++ though.

I think using Swift is a valid solution for special cases, but not the best solution for most cases. The TF authors already provide a suitable, general solution in the form of custom TF ops.

And if you don't need a custom kernel, and the chances are you don't, then stick with pure Python for maximum ease of use and portability.