Compute the forward pass of a two-layer network with a ReLU hidden layer: z1=XW1+b1, h=max(z1,0), Y=hW2+b2. Also return the intermediate values needed for backpropagation.
Implement solve(X, W1, b1, W2, b2).
Returns. Return a tuple (Y, (z1, h)) where the second element is the cache of pre-activation and hidden activation.
Example 1
Input:
solve([[1, 2]], [[1, 0], [0, 1]], [-1, 1], [[2], [3]], [0])
Output:
([[9]], ([[0, 3]], [[0, 3]]))
Example 2
Input:
solve([[2]], [[1]], [-1], [[4]], [1])
Output:
([[5]], ([[1]], [[1]]))
No results yet
Run your code to check it against the examples, or submit to run every test.