Last active
October 11, 2020 11:00
-
-
Save PyDataBlog/adde4a97494bc44135f3fd298bc01a5f to your computer and use it in GitHub Desktop.
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
| """ | |
| Funtion to initialise the parameters or weights of the desired network. | |
| """ | |
| function initialise_model_weights(layer_dims, seed) | |
| params = Dict() | |
| # Build a dictionary of initialised weights and bias units | |
| for l=2:length(layer_dims) | |
| params[string("W_", (l-1))] = rand(StableRNG(seed), layer_dims[l], layer_dims[l-1]) * sqrt(2 / layer_dims[l-1]) | |
| params[string("b_", (l-1))] = zeros(layer_dims[l], 1) | |
| end | |
| return params | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment