Run a vanilla tanh RNN over an input sequence and return every hidden state. X has one input vector per row, h0 is the initial state, and each step computes ht=tanh(Wxxt+Whht−1+b).
Implement solve(X, h0, Wx, Wh, b).
Returns. Return an array of shape (T, hidden); the initial state 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([[1.0, 0.0], [0.0, 1.0]], [0.0, 0.0], [[1.0, 0.0], [0.0, 1.0]], [[0.0, 0.0], [0.0, 0.0]], [0.0, 0.0])
Output:
[[0.761594, 0.0], [0.0, 0.761594]]
No results yet
Run your code to check it against the examples, or submit to run every test.