Deterministic#

class hybrid_aif.Deterministic[source]#

Bases: Module

A deterministic node: a pure map, optionally with trainable parameters.

gru() builds the RSSM carry case. A recurrent map takes its carry as an argument and returns the next one; nothing is stashed on the module. The gradient statistic arrives from whatever consumes the node’s output, and absorb() applies it through the shared gradient path.

Design: docs/design/system.md (Factors)

map: object#

Any pure callable pytree: an equinox.Module whose array leaves are the node’s parameters, or a bare function with none.

rule: str = 'carry'#

The per-node message treatment, a static string from _RULES; only "carry" (computed forward, never inferred) is built.

frozen: bool = False#

The trainable marking: True keeps the parameters fixed.

classmethod gru(
deter_dim,
input_dims,
*,
key,
hidden,
activation='silu',
norm=True,
frozen=False,
init='default',
)[source]#

An RSSM’s carry node: a GRUCell over (deter, *inputs), with input_dims the widths of the non-carry inputs — for an RSSM (num_vars·num_classes, action_dim), the previous flattened one-hot stoch and the action. init is the cell’s.

property learnable: bool#

Capability: a non-frozen node’s map parameters are a trainable block.

init_opt_state()[source]#

Fresh optimizer state for the map’s parameters — one LearnState entry.

absorb(stats, opt_state, lr=1.0, decay=1.0)[source]#

One optax step from a gradient pytree: (node, opt_state).

stats is ∇ of the consumer’s loss with respect to this node.

__init__(map, rule='carry', frozen=False)#