QUESTION 1 OF 10

How does an RNN process a sequence?

Reveal the answer and explore the explanation.

01
EasyCore

How does an RNN process a sequence?

Answer
Answer

Processes sequence steps using a recurrent hidden state.

Practical example

Summarize a stream of measurements one time step at a time.

PythonRelated concept example
import torch
from torch import nn
x = torch.randn(2, 5, 8)
model = nn.LSTM(8, 16, batch_first=True)
y, (h, c) = model(x)
print(y.shape)

Batch size two, five time steps, 16 output features.

Reference: Further reading ↗

Last 30 min revisionHigh-yield interview Q&As