gensbi.models.maf.masked_linear#
Dense layer with a fixed binary weight mask.
Classes#
|
Module Contents#
- class gensbi.models.maf.masked_linear.MaskedLinear(in_features, out_features, mask, rngs, param_dtype=jnp.float32, dtype=jnp.float32)[source]#
Bases:
flax.nnx.Moduley = (kernel * mask).T @ x + biaswith a non-trainable mask.- Parameters:
in_features (int)
out_features (int)
mask (Array) – Boolean array of shape
(in_features, out_features); stored as aMaskbuffer so it is excluded fromnnx.Param.rngs (nnx.Rngs)
param_dtype (DTypeLike, optional) – Dtype for the stored (master) kernel/bias parameters. Defaults to float32 (exact-likelihood model needs the precision).
dtype (DTypeLike, optional) – Compute dtype: the kernel/bias/activations are cast to this dtype before the matmul. Defaults to float32, matching
param_dtype, so with default arguments this is a no-op cast (bit-identical).