jaxdem.rl.models.mingru#

Reinforcement learning model based on MinGRU.

Classes

MinGRUActorCritic(*args, **kwargs)

A recurrent actor-critic with an MLP encoder and a MinGRU torso.

class jaxdem.rl.models.mingru.MinGRUActorCritic(*args: Any, **kwargs: Any)[source]#

Bases: Model

A recurrent actor-critic with an MLP encoder and a MinGRU torso.

This model uses the MinGRU architecture (https://arxiv.org/abs/2410.01201) and a parallel associative scan for sequence-mode training.

Parameters:
  • observation_space_size (int) – Flattened observation size (obs_dim).

  • action_space_size (int) – Number of action dimensions (for continuous) or number of discrete actions.

  • key (nnx.Rngs) – Random number generator(s) for parameter initialization.

  • hidden_features (int) – Width of the encoder output.

  • gru_features (int) – MinGRU hidden size. Also the feature size consumed by the policy and value heads.

  • num_layers (int) – Number of MinGRU layers.

  • activation (Callable) – Activation function applied inside the encoder.

  • action_space (distrax.Bijector | ActionSpace | None) – Bijector to constrain the policy probability distribution (continuous only).

  • remat (bool) – Accepted for interface compatibility. Unused.

  • actor_sigma_head (bool) – If True, a learned head on the MinGRU output produces the standard deviation. Otherwise the model uses an independent log-std parameter. Only used for continuous actions.

  • carry_leading_shape (tuple[int, ...]) – Leading dimensions for the persistent carry tensor h.

  • discrete (bool) – If True, use a categorical distribution for discrete actions.

property observation_space_size: int[source]#
property carry_leading_shape: tuple[int, ...][source]#
reset(shape: tuple[int, ...], mask: Array | None = None) None[source]#

Reset the persistent recurrent carry.

Parameters:
  • shape (tuple[int, ...]) – Leading dims for the carry, e.g. (num_envs, num_agents).

  • mask (optional bool array) – True where to reset entries. Shape (num_envs)

property carry: Any[source]#