# Python deep learning libraries

Python deep learning libraries define neural networks, compute their gradients, and train them on GPUs and other accelerators. These libraries train and run the models behind language, vision, and speech features in apps.

## Popularity

| Library | Monthly downloads | Stars | Last release | License |
| --- | --- | --- | --- | --- |
| [Transformers](#transformers) | 119.8M | 169.2K | Nov 2026 | Apache 2.0 License |
| [PyTorch](#pytorch) | 59.7M | 105.7K | Oct 2026 | Apache-2.0 AND Apache-2.0 WITH LLVM-exception AND BSD-2-Clause AND BSD-3-Clause AND BSL-1.0 AND ISC AND MIT AND Zlib |
| [JAX](#jax) | 12.6M | 36.6K | Nov 2026 | Apache-2.0 |
| [TensorFlow](#tensorflow) | 12.4M | 201.6K | Mar 2026 | Apache-2.0 |
| [Keras](#keras) | 12.0M | 64.4K | Jul 2026 | Apache-2.0 |
| [PyTorch Lightning](#pytorch-lightning) | 11.6M | 31.4K | Sep 2026 | Apache-2.0 |
| [Flax](#flax) | 2.7M | 7.4K | Oct 2026 | Apache-2.0 |
| [Equinox](#equinox) | 1.7M | 3.0K | May 2026 | Apache-2.0 |

Downloads: PyPI, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

[PyTorch](#pytorch) has the most monthly downloads in this comparison, at 59.4M.

## Capabilities

| Library | Layer and module classes | Automatic training loop |
| --- | --- | --- |
| [Transformers](#transformers) | Yes | Yes |
| [PyTorch](#pytorch) | Yes | No |
| [JAX](#jax) | No | No |
| [TensorFlow](#tensorflow) | Yes | Yes |
| [Keras](#keras) | Yes | Yes |
| [PyTorch Lightning](#pytorch-lightning) | Yes | Yes |
| [Flax](#flax) | Yes | No |
| [Equinox](#equinox) | Yes | No |

## Libraries

### Transformers

[GitHub](https://github.com/huggingface/transformers) · [PyPI](https://pypi.org/project/transformers) · [Docs](https://pypi.org/project/transformers/)

Transformers defines model architectures for text, vision, audio, video, and multimodal tasks, and loads pretrained weights for them from the Hugging Face Hub. `pipeline` wraps a model and its preprocessing into one call for a task such as text classification or zero-shot classification. Training frameworks and inference engines such as vLLM reuse the same model definitions. The library runs on PyTorch.

- Downloads / mo: 119.8M
- Stars: 169.2K
- Last release: 5.23.0
- License: Apache 2.0 License
- Capabilities: [From the Transformers docs](https://pypi.org/project/transformers/)

**Strengths**

- **Models by name.** A task and a model name from the Hub are enough for `pipeline` to download and run a model.

**Watch out for**

- **Weights download on first use.** Each model fetches its weights the first time it loads, and large models need a GPU with enough memory to hold them.

```sh
pip install transformers torch
```

**deepset-ai/haystack** (27.0K stars)

[deepset-ai/haystack](https://github.com/deepset-ai/haystack) 

```python
def run(self, text: str) -> dict[str, str]:
    """
    Routes the text strings to different connections based on a category label.

    :param text: A string of text to route.
    :returns:
        A dictionary with the label as key and the text as value.

    :raises TypeError:
        If the input is not a str.
    :raises RuntimeError:
        If the pipeline has not been loaded because warm_up() was not called before.
    """
    if self.pipeline is None:
        raise RuntimeError(
            "The component TransformersZeroShotTextRouter wasn't warmed up. Run 'warm_up()' before calling 'run()'."
        )

    if not isinstance(text, str):
        raise TypeError("TransformersZeroShotTextRouter expects a str as input.")

    prediction = self.pipeline([text], candidate_labels=self.labels, multi_label=self.multi_label)
    predicted_scores = prediction[0]["scores"]
    max_score_index = max(range(len(predicted_scores)), key=predicted_scores.__getitem__)
    label = prediction[0]["labels"][max_score_index]
    return {label: text}
```

[haystack/components/routers/zero_shot_text_router.py](https://github.com/deepset-ai/haystack/blob/dc1d72228adeaac8e657d3a4946c3e246d45784d/haystack/components/routers/zero_shot_text_router.py#L192-L217) · [More projects using Transformers →](https://dashboard.exa.ai/playground/search?q=transformers%20GitHub%20projects)

**Quickstart**

```python
from transformers import pipeline
classifier = pipeline('zero-shot-classification', model='facebook/bart-large-mnli')
result = classifier('A guide to neural network training', candidate_labels=['machine learning', 'cooking'])
print(result['labels'][0])

```

From [pipelines.md](https://huggingface.co/docs/transformers/main_classes/pipelines#transformers.ZeroShotClassificationPipeline)

### PyTorch

[GitHub](https://github.com/pytorch/pytorch) · [PyPI](https://pypi.org/project/torch) · [Docs](https://pytorch.org/docs)

PyTorch provides tensors, arrays that compute on GPUs as well as CPUs, and neural networks built on a tape-based autograd system. The tape records operations as Python code runs, so a model's structure can change from one input to the next, and `backward()` computes the gradients. `torch.nn` supplies layers and losses, and `DistributedDataParallel` synchronizes gradients across training processes. Extensions can reuse NumPy, SciPy, and Cython code.

- Downloads / mo: 59.7M
- Stars: 105.7K
- Last release: 2.15.0
- License: Apache-2.0 AND Apache-2.0 WITH LLVM-exception AND BSD-2-Clause AND BSD-3-Clause AND BSL-1.0 AND ISC AND MIT AND Zlib
- Capabilities: [From the PyTorch docs](https://pytorch.org/docs)

**Strengths**

- **Builds dynamic autograd networks.** Build neural networks on a tape-based automatic differentiation system.
- **Synchronizes distributed training gradients.** Use DistributedDataParallel to synchronize gradients across training processes.

**Watch out for**

- **Saved weights need the model class.** A state dictionary holds weights only, so loading one requires the model class defined in code first.

```sh
pip install torch
```

**lucidrains/denoising-diffusion-pytorch** (10.7K stars)

[lucidrains/denoising-diffusion-pytorch](https://github.com/lucidrains/denoising-diffusion-pytorch) 

```python
def cosine_beta_schedule(timesteps, s = 0.008):
    """
    cosine schedule
    as proposed in https://openreview.net/forum?id=-NEXDKk8gZ
    """
    steps = timesteps + 1
    t = torch.linspace(0, timesteps, steps, dtype = torch.float64) / timesteps
    alphas_cumprod = torch.cos((t + s) / (1 + s) * math.pi * 0.5) ** 2
    alphas_cumprod = alphas_cumprod / alphas_cumprod[0]
    betas = 1 - (alphas_cumprod[1:] / alphas_cumprod[:-1])
    return torch.clip(betas, 0, 0.999)
```

[denoising_diffusion_pytorch/denoising_diffusion_pytorch.py](https://github.com/lucidrains/denoising-diffusion-pytorch/blob/c8155b1dc622e3f1ef0d53dc6e5a570ca105bcec/denoising_diffusion_pytorch/denoising_diffusion_pytorch.py#L451-L461) · [More projects using PyTorch →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20torch%20for%20diffusion%20sampling%2C%20contrastive-learning%20augmentation%20and%20differentiable%20neural-network%20losses&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
import torch
x = torch.tensor(3.0, requires_grad=True)
(x * x).backward()
print(x.grad)

```

From [autograd.html](https://docs.pytorch.org/docs/2.15/autograd.html)

### JAX

[GitHub](https://github.com/jax-ml/jax) · [PyPI](https://pypi.org/project/jax) · [Docs](https://pypi.org/project/jax/)

JAX is a library for array computation and program transformation, with an API modeled on NumPy. `jax.grad` differentiates a Python function, including its loops, branches, and recursion, and `jax.jit` compiles it with XLA for GPUs and TPUs. The transformations compose, so a compiled function can also be differentiated. Neural network layers come from libraries built on JAX, such as Flax and Equinox.

- Downloads / mo: 12.6M
- Stars: 36.6K
- Last release: 0.12.1
- License: Apache-2.0
- Capabilities: [From the JAX docs](https://pypi.org/project/jax/)

**Strengths**

- **Composes gradients with compilation.** Compile and differentiate pure Python numerical functions.
- **Partitions array computations across devices.** Shard arrays and partition computations across multiple devices.

**Watch out for**

- **Pure functions only.** Transformed functions keep no hidden state, so state passes in as arguments and comes back as return values.
- **Research project.** Google describes JAX as a research project rather than an official product, and its docs list sharp edges.

```sh
pip install jax
```

**google-deepmind/dm-haiku** (3.3K stars)

[google-deepmind/dm-haiku](https://github.com/google-deepmind/dm-haiku) 

```python
def loss(params: hk.Params, batch: Batch) -> jax.Array:
  """Cross-entropy classification loss, regularised by L2 weight decay."""
  batch_size, *_ = batch.image.shape
  logits = network.apply(params, batch.image)
  labels = jax.nn.one_hot(batch.label, NUM_CLASSES)

  l2_regulariser = 0.5 * sum(
      jnp.sum(jnp.square(p)) for p in jax.tree.leaves(params)
  )
  log_likelihood = jnp.sum(labels * jax.nn.log_softmax(logits))

  return -log_likelihood / batch_size + 1e-4 * l2_regulariser
```

[examples/mnist.py](https://github.com/google-deepmind/dm-haiku/blob/4ec60bb58723d5db5aa11c12b3fc6374b5b01726/examples/mnist.py#L76-L87) · [More projects using JAX →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20jax%20for%20diffusion%20sampling%2C%20contrastive-learning%20augmentation%20and%20differentiable%20neural-network%20losses&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
import jax
print(jax.grad(lambda x: x * x)(3.0))

```

From [README.md](https://github.com/jax-ml/jax)

### TensorFlow

[GitHub](https://github.com/tensorflow/tensorflow) · [PyPI](https://pypi.org/project/tensorflow) · [Docs](https://pypi.org/project/tensorflow/)

TensorFlow is an open source platform for machine learning, first developed at Google Brain. Tensors and variables compute on CPUs, GPUs, and TPUs, and `tf.GradientTape` records the operations inside its block to compute gradients. Distribution strategies spread existing training code across GPUs, machines, or TPUs. Stable APIs cover Python and C++.

- Downloads / mo: 12.4M
- Stars: 201.6K
- Last release: 2.21.0
- License: Apache-2.0
- Capabilities: [From the TensorFlow docs](https://pypi.org/project/tensorflow/)

**Strengths**

- **Trains with automatic gradients.** Use GradientTape to compute derivatives for training.
- **Distributes existing training code.** Use distribution strategies across GPUs, machines, or TPUs.

**Watch out for**

- **Windows GPU training needs WSL.** GPU builds on Windows run inside WSL, the Windows Subsystem for Linux.

```sh
pip install tensorflow
```

**google-research/simclr** (4.5K stars)

[google-research/simclr](https://github.com/google-research/simclr) 

```python
def gaussian_blur(image, kernel_size, sigma, padding='SAME'):
  """Blurs the given image with separable convolution.


  Args:
    image: Tensor of shape [height, width, channels] and dtype float to blur.
    kernel_size: Integer Tensor for the size of the blur kernel. This is should
      be an odd number. If it is an even number, the actual kernel size will be
      size + 1.
    sigma: Sigma value for gaussian operator.
    padding: Padding to use for the convolution. Typically 'SAME' or 'VALID'.

  Returns:
    A Tensor representing the blurred image.
  """
  radius = tf.cast(kernel_size / 2, dtype=tf.int32)
  kernel_size = radius * 2 + 1
  x = tf.cast(tf.range(-radius, radius + 1), dtype=tf.float32)
  blur_filter = tf.exp(-tf.pow(x, 2.0) /
                       (2.0 * tf.pow(tf.cast(sigma, dtype=tf.float32), 2.0)))
  blur_filter /= tf.reduce_sum(blur_filter)
  # One vertical and one horizontal filter.
  blur_v = tf.reshape(blur_filter, [kernel_size, 1, 1, 1])
  blur_h = tf.reshape(blur_filter, [1, kernel_size, 1, 1])
  num_channels = tf.shape(image)[-1]
  blur_h = tf.tile(blur_h, [1, 1, num_channels, 1])
  blur_v = tf.tile(blur_v, [1, 1, num_channels, 1])
  expand_batch_dim = image.shape.ndims == 3
  if expand_batch_dim:
    # Tensorflow requires batched input to convolutions, which we can fake with
    # an extra dimension.
    image = tf.expand_dims(image, axis=0)
  blurred = tf.nn.depthwise_conv2d(
      image, blur_h, strides=[1, 1, 1, 1], padding=padding)
  blurred = tf.nn.depthwise_conv2d(
      blurred, blur_v, strides=[1, 1, 1, 1], padding=padding)
  if expand_batch_dim:
    blurred = tf.squeeze(blurred, axis=0)
  return blurred
```

[tf2/data_util.py](https://github.com/google-research/simclr/blob/383d4143fd8cf7879ae10f1046a9baeb753ff438/tf2/data_util.py#L323-L361) · [More projects using TensorFlow →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20tensorflow%20for%20diffusion%20sampling%2C%20contrastive-learning%20augmentation%20and%20differentiable%20neural-network%20losses&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
import tensorflow as tf
x = tf.Variable(3.0)
with tf.GradientTape() as tape:
    y = x * x
print(tape.gradient(y, x).numpy())

```

From [tf.GradientTape](https://www.tensorflow.org/api_docs/python/tf/GradientTape)

### Keras

[GitHub](https://github.com/keras-team/keras) · [PyPI](https://pypi.org/project/keras) · [Docs](https://pypi.org/project/keras/)

Keras is a high-level API for building and training deep learning models on JAX, TensorFlow, or PyTorch, with OpenVINO available for inference only. A model is a stack of layers, as in `keras.Sequential`, and the `KERAS_BACKEND` environment variable selects the engine. The `keras` package holds the current version, and the previous version remains available as `tf-keras`.

- Downloads / mo: 12.0M
- Stars: 64.4K
- Last release: 3.15.1
- License: Apache-2.0
- Capabilities: [From the Keras docs](https://pypi.org/project/keras/)

**Strengths**

- **Offers multiple training backends.** Train through JAX, TensorFlow, or PyTorch backends.
- **Provides a high-level modeling API.** Build and train models across vision, language, audio, and forecasting tasks.

**Watch out for**

- **Backend installed separately.** Keras needs TensorFlow, JAX, or PyTorch installed alongside it.
- **OpenVINO runs inference only.** Training needs the JAX, TensorFlow, or PyTorch backend.

```sh
pip install keras torch
```

**keras-team/keras-io** (3.0K stars)

[keras-team/keras-io](https://github.com/keras-team/keras-io) 

```python
def call(self, inputs):
    concat_inputs = []
    for input_ in inputs:
        if input_ in CATEGORICAL_FEATURES_WITH_VOCABULARY:
            max_index = self.embeddings[input_].input_dim - 1  # Clamp the indices
            # torch had some index errors during embedding hence the clip function
            embedded_feature = self.embeddings[input_](
                keras.ops.clip(inputs[input_], 0, max_index)
            )
            concat_inputs.append(embedded_feature)
        else:
            # Project the numeric feature to encoding_size using linear transformation.
            proj_feature = keras.ops.expand_dims(inputs[input_], -1)
            proj_feature = self.proj_layer[input_](proj_feature)
            concat_inputs.append(proj_feature)

    v = layers.concatenate(concat_inputs)
    v = self.grn_concat(v)
    v = keras.ops.expand_dims(self.softmax(v), axis=-1)
    x = []
    for idx, input in enumerate(concat_inputs):
        x.append(self.grns[idx](input))
    x = keras.ops.stack(x, axis=1)
    return keras.ops.squeeze(
        keras.ops.matmul(keras.ops.transpose(v, axes=[0, 2, 1]), x), axis=1
    )
```

[examples/structured_data/classification_with_grn_and_vsn.py](https://github.com/keras-team/keras-io/blob/f5891b3cd4df69f6bd5a3c26ea92310f3a973626/examples/structured_data/classification_with_grn_and_vsn.py#L420-L445) · [More projects using Keras →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20keras%20for%20diffusion%20sampling%2C%20contrastive-learning%20augmentation%20and%20differentiable%20neural-network%20losses&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
import os
os.environ['KERAS_BACKEND'] = 'torch'
import keras
model = keras.Sequential([keras.layers.Dense(1)])
print(model(keras.ops.ones((1, 3))))

```

From [sequential.md](https://keras.io/api/models/sequential/)

### PyTorch Lightning

[GitHub](https://github.com/Lightning-AI/pytorch-lightning) · [PyPI](https://pypi.org/project/pytorch-lightning) · [Docs](https://pytorch-lightning.rtfd.io/en/latest/)

PyTorch Lightning organizes PyTorch code so that the library handles the training loop, backpropagation, mixed precision, and multi-GPU or distributed training. Model code goes in a `LightningModule`, and a `Trainer` runs it on anything from a CPU to several GPU nodes without changes to that code. Lightning Fabric offers the same scaling while the program keeps its own training loop.

- Downloads / mo: 11.6M
- Stars: 31.4K
- Last release: 2.6.6
- License: Apache-2.0
- Capabilities: [From the PyTorch Lightning docs](https://pytorch-lightning.rtfd.io/en/latest/)

**Strengths**

- **Training loop included.** The `Trainer` runs training and prediction, with logging and checkpoints as options.

**Watch out for**

- **Code follows its structure.** Model code moves into `LightningModule` methods instead of a plain PyTorch loop.

```sh
pip install pytorch-lightning torch
```

**CompVis/latent-diffusion** (14.2K stars)

[CompVis/latent-diffusion](https://github.com/CompVis/latent-diffusion) 

```python
@torch.no_grad()
def validation_step(self, batch, batch_idx):
    _, loss_dict_no_ema = self.shared_step(batch)
    with self.ema_scope():
        _, loss_dict_ema = self.shared_step(batch)
        loss_dict_ema = {key + '_ema': loss_dict_ema[key] for key in loss_dict_ema}
    self.log_dict(loss_dict_no_ema, prog_bar=False, logger=True, on_step=False, on_epoch=True)
    self.log_dict(loss_dict_ema, prog_bar=False, logger=True, on_step=False, on_epoch=True)
```

[ldm/models/diffusion/ddpm.py](https://github.com/CompVis/latent-diffusion/blob/a506df5756472e2ebaf9078affdde2c4f1502cd4/ldm/models/diffusion/ddpm.py#L357-L364) · [More projects using PyTorch Lightning →](https://dashboard.exa.ai/playground/search?q=pytorch-lightning%20GitHub%20projects)

**Quickstart**

```python
import torch
import pytorch_lightning as pl
from torch.utils.data import DataLoader

class Model(pl.LightningModule):
    def forward(self, x):
        return x + 1

model = Model()
trainer = pl.Trainer(accelerator='cpu', logger=False, enable_checkpointing=False)
print(trainer.predict(model, dataloaders=DataLoader(torch.zeros(2, 3), batch_size=1)))

```

From [lightning_module.html](https://lightning.ai/docs/pytorch/stable/common/lightning_module.html)

### Flax

[GitHub](https://github.com/google/flax) · [PyPI](https://pypi.org/project/flax) · [Docs](https://pypi.org/project/flax/)

Flax is a neural network library for JAX. Its current API, Flax NNX, defines models as regular Python objects with mutable state and shared references, and layers such as `nnx.Linear` draw their random keys from `nnx.Rngs`. Models built this way pass through JAX transformations for compilation and gradients. The older Linen API keeps its own documentation site.

- Downloads / mo: 2.7M
- Stars: 7.4K
- Last release: 0.12.12
- License: Apache-2.0
- Capabilities: [From the Flax docs](https://pypi.org/project/flax/)

**Strengths**

- **Models as Python objects.** Flax NNX models are regular Python objects that can share references and change in place.
- **Training utilities included.** Checkpointing, serialization, metrics, and on-device prefetching come with the library.

**Watch out for**

- **Two APIs.** Code written for Linen differs from NNX code, and the docs include a guide for moving between them.

```sh
pip install flax
```

**google-research/big_vision** (3.6K stars)

[google-research/big_vision](https://github.com/google-research/big_vision) 

```python
@nn.compact
def __call__(self, x, deterministic=True):
  """Applies Transformer MlpBlock module."""
  inits = dict(
      kernel_init=nn.initializers.xavier_uniform(),
      bias_init=nn.initializers.normal(stddev=1e-6),
  )

  d = x.shape[-1]
  x = nn.Dense(self.mlp_dim or 4 * d, dtype=self.dtype_mm, **inits)(x)
  # In some extreme batch-size cases, this is needed as of Sept 2024:
  x = nn.with_logical_constraint(x, ("act_batch", "act_len", "act_emb"))
  x = nn.gelu(x)
  x = nn.Dropout(rate=self.dropout)(x, deterministic)
  x = nn.Dense(d, dtype=self.dtype_mm, **inits)(x)
  return x
```

[big_vision/models/vit.py](https://github.com/google-research/big_vision/blob/0127fb6b337ee2a27bf4e54dea79cff176527356/big_vision/models/vit.py) · [More projects using Flax →](https://dashboard.exa.ai/playground/search?q=flax%20GitHub%20projects)

**Quickstart**

```python
from flax import nnx
import jax.numpy as jnp
model = nnx.Linear(3, 2, rngs=nnx.Rngs(0))
print(model(jnp.ones((1, 3))))

```

From [nnx_basics.html](https://flax.readthedocs.io/en/latest/nnx_basics.html)

### Equinox

[GitHub](https://github.com/patrick-kidger/equinox) · [PyPI](https://pypi.org/project/equinox) · [Docs](https://pypi.org/project/equinox/)

Equinox is a JAX library for neural networks and for utilities that core JAX lacks, such as filtered transformations, PyTree manipulation, and runtime errors. Models subclass `eqx.Module` with PyTorch-like syntax, and each model is a PyTree, the nested container type JAX transforms, so it passes through `jax.jit` and `jax.grad` directly. Equinox models work with the rest of the JAX ecosystem.

- Downloads / mo: 1.7M
- Stars: 3.0K
- Last release: 0.13.8
- License: Apache-2.0
- Capabilities: [From the Equinox docs](https://pypi.org/project/equinox/)

**Strengths**

- **Models are PyTrees.** Models cross compilation and gradient boundaries like any other JAX data.

**Watch out for**

- **Explicit random keys.** Each layer takes a random key when it is built, passed by the program.

```sh
pip install equinox
```

**danielward27/flowjax** (246 stars)

[danielward27/flowjax](https://github.com/danielward27/flowjax) 

```python
@eqx.filter_jit
def step(
    params: PyTree,
    *args,
    optimizer: optax.GradientTransformation,
    opt_state: PyTree,
    loss_fn: Callable[..., Scalar],
    **kwargs,
):
    """Carry out a training step.

    Args:
        params: Parameters for the model
        *args: Arguments passed to the loss function (often the static components
            of the model).
        optimizer: Optax optimizer.
        opt_state: Optimizer state.
        loss_fn: The loss function. This should take params and static as the first two
            arguments.
        **kwargs: Key word arguments passed to the loss function.

    Returns:
        tuple: (params, opt_state, loss_val)
    """
    loss_val, grads = eqx.filter_value_and_grad(loss_fn)(
        params,
        *args,
        **kwargs,
    )
    updates, opt_state = optimizer.update(grads, opt_state, params=params)
    params = eqx.apply_updates(params, updates)
    return params, opt_state, loss_val
```

[flowjax/train/train_utils.py](https://github.com/danielward27/flowjax/blob/bb8593453924e1688ae2a5395767ba8d71e6d804/flowjax/train/train_utils.py#L14-L45) · [More projects using Equinox →](https://dashboard.exa.ai/playground/search?q=equinox%20GitHub%20projects)

**Quickstart**

```python
import equinox as eqx
import jax
import jax.numpy as jnp
model = eqx.nn.Linear(3, 2, key=jax.random.PRNGKey(0))
print(model(jnp.ones(3)))

```

From [linear.md](https://docs.kidger.site/equinox/api/nn/linear/)

## FAQ

### Which Python deep learning library should I use?

Start from the engine. [PyTorch](#pytorch) records operations on a tape as Python code runs, [JAX](#jax) transforms pure functions with `grad` and `jit`, and [TensorFlow](#tensorflow) records gradients with `GradientTape`. [Keras](#keras) adds a high-level API over any of the three, and [Transformers](#transformers) supplies pretrained models.

### PyTorch vs TensorFlow: which should I use?

Both compute tensors on GPUs and differentiate them automatically. PyTorch records operations as Python code runs. TensorFlow records gradients inside a `GradientTape` block and also offers a stable C++ API. On Windows, TensorFlow's GPU builds run through WSL, the Windows Subsystem for Linux.

### JAX vs PyTorch: which should I use?

JAX transforms functions: `jax.grad` differentiates a function, `jax.jit` compiles it with XLA, and the two compose. Those transforms require pure functions, so model state passes in and out as arguments. PyTorch keeps state inside module objects and records gradients as the code runs.

### Keras vs TensorFlow: what is the difference?

Keras is a high-level API for building and training models, and TensorFlow is one of the engines it runs on. The current Keras also runs on JAX and PyTorch, and the previous version remains available as the `tf-keras` package.

### Keras vs PyTorch: which should I use?

Keras defines a model as layers and trains it through its own API, and it can use PyTorch as its backend. Plain PyTorch leaves the training loop to the program, which controls each step.

### What is Flax in JAX?

[Flax](#flax) is a neural network library for JAX. Its NNX API defines models as regular Python objects with mutable state, and JAX transforms then compile and differentiate them.

## How this page was built

Data checked Nov 19, 2026.

Reproduce it with the Exa API:

```json
{
  "endpoint": "/search",
  "body": {
    "query": "Best Python deep learning libraries PyTorch TensorFlow Keras JAX examples",
    "numResults": 5
  }
}
```

Docs: https://exa.ai/docs/reference/search
