Read ONNX attributes for dropout layer
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(dropout_layer_type), | intent(inout) | :: | this |
Instance of the dropout layer |
||
| type(onnx_node_type), | intent(in) | :: | node |
ONNX node information |
||
| type(onnx_initialiser_type), | intent(in), | dimension(:) | :: | initialisers |
ONNX initialiser information |
|
| type(onnx_tensor_type), | intent(in), | dimension(:) | :: | value_info |
ONNX value info |
|
| integer, | intent(in) | :: | verbose |
Verbosity level |
subroutine build_from_onnx_dropout( & this, node, initialisers, value_info, verbose & ) !! Read ONNX attributes for dropout layer implicit none ! Arguments class(dropout_layer_type), intent(inout) :: this !! Instance of the dropout layer type(onnx_node_type), intent(in) :: node !! ONNX node information type(onnx_initialiser_type), dimension(:), intent(in) :: initialisers !! ONNX initialiser information type(onnx_tensor_type), dimension(:), intent(in) :: value_info !! ONNX value info integer, intent(in) :: verbose !! Verbosity level ! Local variables integer :: i !! Loop index real(real32) :: rate !! Dropout rate integer :: num_masks !! Number of masks (batch size) character(256) :: val !! Attribute value ! Set default values rate = 0.5_real32 num_masks = 1 ! Parse ONNX attributes do i = 1, size(node%attributes) val = node%attributes(i)%val select case(trim(adjustl(node%attributes(i)%name))) case("ratio") read(val,*) rate case default ! Do nothing write(0,*) "WARNING: Unrecognised attribute in ONNX DROPOUT layer: ", & trim(adjustl(node%attributes(i)%name)) end select end do ! Check size of initialisers is zero if(size(initialisers).ne.0)then write(0,*) "WARNING: initialisers not used for ONNX DROPOUT layer" end if call this%set_hyperparams( & rate = rate, & num_masks = num_masks & ) end subroutine build_from_onnx_dropout