, 11 tweets, 2 min read Read on Twitter
I have been playing around with porting some of my TensorFlow code to PyTorch. Here are my initial thoughts 👇
Important caveat: This is from a research perspective, i.e. implementing non-standard models and low level layers. If all you need is a library to run a relatively standard architectures on some new dataset, the choice of framework is probably irrelevant. Either will do fine.
Compared to TF, PyTorch is extremely clean, unified, and well-documented. No duplicate functions with slightly different semantics. No deprecation warnings all over the code. A single way to do things instead of 10 different competing approaches. It feels great. Productive.
Performance-wise I found little to no difference between PyTorch and TF implementations. PyTorch was a bit faster in my tests, but proper benchmarking is not trivial (burnin times, caching, etc), so I don't want to draw any conclusions here.
PyTorch code turned out to be more concise and readable. PyTorch implementations were on average much shorter, and look more intuitive to someone not familiar with graph-based programming.
However, there are a few areas where I think PyTorch is still lacking.
Visualization. There are a few open source projects to visualize graphs, but none worked great. I'd really like a way to visualize a graph at multiple customized "levels" (ops, modules, module groups, etc). In TF this was easily possible with name scopes + Tensorboard.
I actually think this would not be too difficult to build. Allow users to "tag" modules or ops with scopes and then create a nice d3js graph (similar to github.com/sethjuarez/Dee…).
JIT compilation (needed for porting models to other languages). Some ops are not supported, tracing only works for a smallish subset of simple deterministic models, and TorchScript can be painful to write (looking more like TF). I haven't been able to JIT compile all my models.
I am missing good autocomplete and typing (mypy/pylint) support. Not sure if this is just my setup? However, this means I cannot rely on my IDE and need to context switch to the documentation pages instead.
If you haven't had a chance yet, give it a try. Personally it's very likely that I will be switching to PyTorch for all future projects.
Missing some Tweet in this thread?
You can try to force a refresh.

Like this thread? Get email updates or save it to PDF!

Subscribe to Denny Britz
Profile picture

Get real-time email alerts when new unrolls are available from this author!

This content may be removed anytime!

Twitter may remove this content at anytime, convert it as a PDF, save and print for later use!

Try unrolling a thread yourself!

how to unroll video

1) Follow Thread Reader App on Twitter so you can easily mention us!

2) Go to a Twitter thread (series of Tweets by the same owner) and mention us with a keyword "unroll" @threadreaderapp unroll

You can practice here first or read more on our help page!

Follow Us on Twitter!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just three indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3.00/month or $30.00/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!