Example

Parameter Access in JAX Sequential Models

In Flax and JAX, the model architecture and its parameters are decoupled. When a model is defined via the Sequential class, the network must first be initialized to generate a dictionary of parameters. A specific layer's parameters can then be accessed using the keys of this dictionary. For example, params['params']['layers_2'] retrieves the parameters for a layer designated as layers_2, returning a FrozenDict that contains the kernel (weights) and bias arrays.

0

1

Updated 2026-05-08

Contributors are:

Who are from:

Tags

D2L

Dive into Deep Learning @ D2L