Set hyperparameters for 1D max pooling layer
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(maxpool1d_layer_type), | intent(inout) | :: | this |
Instance of the 1D max pooling layer |
||
| integer, | intent(in), | dimension(1) | :: | pool_size |
Pool size |
|
| integer, | intent(in), | dimension(1) | :: | stride |
Stride |
|
| character(len=*), | intent(in), | optional | :: | padding |
Padding |
|
| integer, | intent(in), | optional | :: | verbose |
Verbosity level |
subroutine set_hyperparams_maxpool1d( & this, pool_size, stride, padding, verbose & ) !! Set hyperparameters for 1D max pooling layer use coreutils, only: to_lower implicit none ! Arguments class(maxpool1d_layer_type), intent(inout) :: this !! Instance of the 1D max pooling layer integer, dimension(1), intent(in) :: pool_size !! Pool size integer, dimension(1), intent(in) :: stride !! Stride character(*), optional, intent(in) :: padding !! Padding integer, optional, intent(in) :: verbose !! Verbosity level ! Local variables character(len=20) :: padding_ this%name = "maxpool1d" this%type = "pool" this%subtype = "max" this%input_rank = 2 this%output_rank = 2 if(allocated(this%pool)) deallocate(this%pool) if(allocated(this%strd)) deallocate(this%strd) allocate( & this%pool(this%input_rank-1), & this%strd(this%input_rank-1) & ) this%pool = pool_size this%strd = stride ! Handle padding if(present(padding))then padding_ = trim(adjustl(padding)) else padding_ = "valid" end if select case(trim(adjustl(to_lower(padding_)))) case("valid", "none", "") case default this%pad_layer = pad1d_layer_type( & padding = [ (this%pool-1)/2 ], & method = padding_ & ) end select end subroutine set_hyperparams_maxpool1d