GRUCell
neuralpy.layers.recurrent.GRUCell(input_size, hidden_size, bias=True, name=None)
danger
GRUCell Layer is unstable and buggy, not ready for any real use
Applies a long short-term memory (LSTM) cell.
To learn more about GRUCell, please check pytorch documentation
Supported Arguments:
input_size
: (Integer) The number of expected features in the inputhidden_size
: (Integer) The number of features in the hidden statebias=True
: (Boolean) If true then uses the bias,Defaults totrue
name=None
: (String) Name of the layer, if not provided then automatically calculates a unique name for the layer
Example Code
import torch
from neuralpy.layers.recurrent import GRUCell
rnn = GRUCell(10, 20)
input = torch.randn(6, 3, 10)
hx = torch.randn(3, 20)
output = []
for i in range(6):
hx = rnn(input[i], hx)
output.append(hx)