append_unique_onnx_expanded_prefix Subroutine

subroutine append_unique_onnx_expanded_prefix(prefix, prefixes)

Append a /layerN prefix to a list if it is not already present.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: prefix

Prefix to append

character(len=32), intent(inout), allocatable :: prefixes(:)

Prefix list updated in-place


Source Code

  subroutine append_unique_onnx_expanded_prefix(prefix, prefixes)
    !! Append a /layerN prefix to a list if it is not already present.
    implicit none

    ! Arguments
    character(*), intent(in) :: prefix
    !! Prefix to append
    character(32), allocatable, intent(inout) :: prefixes(:)
    !! Prefix list updated in-place

    ! Local variables
    integer :: i
    !! Loop index

    if(len_trim(prefix) .eq. 0) return

    do i = 1, size(prefixes)
       if(trim(prefixes(i)) .eq. trim(prefix)) return
    end do

    prefixes = [prefixes, prefix]

  end subroutine append_unique_onnx_expanded_prefix