Class GRU
java.lang.Object
ai.beestream.jitnn.nn.Module
ai.beestream.jitnn.nn.GRU
- All Implemented Interfaces:
AutoCloseable
A stack of GRU layers over [T, B, I] sequences (time first), optionally bidirectional, PyTorch's
nn.GRU equations, gate order, parameter order and initialisation: every weight and
bias uniform in [-1/sqrt(H), 1/sqrt(H)). Parameters per layer and direction (forward, then
reverse): W_ih [3H, in], W_hh [3H, H], b_ih, b_hh [3H]. Padded batches pass their
sequence lengths: outputs past a length are 0 and the final states are each sequence's last.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordOutput sequence of the last layer [T, B, directions H] and the final hidden states, [layers directions, B, H] each. -
Constructor Summary
ConstructorsConstructorDescriptionGRU(int input, int hidden, int layers, boolean bidirectional, long seed) layersGRU layers frominputtohiddenfeatures, optionally bidirectional, initialised fromseed.GRU(int input, int hidden, int layers, long seed) layersunidirectional GRU layers frominputtohiddenfeatures, initialised fromseed. -
Method Summary
Modifier and TypeMethodDescriptionOutput sequence of the last layer, from zero initial states.From initial states [layers directions, B, H] (null: zeros), for sequences oflengths(null: all T).inthidden()The hidden size per direction.Methods inherited from class Module
buffer, buffers, child, close, isClosed, isTraining, loadStateDict, parameter, parameterCount, parameters, stateDict, train, zeroGrad
-
Constructor Details
-
GRU
public GRU(int input, int hidden, int layers, long seed) layersunidirectional GRU layers frominputtohiddenfeatures, initialised fromseed. -
GRU
public GRU(int input, int hidden, int layers, boolean bidirectional, long seed) layersGRU layers frominputtohiddenfeatures, optionally bidirectional, initialised fromseed.
-
-
Method Details
-
forward
-
forward
From initial states [layers directions, B, H] (null: zeros), for sequences oflengths(null: all T).