Created
February 26, 2019 18:08
-
-
Save marcopeix/740a7a3eb31876177dc5eba5f62e1ac6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def linear_backward(dZ, cache): | |
A_prev, W, b = cache | |
m = A_prev.shape[1] | |
dW = (1 / m) * np.dot(dZ, cache[0].T) | |
db = (1/m) * np.sum(dZ, axis=1, keepdims=True) | |
dA_prev = np.dot(cache[1].T, dZ) | |
assert (dA_prev.shape == A_prev.shape) | |
assert (dW.shape == W.shape) | |
assert (db.shape == b.shape) | |
return dA_prev, dW, db |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment