set_hyperparams_pad1d Subroutine

private subroutine set_hyperparams_pad1d(this, padding, method, verbose)

Uses

    • coreutils

Set hyperparameters for 1D padding layer

Type Bound

pad1d_layer_type

Arguments

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

Instance of the 1D padding layer

integer, intent(in), dimension(1) :: padding

Padding sizes

character(len=*), intent(in) :: method

Padding method

integer, intent(in), optional :: verbose

Verbosity level


Source Code

  subroutine set_hyperparams_pad1d(this, padding, method, verbose)
    !! Set hyperparameters for 1D padding layer
    use coreutils, only: to_lower
    implicit none

    ! Arguments
    class(pad1d_layer_type), intent(inout) :: this
    !! Instance of the 1D padding layer
    integer, dimension(1), intent(in) :: padding
    !! Padding sizes
    character(*), intent(in) :: method
    !! Padding method
    integer, optional, intent(in) :: verbose
    !! Verbosity level

    this%name = "pad1d"
    this%type = "pad"
    this%input_rank = 2
    this%output_rank = 2
    this%pad = padding
    if(allocated(this%facets)) deallocate(this%facets)
    allocate(this%facets(this%input_rank - 1))
    this%facets(1)%rank = 1
    this%facets(1)%nfixed_dims = 1
    select case(trim(adjustl(to_lower(method))))
    case("valid", "none")
       this%imethod = 0
    case("same", "zero", "constant", "const")
       this%imethod = 1
    case("full")
       this%imethod = 2
    case("circular", "circ")
       this%imethod = 3
    case("reflection", "reflect", "refl")
       this%imethod = 4
    case("replication", "replicate", "copy", "repl")
       this%imethod = 5
    case default
       call stop_program("Unrecognised padding method :"//method)
       return
    end select
    this%method = trim(adjustl(to_lower(method)))

  end subroutine set_hyperparams_pad1d