network_reduction Module Subroutine

module subroutine network_reduction(this, source)

Procedure to add two networks together

Arguments

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

Instance of network

type(network_type), intent(in) :: source

Instance of network to be added to this


Source Code

  module subroutine network_reduction(this, source)
    !! Procedure to add two networks together
    implicit none

    ! Arguments
    class(network_type), intent(inout) :: this
    !! Instance of network
    type(network_type), intent(in) :: source
    !! Instance of network to be added to this

    ! Local variables
    integer :: i
    !! Loop index

    this%metrics(1)%val = this%metrics(1)%val + source%metrics(1)%val
    this%metrics(2)%val = this%metrics(2)%val + source%metrics(2)%val
    do i=1,size(this%model)
       select type(layer_this => this%model(i)%layer)
       class is(learnable_layer_type)
          select type(layer_source => source%model(i)%layer)
          class is(learnable_layer_type)
             call layer_this%reduce(layer_source)
          end select
       end select
    end do

  end subroutine network_reduction