Compute one LSTM cell update. The single weight matrix W has shape (4H, d + H) and acts on the concatenation [x, h]; the four resulting gate blocks, each of length H, are in the order input, forget, output, candidate (i,f,o,g). The bias b has length 4H.
Implement solve(x, h, c, W, b).
Returns. Return a tuple (h_new, c_new) with cnew=σ(f)⊙c+σ(i)⊙tanh(g) and hnew=σ(o)⊙tanh(cnew).
Example 1
Input:
solve([1.0], [0.0], [0.0], np.zeros((4, 2)), np.zeros(4))
Output:
([0.0], [0.0])
Example 2
Input:
solve([0.0], [0.0], [2.0], np.zeros((4, 2)), [0.0, 4.0, 4.0, 0.0])
Output:
([0.944104], [1.964028])
No results yet
Run your code to check it against the examples, or submit to run every test.