Skip to content

Introduce a separate network % compile() step #176

Open
@milancurcic

Description

@milancurcic

...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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions