print_to_unit_duvenaud Subroutine

private subroutine print_to_unit_duvenaud(this, unit)

Uses

    • coreutils

Print kipf message passing layer to unit

Type Bound

duvenaud_msgpass_layer_type

Arguments

Type IntentOptional Attributes Name
class(duvenaud_msgpass_layer_type), intent(in) :: this

Instance of the message passing layer

integer, intent(in) :: unit

Filename


Source Code

  subroutine print_to_unit_duvenaud(this, unit)
    !! Print kipf message passing layer to unit
    use coreutils, only: to_upper
    implicit none

    ! Arguments
    class(duvenaud_msgpass_layer_type), intent(in) :: this
    !! Instance of the message passing layer
    integer, intent(in) :: unit
    !! Filename

    ! Local variables
    integer :: t
    !! Loop index
    character(100) :: fmt
    !! Format string


    ! Write initial parameters
    !---------------------------------------------------------------------------
    write(unit,'(3X,"NUM_TIME_STEPS = ",I0)') this%num_time_steps
    write(fmt,'("(3X,""NUM_VERTEX_FEATURES ="",",I0,"(1X,I0))")') &
         this%num_time_steps + 1
    write(unit,fmt) this%num_vertex_features
    write(fmt,'("(3X,""NUM_EDGE_FEATURES ="",",I0,"(1X,I0))")') &
         this%num_time_steps + 1
    write(unit,fmt) this%num_edge_features

    if(this%activation%name .ne. 'none')then
       call this%activation%print_to_unit(unit, identifier='MESSAGE')
    end if
    if(this%activation_readout%name .ne. 'none')then
       call this%activation_readout%print_to_unit(unit, identifier='READOUT')
    end if


    ! Write learned parameters
    !---------------------------------------------------------------------------
    write(unit,'("WEIGHTS")')
    do t = 1, this%num_time_steps, 1
       write(unit,'(5(E16.8E2))') this%params(t)%val(:,1)
    end do
    do t = 1, this%num_time_steps, 1
       write(unit,'(5(E16.8E2))') this%params(t+this%num_time_steps)%val(:,1)
    end do
    write(unit,'("END WEIGHTS")')

  end subroutine print_to_unit_duvenaud