<p><a href="https://github.com/google/flax" rel="nofollow noreferrer">Flax</a> is a high-level library built on top of <a href="https://github.com/google/jax" rel="nofollow noreferrer">Jax</a>, which is a recent numerical framework that allows the building of differentiable models. Compared to PyTorch, Jax (and so Flax) follows the principles of <em>functional programming</em>: immutable objects, functions are first-class, and stateless computation, to name a few. Pytorch, instead, follows an object-oriented programming paradigm where you represent your models as objects rather than the application of a function.</p>
<p>Basically, Jax and Pytorch implement the same thing with two different philosophies. Moreover, Jax is gathering attention thanks to its improved reproducibility since it is designed around stateless functions.</p>

CC BY-SA 4.0
2024-02-03T16:22:58.333Z
Hi got a doubt ..Is FLAX is optimised better than Pytorch or not? I am trying to convert a FLAX model to pytorch which has used nearly more than 10 Multi Layer Preceptrons for training the model.
akhil
CC BY-SA 4.0
2024-02-03T17:37:41.397Z
@sripathiakhil I haven't done any benchmark, but I'll expect similar performance.
Luca Anzalone
CC BY-SA 4.0
2024-01-20T15:29:37.727Z
2024-05-27T12:43:17.720Z
2024-05-27T12:43:17.720Z
Luca Anzalone
<p>I am going through a code written in FLAX instead of pytorch .Can someone please explain what is the difference between these two deep learning frameworks?</p>

<neural-networks><deep-learning><pytorch>
Difference between FLAX and pytorch
akhil
# Difference between FLAX and pytorch

(Asked by: username_0 on 2024-01-20)

I am going through a code written in FLAX instead of pytorch .Can someone please explain what is the difference between these two deep learning frameworks?

**Tags:** neural-networks, deep-learning, pytorch


---

## 1 answers

### Answer by username_1 on 2024-01-20. Score: 1 | Accepted answer

[Flax](https://github.com/google/flax) is a high-level library built on top of [Jax](https://github.com/google/jax), which is a recent numerical framework that allows the building of differentiable models. Compared to PyTorch, Jax (and so Flax) follows the principles of *functional programming*: immutable objects, functions are first-class, and stateless computation, to name a few. Pytorch, instead, follows an object-oriented programming paradigm where you represent your models as objects rather than the application of a function.

Basically, Jax and Pytorch implement the same thing with two different philosophies. Moreover, Jax is gathering attention thanks to its improved reproducibility since it is designed around stateless functions.

> **Comments:**
> **username_0**: Hi got a doubt ..Is FLAX is optimised better than Pytorch or not? I am trying to convert a FLAX model to pytorch which has used nearly more than 10 Multi Layer Preceptrons for training the model.  
> **username_1**: @sripathiusername_0 I haven't done any benchmark, but I'll expect similar performance.  

---

