Skip to content

Get set network parameters #111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

milancurcic
Copy link
Member

@milancurcic milancurcic commented Dec 16, 2022

Opening this in favor of #107 by @jvo203. It should be easier to review. I made some small cosmetic changes.

  • Implementation
  • Example
  • Tests

Closes #103.

@milancurcic milancurcic added the enhancement New feature or request label Dec 16, 2022
@milancurcic milancurcic self-assigned this Dec 16, 2022
@milancurcic
Copy link
Member Author

I made layer % get_num_params elemental so now net % layers % get_num_params() returns an array of integers, each element corresponding to the size of parameters in each of the layers.

@jvo203
Copy link
Contributor

jvo203 commented Dec 20, 2022

Neat, with get_num_params being elemental there is no need for calling it inside the do loop for each layer, just one call before do and the rest is reading each array entry corresponding to each layer. Plus a sum() to get the total number of parameters.

@milancurcic milancurcic requested a review from jvo203 December 21, 2022 19:04
@milancurcic
Copy link
Member Author

I added a few more checks, completed the minimal test suite, and tidied up the example. @jvo203 please let me know if you think any more changes are needed. If not, I'll merge it tomorrow. Thanks again for all your help.

Copy link
Contributor

@jvo203 jvo203 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As long as there is no problem with floating-point comparisons in get_set_network_params.f90 I am happy with it. The == in test_get_set_network_params.f90 compares integer values (stored in a real array) so there should not be any rounding errors etc.

@milancurcic milancurcic merged commit 8fb2ef3 into modern-fortran:main Dec 22, 2022
@milancurcic milancurcic deleted the get-set-network-parameters branch December 22, 2022 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

extract / set all network parameters via a single 1D real array
2 participants