You are on page 1of 10

01

TENSORFLOW
VS

PYTORCH
learn.machinelearning
02 learn.machinelearning

What is TensorFlow
Google's TensorFlow is a famous open-
source deep-learning library for dataflow and
differentiable programming across a range of
tasks.

It is also a symbolic math library and machine


learning applications such as neural networks
also use this library. Research and production
are the primary uses of the library.

Features of TensorFlow (Secure Model


Building, ML Production Anywhere and
Robust Experimentation for Research)
03 learn.machinelearning

What is PyTorch
Based on the Torch library, PyTorch is an
open-source machine learning library.

PyTorch is imperative, which means


computations run immediately, which means
the user need not wait to write the full code
before checking if it works or not.

We can efficiently run a part of the code and


inspect it in real-time. The library is a python
based built for providing flexibility as a deep
learning development platform.
04 learn.machinelearning

Computational graph construction


Tensorflow works on a static graph concept
that means the user first has to define the
computation graph of the model and then
run the ML model.

PyTorch believes in a dynamic graph that


allows defining/manipulating the graph on
the go.
05 learn.machinelearning

Serialization
PyTorch serves a simple API that saves all
the weights of the model or pickles the entire
class.

TensorFlow also offers a significant


advantage in that the entire graph can be
saved as a protocol buffer, including
parameters and operations as well.

Also, other supported languages such as C++


and Java can load the graph.
06 learn.machinelearning

Deployment/ Production
Deployment is something where Tensorflow had
a lot of advantage over PyTorch due to better
performance due to its Static Computation graph
approach and packages/tools that facilitated
quick deployment over cloud browser or mobile.

PyTorch has tried to bridge this gap in version


1.5+ with TorchServe, but it's yet to mature.
07 learn.machinelearning

Visualization
TensorBoard visualizes machine learning
models in TensorFlow, which helps during the
training of the model and spot the errors
quickly.

PyTorch, on the other hand, doesn't come


with a native visualization feature. Instead, it
uses regular Python packages like matplotlib
or seaborn for plotting the behaviour of
certain functions.
08 learn.machinelearning

Integration
TensorFlow Serving makes it easy to offer
and update your trained models on the server
side. TensorFlow Lite, on the other hand,
allows you to compress your trained model so
that it can be used on mobile devices.

Until recently, PyTorch did not have a


comparable feature. However, in March 2020
Facebook announced the release of
TorchServe, a PyTorch model serving library.
09 learn.machinelearning

Which one to choose?


TensorFlow is a powerful and deep learning
tool with active visualization and debugging
capabilities.

TensorFlow also offers serialization benefits.


It also has support for mobile platforms and
offers production-ready deployment.

PyTorch, on the flip side, is still gaining


momentum and attracting Python developers
as it's more Python friendly.

In summary, TensorFlow is used to make


things faster and build Al-related products,
while research-oriented developers prefer
PyTorch.
Turn on post notifications

Which is your favourite,


TensorFlow or PyTorch?

Like Save

You might also like