Skip to content

Conversation

@Riccardo231
Copy link
Collaborator

Fixed a conceptual error present in nf_dropout_layer_submodule.f90. In order to get sum(input) == sum(output) the definition of scale should be sum(input) / sum(input * self % mask)

Proof:

sum(input) == sum(output)
sum(input) == sum(input * mask * scale)

Since scale is constant,
sum(input) == scale * sum(input * mask)
But scale == sum(input) / sum(input * self % mask), so:
sum(input) == sum(input) * sum(input * mask) / sum(input * mask)

@Riccardo231 Riccardo231 mentioned this pull request Jan 26, 2025
5 tasks
@milancurcic
Copy link
Member

Thanks @ricor07. Can you make a PR against #194 rather than main?

@Riccardo231
Copy link
Collaborator Author

Sorry I'm not very used with GitHub. Could you tell me how?

@milancurcic
Copy link
Member

No problem and I appreciate your patience.

Here's how to submit a new PR against this one.

  1. Fork my fork of this repository (https://github.com/milancurcic/neural-fortran)
  2. Clone your newly forked repo: `git clone [email protected]:ricor07/neural-fortran (since you already have a fork of modern-fortran/neural-fortran, I'm not sure how GitHub will handle the name conflict; it may be that it will be called something else)
  3. After cloning it, do
cd neural-fortran
git remote add upstream https://github.com/milancurcic/neural-fortran
git checkout dropout
# make your changes, add, and commit
git push origin dropout # this will push the changes to your fork
  1. Navigate to https://github.com/milancurcic/neural-fortran and create a new PR; choose dropout as the target branch and your own fork's dropout branch as the source branch.

Let me know how it goes.

@Riccardo231 Riccardo231 closed this by deleting the head repository Jan 28, 2025
@Riccardo231
Copy link
Collaborator Author

I cloned your repo but it doesn't have the dropout layer file. Since it is only a line of change, could you change your code? Thank you.

In the next days, I wanted to work on #171. Is it possible? Thanks

@milancurcic
Copy link
Member

milancurcic commented Jan 28, 2025 via email

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