Compute one GRU update. W has shape (2H, d + H) and produces the reset and update gates (in that order) from [x, h] plus the bias b; Wh has shape (H, d + H) and, together with the bias bh, produces the candidate state from [x, r ⊙ h]. The new state is (1−z)⊙h+z⊙h~.
Implement solve(x, h, W, b, Wh, bh).
Returns. Return the new hidden state as a NumPy vector of length H.
Example 1
Input:
solve([1.0], [2.0], np.zeros((2, 2)), [0.0, 0.0], np.zeros((1, 2)), [0.0])
Output:
[1.0]
Example 2
Input:
solve([0.0], [0.0], np.zeros((2, 2)), [0.0, 0.0], np.zeros((1, 2)), [0.0])
Output:
[0.0]
No results yet
Run your code to check it against the examples, or submit to run every test.