Official C++ front-end, libtorch; fewer language bindings.
Governance
Google-led + TensorFlow SIGs; Apache 2.0.
Linux Foundation (PyTorch Foundation) since 2022; Meta started but more neutral now.
License
Apache 2.0
BSD-style
First release
Nov 2015
Jan 2017
Typical users (today)
Large-scale production at Google, enterprises with TF pipelines, mobile-first apps.
Academic research, startups, NLP/CV open-source models, many production systems too.
Why PyTorch Won Researchers’ Hearts (and Then Everyone Else’s)
True dynamic graphs from day 1
• You write Python control flow (if, for, recursion) and it just works.
• Great for complex research ideas (reinforcement learning, variable length RNNs, meta-learning).
Lower friction / “Pythonic” ergonomics
• No sessions, placeholders, collections.
• Tightly integrates with NumPy, IPython/Jupyter, standard debuggers.
Debuggability = faster iteration
Bugs surfaced immediately during the forward pass—no need to re-run a graph build step.
Community snowball effect
• Early adopter researchers shared PyTorch code; reviewers & students learned it; new papers kept supplying PyTorch reference impls.
• Libraries like HuggingFace Transformers (2018) chose PyTorch first; this massively amplified adoption.
Open governance perception
While both are open-source, TF felt “Google-driven”; PyTorch (now under LF) seemed less corporate-controlled and accepted external PRs faster.
Ecosystem of “glue” libraries
Lightning, Accelerate, FastAI, Detectron2 abstract boilerplate without hiding PyTorch, reinforcing its popularity.
Educational simplicity
Universities switched teaching materials; students graduate already fluent in PyTorch → hiring loop.
TF’s initial complexity cost
TF 1.x’s steep learning curve + multiple competing APIs damaged sentiment. TF 2.x fixed many issues but PyTorch momentum was already strong.
Performance gap closed
Early on TF had better graph-level optimizations. With TorchScript, torch.compile, Triton kernels, and AOT Autograd, PyTorch now meets or exceeds TF speeds on GPUs.
Neutral format for deployment
ONNX lets PyTorch models export to many runtimes; production folks aren’t locked in.
Code Snapshot: Feel the Difference 💡
TensorFlow 2.x
python
import tensorflow as tf
@tf.function # optional but needed for speed
def train_step(x, y, model, opt):
with tf.GradientTape() as tape:
preds = model(x, training=True)
loss = tf.keras.losses.MSE(y, preds)
grads = tape.gradient(loss, model.trainable_variables)
opt.apply_gradients(zip(grads, model.trainable_variables))
return loss
PyTorch
python
import torch
def train_step(x, y, model, opt):
preds = model(x)
loss = torch.nn.functional.mse_loss(preds, y)
loss.backward()
opt.step()
opt.zero_grad()
return loss
Both are fine, but many learners find the PyTorch version closer to ordinary Python.
Should You Pick One Over the Other in 2024?
Choose TensorFlow/Keras if you…
• Need mature mobile/edge support (TF Lite) or TPU acceleration.
• Already run TFX pipelines/TF Serving in production.
• Work in an org standardized on Google Cloud AI offerings.
Choose PyTorch if you…
• Iterate on research ideas, rapidly prototype, or use cutting-edge NLP/CV models.
• Want to leverage the largest community examples and tutorials.
• Value simpler debugging and a one-language (Python) mental model.
Spoiler: Many companies run both. Interop via ONNX makes migration less painful.
TL;DR
TensorFlow pioneered large-scale DL tooling, but its early static-graph UX opened a lane for PyTorch’s cleaner, dynamic-graph approach. Researchers flocked to PyTorch, forming a virtuous cycle of community, libraries, and tutorials that eventually spilled into industry. TensorFlow is still strong—especially for production at scale—but in terms of mind-share (GitHub stars, arXiv papers, Kaggle kernels, Twitter chatter), PyTorch is now the default.