reset Module Subroutine

module subroutine reset(this)

Reset the network

Arguments

Type IntentOptional Attributes Name
class(network_type), intent(inout) :: this

Instance of network


Source Code

  module subroutine reset(this)
    !! Reset the network
    implicit none

    ! Arguments
    class(network_type), intent(inout) :: this
    !! Instance of network

    this%epoch = 0
    this%accuracy_val = 0._real32
    this%loss_val = huge(1._real32)
    this%batch_size = 0
    this%num_layers = 0
    this%num_outputs = 0
    if(allocated(this%optimiser)) deallocate(this%optimiser)
    call this%set_metrics(["loss"])
    if(allocated(this%model)) deallocate(this%model)
    if(allocated(this%loss)) deallocate(this%loss)
    this%get_accuracy => null()

    if(allocated(this%vertex_order)) deallocate(this%vertex_order)
    if(allocated(this%leaf_vertices)) deallocate(this%leaf_vertices)
    if(allocated(this%root_vertices)) deallocate(this%root_vertices)
    this%auto_graph = graph_type(directed=.true.)

  end subroutine reset