Read ONNX attributes for 3D max pooling layer
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(maxpool3d_layer_type), | intent(inout) | :: | this |
Instance of the 3D max pooling 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_maxpool3d( & this, node, initialisers, value_info, verbose & ) !! Read ONNX attributes for 3D max pooling layer implicit none ! Arguments class(maxpool3d_layer_type), intent(inout) :: this !! Instance of the 3D max pooling 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 integer, dimension(3) :: stride, pool_size, padding !! Stride, kernel size, and padding character(256) :: val !! Attribute value character(20) :: padding_method !! Padding method ! Set default values stride = 1 pool_size = 2 padding = 0 do i = 1, size(node%attributes) val = node%attributes(i)%val select case(trim(adjustl(node%attributes(i)%name))) case("kernel_shape") read(val,*) pool_size case("strides") read(val,*) stride case("pads") read(val,*) padding case default ! Do nothing write(0,*) "WARNING: Unrecognised attribute in ONNX MAXPOOL3D ", & "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 MAXPOOL3D layer" end if ! Convert integer padding to character method if(any(padding.gt.0))then padding_method = "constant" else padding_method = "valid" end if call this%set_hyperparams( & stride = stride, & pool_size = pool_size, & padding = padding_method & ) end subroutine build_from_onnx_maxpool3d