Skip to content
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

Introduce a separate network % compile() step #176

Open
milancurcic opened this issue Apr 19, 2024 · 0 comments
Open

Introduce a separate network % compile() step #176

milancurcic opened this issue Apr 19, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@milancurcic
Copy link
Member

...to add the optimizer, loss, and eventually, metrics, to the network.

These are only needed in training. For that reason, we don't require them at model creation (good!), but that also means that because we don't have a separate network % compile() step, we need to set them either in network % train() or network % update() (in case of optimizer) or network % backward() (in case of loss) methods. It's complicating the code and making it more difficult to understand and maintain.

subroutine compile(self, optimizer, loss)
  class(network), intent(inout) :: self
  class(optimizer_base_type), intent(in), optional :: optimizer
  class(loss_type), intent(in), optional :: loss
  ...
end subroutine compile

Then, we wouldn't need to do any special bookkeeping regarding whether loss or optimizer are set in train(), update(), or backward() methods.

@milancurcic milancurcic added the enhancement New feature or request label Apr 19, 2024
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

No branches or pull requests

1 participant