print_to_unit_ono_attn Subroutine

private subroutine print_to_unit_ono_attn(this, unit)

Uses

    • coreutils

Print orthogonal attention layer settings and parameters to a unit

Type Bound

orthogonal_attention_layer_type

Arguments

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

Layer instance to print

integer, intent(in) :: unit

Output unit number


Source Code

  subroutine print_to_unit_ono_attn(this, unit)
    !! Print orthogonal attention layer settings and parameters to a unit
    use coreutils, only: to_upper
    implicit none

    ! Arguments
    class(orthogonal_attention_layer_type), intent(in) :: this
    !! Layer instance to print
    integer, intent(in) :: unit
    !! Output unit number

    write(unit,'(3X,"NUM_INPUTS = ",I0)') this%num_inputs
    write(unit,'(3X,"NUM_OUTPUTS = ",I0)') this%num_outputs
    write(unit,'(3X,"NUM_BASIS = ",I0)') this%num_basis
    write(unit,'(3X,"KEY_DIM = ",I0)') this%key_dim
    write(unit,'(3X,"USE_BIAS = ",L1)') this%use_bias
    if(this%activation%name .ne. 'none')then
       call this%activation%print_to_unit(unit)
    end if

    write(unit,'("WEIGHTS")')
    write(unit,'(5(E16.8E2))') this%params(1)%val(:,1)   ! W_Q
    write(unit,'(5(E16.8E2))') this%params(2)%val(:,1)   ! W_K
    write(unit,'(5(E16.8E2))') this%params(3)%val(:,1)   ! W_V
    write(unit,'(5(E16.8E2))') this%params(4)%val(:,1)   ! B
    write(unit,'(5(E16.8E2))') this%params(5)%val(:,1)   ! W
    if(this%use_bias)then
       write(unit,'(5(E16.8E2))') this%params(6)%val(:,1) ! b
    end if
    write(unit,'("END WEIGHTS")')

  end subroutine print_to_unit_ono_attn