init_input Subroutine

private subroutine init_input(this, input_shape, verbose)

Initialise 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

integer, intent(in), dimension(:) :: input_shape

Shape of the input data

integer, intent(in), optional :: verbose

Verbosity level


Source Code

  subroutine init_input(this, input_shape, verbose)
    !! Initialise an input layer
    implicit none

    ! Arguments
    class(input_layer_type), intent(inout) :: this
    !! Instance of the input layer
    integer, dimension(:), intent(in) :: input_shape
    !! Shape of the input data
    integer, optional, intent(in) :: verbose
    !! Verbosity level

    ! Local variables
    integer :: verbose_ = 0
    !! Verbosity level


    !---------------------------------------------------------------------------
    ! Initialise optional arguments
    !---------------------------------------------------------------------------
    if(present(verbose)) verbose_ = verbose


    !---------------------------------------------------------------------------
    ! Initialise input shape
    !---------------------------------------------------------------------------
    this%input_rank = size(input_shape, dim=1)
    this%output_rank = this%input_rank
    if(.not.allocated(this%input_shape)) call this%set_shape(input_shape)
    this%output_shape = this%input_shape
    this%num_outputs = product(this%input_shape)


    !---------------------------------------------------------------------------
    ! Allocate arrays
    !---------------------------------------------------------------------------
    this%input_rank = size(this%input_shape)
    this%output_rank = this%input_rank
    if(allocated(this%output)) deallocate(this%output)
    allocate(this%output(1,1))

  end subroutine init_input