Initialise padding layer
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(pad_layer_type), | intent(inout) | :: | this |
Instance of the padding layer |
||
| integer, | intent(in), | dimension(:) | :: | input_shape |
Input shape |
|
| integer, | intent(in), | optional | :: | verbose |
Verbosity level |
module subroutine init_pad(this, input_shape, verbose) !! Initialise padding layer implicit none ! Arguments class(pad_layer_type), intent(inout) :: this !! Instance of the padding layer integer, dimension(:), intent(in) :: input_shape !! Input shape integer, optional, intent(in) :: verbose !! Verbosity level ! Local variables integer :: i !! Loop index integer :: verbose_ = 0 !! Verbosity level !--------------------------------------------------------------------------- ! Initialise optional arguments !--------------------------------------------------------------------------- if(present(verbose)) verbose_ = verbose !--------------------------------------------------------------------------- ! Initialise input shape !--------------------------------------------------------------------------- if(.not.allocated(this%input_shape)) call this%set_shape(input_shape) if(.not.allocated(this%orig_bound))then allocate(this%orig_bound(2,this%input_rank-1)) allocate(this%dest_bound(2,this%input_rank-1)) end if do i = 1, this%input_rank - 1 this%orig_bound(:,i) = [ 1, this%input_shape(i) ] this%dest_bound(:,i) = [ 1, this%input_shape(i) + this%pad(i) * 2 ] call this%facets(i)%setup_bounds( & length = this%input_shape(:this%input_rank-1), & pad = this%pad, & imethod = this%imethod & ) end do !--------------------------------------------------------------------------- ! Set up number of channels, width, height !--------------------------------------------------------------------------- this%num_channels = this%input_shape(this%input_rank) if(allocated(this%output_shape)) deallocate(this%output_shape) allocate( this%output_shape(this%input_rank) ) this%output_shape(this%input_rank) = this%input_shape(this%input_rank) this%output_shape(:this%input_rank-1) = & this%input_shape(:this%input_rank-1) + this%pad(:) * 2 !--------------------------------------------------------------------------- ! Allocate arrays !--------------------------------------------------------------------------- if(this%use_graph_input)then call stop_program("Graph input not supported for padding layer") return end if if(allocated(this%output)) deallocate(this%output) allocate( this%output(1,1) ) end subroutine init_pad