Initialise 3D dropblock layer
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(dropblock3d_layer_type), | intent(inout) | :: | this |
Instance of the 3D dropblock layer |
||
| integer, | intent(in), | dimension(:) | :: | input_shape |
Input shape |
|
| integer, | intent(in), | optional | :: | verbose |
Verbosity level |
subroutine init_dropblock3d(this, input_shape, verbose) !! Initialise 3D dropblock layer implicit none ! Arguments class(dropblock3d_layer_type), intent(inout) :: this !! Instance of the 3D dropblock 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 !--------------------------------------------------------------------------- this%num_channels = this%input_shape(4) allocate(this%output_shape(2)) this%output_shape = this%input_shape !--------------------------------------------------------------------------- ! set gamma !--------------------------------------------------------------------------- ! original paper uses keep_prob, we use drop_rate ! drop_rate = 1 - keep_prob this%gamma = ( this%rate/this%block_size**3._real32 ) * & this%input_shape(1) / & (this%input_shape(1) - this%block_size + 1._real32) * & this%input_shape(2) / & (this%input_shape(2) - this%block_size + 1._real32) * & this%input_shape(3) / & (this%input_shape(3) - this%block_size + 1._real32) allocate(this%mask( & this%input_shape(1), & this%input_shape(2), & this%input_shape(3)), source=.true.) !--------------------------------------------------------------------------- ! generate mask !--------------------------------------------------------------------------- call this%generate_mask() !--------------------------------------------------------------------------- ! Allocate arrays !--------------------------------------------------------------------------- if(this%use_graph_input)then call stop_program( & "Graph input not supported for 3D dropblock layer" & ) return end if if(allocated(this%output)) deallocate(this%output) allocate( this%output(1,1) ) end subroutine init_dropblock3d