forward_maxpool1d Subroutine

private subroutine forward_maxpool1d(this, input)

Forward propagation

Type Bound

maxpool1d_layer_type

Arguments

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

Instance of the 1D max pooling layer

class(array_type), intent(in), dimension(:,:) :: input

Input values


Source Code

  subroutine forward_maxpool1d(this, input)
    !! Forward propagation
    implicit none

    ! Arguments
    class(maxpool1d_layer_type), intent(inout) :: this
    !! Instance of the 1D max pooling layer
    class(array_type), dimension(:,:), intent(in) :: input
    !! Input values

    ! Local variables
    type(array_type), pointer :: ptr
    !! Pointer array


    call this%output(1,1)%zero_grad()
    select case(allocated(this%pad_layer))
    case(.true.)
       call this%pad_layer%forward(input)
       ptr => maxpool1d(this%pad_layer%output(1,1), this%pool(1), this%strd(1))
    case default
       ptr => maxpool1d(input(1,1), this%pool(1), this%strd(1))
    end select
    call this%output(1,1)%assign_and_deallocate_source(ptr)
    this%output(1,1)%is_temporary = .false.

  end subroutine forward_maxpool1d