Forward propagation
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(dropout_layer_type), | intent(inout) | :: | this |
Instance of the dropout layer |
||
| class(array_type), | intent(in), | dimension(:,:) | :: | input |
Input values |
subroutine forward_dropout(this, input) !! Forward propagation implicit none ! Arguments class(dropout_layer_type), intent(inout) :: this !! Instance of the dropout layer class(array_type), dimension(:,:), intent(in) :: input !! Input values ! Local variables real(real32) :: rtmp1 !! Temporary variable type(array_type), pointer :: ptr !! Pointer array rtmp1 = 1._real32 - this%rate select case(this%inference) case(.true.) ! Do not perform the drop operation ptr => input(1,1) * rtmp1 case default ! Perform the drop operation this%idx = this%idx + 1 rtmp1 = 1._real32 / rtmp1 ptr => merge_over_channels( input(1,1), 0._real32, this%mask) * rtmp1 end select call this%output(1,1)%assign_and_deallocate_source(ptr) this%output(1,1)%is_temporary = .false. end subroutine forward_dropout