Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
TensorFlow-based neural network library
| Date | Stars |
|---|---|
| 2026-07-24 | 9945 |
| 2026-07-25 | 9945 |
| 2026-07-28 | 9945 |
| 2026-07-30 | 9945 |
| 2026-07-31 | 9944 |
| 2026-08-01 | 9945 |
| 2026-08-02 | 9945 |
| 2026-08-06 | 9946 |
Today
+1 stars today
This week
+1 stars this week
This month
— stars this month
Momentum
5.0
growth rate 0.01%/day

# Sonnet
[**Documentation**](https://sonnet.readthedocs.io/) | [**Examples**](#examples)
Sonnet is a library built on top of [TensorFlow 2](https://www.tensorflow.org/)
designed to provide simple, composable abstractions for machine learning
research.
# Introduction
Sonnet has been designed and built by researchers at DeepMind. It can be used to
construct neural networks for many different purposes (un/supervised learning,
reinforcement learning, ...). We find it is a successful abstraction for our
organization, you might too!
More specifically, Sonnet provides a simple but powerful programming model
centered around a single concept: `snt.Module`. Modules can hold references to
parameters, other modules and methods that apply some function on the user
input. Sonnet ships with many predefined modules (e.g. `snt.Linear`,
`snt.Conv2D`, `snt.BatchNorm`) and some predefined networks of modules (e.g.
`snt.nets.MLP`) but users are also encouraged to build their own modules.
Unlike many frameworks Sonnet is extremely unopinionated about **how** you will
use your modules. Modules are designed to be self contained and entirely
decoupled from one another. Sonnet does not ship with a training framework and
users are encouraged to build their own or adopt those built by others.
Sonnet is also designed to be simple to understand, our code is (hopefully!)
clear and focussed. Where we have picked defaults (e.g. defaults for initial
parameter values) we try to point out why.
# Getting Started
## Examples
The easiest way to try Sonnet is to use Google Colab which offers a free Python
notebook attached to a GPU or TPU.
- [Predicting MNIST with an MLP](https://colab.research.google.com/github/deepmind/sonnet/blob/v2/examples/mlp_on_mnist.ipynb)
- [Training a Little GAN on MNIST](https://colab.research.google.com/github/deepmind/sonnet/blob/v2/examples/little_gan_on_mnist.ipynb)
- [Distributed training with `snt.distribute`](https://colab.research.google.com/github/deepmind/sonnet/blob/v2/examples/distributed_cifar10.ipynb)
## Installation
To get started install TensorFlow 2.0 and Sonnet 2:
```shell
$ pip install tensorflow tensorflow-probability
$ pip install dm-sonnet
```
You can run the following to verify things installed correctly:
```python
import tensorflow as tf
import sonnet as snt
print("TensorFlow version {}".format(tf.__version__))
print("Sonnet version {}".format(snt.__version__))
```
### Using existing modules
Sonnet ships with a number of built in modules that you can trivially use. For
example to define an MLP we can use the `snt.Sequential` module to call a
sequence of modules, passing the output of a given module as the input for the
next module. We can use `snt.Linear` and `tf.nn.relu` to actually define our
computation:
```python
mlp = snt.Sequential([
snt.Linear(1024),
tf.nn.relu,
snt.Linear(10),
])
```
To use our module we need to "call" it. The `Sequential` module (and most
modules) define a `__call__` method that means you can call them by name:
```python
logits = mlp(tf.random.normal([batch_size, input_size]))
```
It is also very common to request all the parameters for your module. Most
modules in Sonnet create their parameters the first time they are called with
some input (since in most cases the shape of the parameters is a function of
the input). Sonnet modules provide two properties for accessing parameters.
The `variables` property returns **all** `tf.Variable`s that are referenced by
the given module:
```python
all_variables = mlp.variables
```
It is worth noting that `tf.Variable`s are not just used for parameters of your
model. For example they are used to hold state in metrics used in
`snt.BatchNorm`. In most cases users retrieve the module variables to pass them
to an optimizer to be updated. In this case non-trainable variables should
typically not be in that list as they are updated via a different mechanism.
TensorFloExcerpt of 11,646 characters
Read on GitHubTom Hennigan · @google-deepmind · United Kingdom
189
Malcolm Reynolds · United Kingdom
89
Diego de las Casas · United Kingdom
56
53
47
Sergei Lebedev · Software Engineer at @deepmind · United Kingdom
40
12
Chris Jones · DeepMind (@deepmind) · United Kingdom
9
8
6
Copybara Service · @google
6
6
Hanbyul Kim · NAVER · South Korea
6
Gabriel Barth-Maron · Google DeepMind · United Kingdom
5
John Aslanides · @DeepMind · United Kingdom
5
Loren Maggiore · United States
4
4
3
Si-Qi LIU · DeepMind Technologies · United Kingdom
3
3
Would you bet a product on this? Bounded 0–100 and slow moving.
matched fp:7a2d2801b2cdddbd, topic:deep-learning, topic:tensorflow, readme:training framework