PyTorch 2.0 vs. TensorFlow 2.10, which one is better?

Dr. Roi Yehoshua
The Deep Learning Hub
9 min readMar 19, 2023

--

PyTorch and TensorFlow are the most popular libraries for deep learning. PyTorch v2.0 was released a few days ago, so I wanted to test it against TensorFlow v2.10 that was released on September 2022. The latest TensorFlow version (v2.11) is currently not supported on the GPU on Windows, so I couldn’t test it on my machine.

In this article I’m going to train a convolutional neural network (CNN) with exactly the same architecture and same hyperparameters on the CIFAR-10 data set using both libraries, and then compare both their performance and their training time. Clearly, this does not pretend to be an exhaustive experiment, but it should give you a glimpse of the main differences between these two libraries.

For this experiment, I’m using a Dell XPS 15 laptop with Intel(R) i7–9750hm, 16GB RAM, and GPU card of NVIDIA GeForce GTX 1650.

PyTorch 2.0 Installation

The best way to install PyTorch is to visit its official website and select the environment for which you want to have it installed. If you have a GPU, you need to make sure you have the correct CUDA version installed. For PyTorch 2.0, you need at least CUDA version 11 (the website specifies either CUDA 11.7 or CUDA 11.8, but I was able to run PyTorch 2.0 with my already installed CUDA 11.3).

--

--

Dr. Roi Yehoshua
The Deep Learning Hub

Teaching Professor for Data Science and ML at Northeastern University | Top Writer in AI | 200K+ Views on Medium | https://www.linkedin.com/in/roi-yehoshua/