Created
February 26, 2019 17:38
-
-
Save marcopeix/5de03505342d651383100f737fc90c4e 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 L_model_forward(X, parameters): | |
caches = [] | |
A = X | |
L = len(parameters) // 2 # number of layers in the neural network | |
for l in range(1, L): | |
A_prev = A | |
A, cache = linear_activation_forward(A_prev, | |
parameters['W' + str(l)], | |
parameters['b' + str(l)], | |
activation='relu') | |
caches.append(cache) | |
AL, cache = linear_activation_forward(A, | |
parameters['W' + str(L)], | |
parameters['b' + str(L)], | |
activation='sigmoid') | |
caches.append(cache) | |
assert(AL.shape == (1, X.shape[1])) | |
return AL, caches |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment