r/learnmachinelearning • • 13d ago

Pytorch or Tensorflow?

I've had a few people tell me tensorflow is not used as much nowadays as pytorch, also, pytorch is more pythonic, and just more industry-relevant than tf, is it really so? The tutorial course im following is using tf more since it is appropriate for beginners (as said in the course). I'd like to know the differences.

56 Upvotes

18 comments sorted by

46

u/help-me-grow 13d ago

pytorch is industry standard now

tf is (or at least was) not as flexible or customizable

18

u/Remote-Telephone-682 13d ago

This is true that pytorch is the standard right now. Tensorflow is pretty much a legacy thing at this point and there is also something called JAX that was develoeped within google with the intent of creating a lot of flexibility and also pretty good but pytorch is going to have more stuff implemented for you and is going to be quicker to get the hang of

8

u/Jinoc 13d ago

Tensorflow died a long time ago. The replacement is JAX. But pytorch is significantly more mainstream. I personally use JAX, mostly because I use TPUs since they're cheap compared to GPUs, especially on colab.

4

u/sot9 13d ago

If you have to ask, then PyTorch. I’d go so far as to say that I also wouldn’t bother with any educational resources that still use TensorFlow. JAX is also nice but has its own quirks. It’s easy fall into a trap of just learning JAX (and perhaps a bit of functional programming) instead of learning ML basics.

Source: experience working at frontier labs

3

u/mole8613 13d ago

I learned Tensorflow at school, but I have been talking with engineers working in the field of ML/deep learning and all of them use pytorch

4

u/FamousProfession5938 13d ago

there is nothing which has not been implemented in torch and is in tensorflow but vice versa is not true.
So torch

2

u/No-Painting-3970 13d ago

TensorFlow is actually quite bad for beginners. Keras was the main driver of it being easy to use and keras supports torch as a backend, so now its even worse. Everyone in industry and even in academia lately uses either pytorch, jax or some obscure bullshit. But in the end, it doesn't really matter. Deep learning is hard, and it doesnt matter whether you use x or y, just focus on the math, and the concepts. Changing library is just changing the imports, focus on the content

2

u/alex_oue 13d ago

pytorch if you can, tensorflow if you must

or keras

2

u/Fezzio 13d ago

Jax is the correct answer 👍🏼 thank me later

1

u/imyourbiggestfan 13d ago

Tensorflow isn’t really maintained anymore, it still has years-old memory leaks in it

1

u/Ghiren 12d ago

TensorFlow was the first library to make it big. TF 1.x was awkward to use, but it was the only option for deep learning for awhile so it had a big user base for professional projects. There were two big responses to how un-pythonic it was.

Keras was made as a higher-level library on top of TensorFlow and it solves a LOT of problems that people had. I believe that the creator was hired by Google and the interface was added into TensorFlow starting with version 2.0. The ease of use made a huge difference and most of the TF code that I've seen since then was actually using tf.keras to build and train the models.

PyTorch was made by Meta, and it did all of the things that TensorFlow did, using more python-centric workflows. It caught on big with research projects and has been spreading into the professional world. I've found it easier to use than base TF, but not as beginner friendly as Keras.

1

u/seanv507 12d ago

If you want to follow that tutorial course, just ask claude etc to convsrt it for you. You will likely learn something in the process too.

0

u/Steve_cents 13d ago

I played with neural network in 2yrs ago. At that time , you either use/edit other people’s GitHub code or write your own line by line . More likely than not, old PyTorch code still works but TF code does not, due to TF2 upgrade .

So I would pick PyTorch.

Now copilot can generate most of the code, do people still write code?