forward_input Subroutine

private subroutine forward_input(this, input)

Forward propagation for an input layer

Type Bound

input_layer_type

Arguments

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

Instance of the input layer

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

Input data


Source Code

  subroutine forward_input(this, input)
    !! Forward propagation for an input layer
    implicit none

    ! Arguments
    class(input_layer_type), intent(inout) :: this
    !! Instance of the input layer
    class(array_type), dimension(:,:), intent(in) :: input
    !! Input data

    ! Local variables
    integer :: i, j
    !! Loop indices

    if(allocated(this%output))then
       if(any(shape(this%output).ne.shape(input)))then
          deallocate(this%output)
          allocate(this%output(size(input,1),size(input,2)))
       end if
    else
       allocate(this%output(size(input,1),size(input,2)))
    end if

    do i = 1, size(input, 1)
       do j = 1, size(input, 2)
          if(.not.input(i,j)%allocated)then
             call stop_program('Input to input layer not allocated')
             return
          end if
          call this%output(i,j)%assign_shallow( input(i,j) )
          this%output(i,j)%is_temporary = .false.
       end do
    end do

  end subroutine forward_input