Run a vanilla RNN over a whole sequence. X has one input vector per row; starting from the hidden state h0, apply ht=tanh(Wxxt+Whht−1+b) for each row in order.
Implement solve(X, h0, Wx, Wh, b).
Returns. Return an array of shape (T, hidden) whose row t is the hidden state after reading input t (the initial state h0 is not included).
Example 1
Input:
solve([[1.0], [2.0]], [0.0], [[1.0]], [[0.5]], [0.0])
Output:
[[0.761594], [0.983041]]
Example 2
Input:
solve([[0.0], [0.0], [0.0]], [1.0], [[1.0]], [[1.0]], [0.0])
Output:
[[0.761594], [0.642015], [0.56627]]
No results yet
Run your code to check it against the examples, or submit to run every test.