Initialise dropout layer
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(dropout_layer_type), | intent(inout) | :: | this |
Instance of the dropout layer |
||
| integer, | intent(in), | dimension(:) | :: | input_shape |
Input shape |
|
| integer, | intent(in), | optional | :: | verbose |
Verbosity level |
subroutine init_dropout(this, input_shape, verbose) !! Initialise dropout layer implicit none ! Arguments class(dropout_layer_type), intent(inout) :: this !! Instance of the dropout layer integer, dimension(:), intent(in) :: input_shape !! Input shape 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 !--------------------------------------------------------------------------- if(.not.allocated(this%input_shape)) call this%set_shape(input_shape) !--------------------------------------------------------------------------- ! Set up number of channels, width, height !--------------------------------------------------------------------------- allocate(this%output_shape(2)) this%output_shape = this%input_shape !--------------------------------------------------------------------------- ! Allocate mask !--------------------------------------------------------------------------- allocate(this%mask(this%input_shape(1), this%num_masks), source=.true.) !--------------------------------------------------------------------------- ! Generate mask !--------------------------------------------------------------------------- call this%generate_mask() !--------------------------------------------------------------------------- ! Generate mask !--------------------------------------------------------------------------- if(this%use_graph_input)then call stop_program( & "Graph input not supported for dropout layer" & ) return end if if(allocated(this%output)) deallocate(this%output) allocate( this%output(1,1) ) end subroutine init_dropout