Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Choosing Between PyTorch and TensorFlow

00:00 You explore TensorFlow and PyTorch. Now it’s time to decide which one is the best fit for your project.

00:07 Looking at it from a code style perspective, if you’re comfortable with Python, go with PyTorch. As you saw in the previous lesson, PyTorch is pretty Pythonic, but if compatibility with different coding languages like JavaScript or Dart is a priority for you, go with TensorFlow.

00:25 Of course, PyTorch supports other coding languages too, but TensorFlow is definitely preferred in the community.

00:35 Probably one of the most important aspects to consider is taking your dataset into account. If you have audio data, PyTorch offers TorchAudio, which is preferred by the community.

00:47 If you have image or text data, you should check the compatibility of your dataset or your pre-trained model with either of the two. For example, for image data, PyTorch offers TorchVision and TensorFlow offers Keras and TensorFlow Hub.

01:03 They both offer built-in datasets and pre-trained models. And for text data, PyTorch offers TorchText and TensorFlow offers TensorFlow Text and TensorFlow Hub.

01:15 They’re both amazing ecosystems and are used by the community.

01:21 The last thing to consider is your project goal. Are you looking to integrate your model within a web app? Thanks to TensorFlow.js, TensorFlow is usually preferred.

01:33 The same goes for IoT devices and mobile apps. TensorFlow offers TensorFlow Lite, which is a lighter and more optimized version of TensorFlow, and in case you’re creating a model for research purposes, PyTorch takes a win.

01:49 There you go. Now you have a general understanding of PyTorch and TensorFlow’s differences. Time to choose which one fits your model the best.

Become a Member to join the conversation.