Skip to content

Instantly share code, notes, and snippets.

@marcopeix
Created February 26, 2019 17:13
Show Gist options
  • Save marcopeix/ce72a6458fe412faa7f03b346af23594 to your computer and use it in GitHub Desktop.
Save marcopeix/ce72a6458fe412faa7f03b346af23594 to your computer and use it in GitHub Desktop.
def linear_activation_forward(A_prev, W, b, activation):
if activation == "sigmoid":
Z, linear_cache = linear_forward(A_prev, W, b)
A, activation_cache = sigmoid(Z)
elif activation == "relu":
Z, linear_cache = linear_forward(A_prev, W, b)
A, activation_cache = relu(Z)
assert (A.shape == (W.shape[0], A_prev.shape[1]))
cache = (linear_cache, activation_cache)
return A, cache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment