Compute one step of a vanilla (Elman) RNN: the new hidden state is h′=tanh(Wxx+Whh+b) for the input vector x, previous hidden state h, input weights Wx, recurrent weights Wh and bias b.
Implement solve(x, h, Wx, Wh, b).
Returns. Return the new hidden state as a NumPy vector with entries in (−1,1).
Example 1
Input:
solve([1.0, 2.0], [0.0, 1.0], [[1.0, 0.0], [0.0, 1.0]], [[1.0, 0.0], [0.0, 1.0]], [0.0, 0.0])
Output:
[0.761594, 0.995055]
Example 2
Input:
solve([0.0], [0.0], [[1.0]], [[1.0]], [0.5])
Output:
[0.462117]
No results yet
Run your code to check it against the examples, or submit to run every test.