class torch.nn.GRUCell(input_size: int, hidden_size: int, bias: bool = True) [source]
A gated recurrent unit (GRU) cell
where is the sigmoid function, and is the Hadamard product.
x
h
False, then the layer does not use bias weights b_ih and b_hh. Default: True
(batch, input_size): tensor containing input features(batch, hidden_size): tensor containing the initial hidden state for each element in the batch. Defaults to zero if not provided.(batch, hidden_size): tensor containing the next hidden state for each element in the batchinput_size
hidden_size Defaults to zero if not provided.(3*hidden_size, input_size)
(3*hidden_size, hidden_size)
(3*hidden_size)
(3*hidden_size)
Note
All the weights and biases are initialized from where
Examples:
>>> rnn = nn.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)
© 2019 Torch Contributors
Licensed under the 3-clause BSD License.
https://pytorch.org/docs/1.7.0/generated/torch.nn.GRUCell.html