Bidirectional RNN Forward Pass

medium
Unit 12 · Mixed Precision & Metric Learning0/3 to milestone

A bidirectional RNN runs one vanilla RNN left-to-right and another right-to-left, then concatenates their hidden states at each step, so every position sees the whole sequence.

Each direction uses ht=tanh⁡(xtWx+ht−1Wh+b)h_t = \tanh(x_t W_x + h_{t-1} W_h + b) starting from zeros. Implement birnn(X, fwd, bwd) where X has shape (T, d_in) and fwd, bwd are (Wx, Wh, b) tuples. Return an array of shape (T, 2 * hidden) with the forward state first.

#rnn#sequence-models2 visible + 1 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Bidirectional RNN Forward Pass · TechGradify