Created
July 13, 2019 21:02
-
-
Save ksivaman/37bb859843e9e97500744aefb3ba2de6 to your computer and use it in GitHub Desktop.
Forward pass for all the layers.
This file contains hidden or 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 forward_pass(train_X, params_w, params_b, layers=[4, 5, 1], activate=['R', 'S']): | |
num_layers = len(layers) - 1 | |
activation_dict = {} | |
output_dict = {} | |
curr_act = train_X | |
for index in range(num_layers): | |
layer_index = index + 1 | |
prev_act = curr_act | |
curr_weight = params_w["weight" + str(layer_index)] | |
curr_bias = params_b["bias" + str(layer_index)] | |
curr_act, curr_out = one_layer_forward_pass(prev_act, curr_weight, curr_bias, activate[index]) | |
activation_dict["act" + str(index)] = prev_act | |
output_dict["out" + str(layer_index)] = curr_out | |
return curr_act, activation_dict, output_dict |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment