superstats.networks.recurrent#
Recurrent summary network layers.
Classes
|
Implements a sequence-producing recurrent network. |
- class superstats.networks.recurrent.RecurrentNet(*args, **kwargs)[source]#
Bases:
SummaryNetworkImplements a sequence-producing recurrent network.
- Parameters:
- summary_dim
int,optional, default: 64 Per-timestep output dimensionality.
- hidden_dim
intor sequenceofint,optional, default: (128, 128) Dimensionality of the hidden state in each recurrent layer.
- recurrent_type{“lstm”, “gru”}
orsequence,optional, default: “lstm” Type of recurrent unit to use in each layer.
- bidirectionalbool or sequence
ofbool,optional, default:True If True, the layer is processed bidirectionally and the two directions are merged according to merge_mode. If False, the layer processes the sequence forward only.
- merge_mode{“sum”, “mul”, “ave”, “concat”}
orsequence,optional, default: “sum” Mode used to merge forward and backward outputs in bidirectional layers.
- layer_normbool or sequence
ofbool,optional, default:True Whether to apply layer normalization after each recurrent layer.
- time_embed_dim
int,optional, default: 16 The number of features learned by the time2vec preprocessing layer.
- dropout
floator sequenceoffloatin[0, 1],optional, default: 0.05 Dropout rate applied after the recurrent layer(s).
- **kwargs
Additional keyword arguments passed to the parent class constructor.
- summary_dim
- Raises:
ValueErrorIf per-layer parameter sequences have incompatible lengths or contain invalid values.
- Parameters:
Notes
All recurrent layers are built with return_sequences=True, so the projection is applied per timestep and the sequence-length axis is retained. If any of hidden_dim, recurrent_type, bidirectional, merge_mode, or layer_norm is a sequence with more than one element, all single values are expanded to that length. Multiple multi-element sequences must have the same length.