Skip to content

getting / setting network parameters (third-time lucky with tab space formatting) #107

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

Closed
wants to merge 69 commits into from

Conversation

jvo203
Copy link
Contributor

@jvo203 jvo203 commented Dec 3, 2022

  • fixed CMakeList.txt
  • added get_num_params()
  • added get_parameters()
  • added set_parameters()
  • created an example test program: example/params.f90
  • re-formatted in vscode on macOS using "Modern Fortran" with the tab indent set to 2 spaces (hopefully)

Regarding the indenting, in the macOS vscode I have already been using the "Modern Fortran" extension as recommended by you. The "fprettify" vscode extension is not installed. Searching the installed extensions for "fortran" only returns "Modern Fortran", no other stuff is installed. In the vscode I have just set "Editor: Tab Size" to 2 and disabled automatic tab size recognition from existing files. Then I touched and saved all the modified .f90 files, triggering automatic re-formatting upon save with the tab size set to 2. Hopefully the files now look more like what you expect them to be.

Please let me know if there are any more settings that might need changing in vscode. If this PR does not fix indenting then it might have to be "over to you" upon your return to work. No worries, this stuff can wait!

@jvo203
Copy link
Contributor Author

jvo203 commented Dec 3, 2022

An improvement: in the top file nf_network_submodule.f90, the subroutine get_parameters(self, params), it makes sense to add

if (allocated(params)) deallocate(params)

right before the loop

do n = 1, size(self%layers)

Some users might repeatedly call get_parameters (for whatever reason), the fix makes sure the params array is emptied / deallocated prior to any 2nd-time use. Otherwise parameters would keep getting appended to the end of the existing params array instead of being written starting at the beginning of params.

@milancurcic milancurcic mentioned this pull request Dec 16, 2022
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants