runtime-modeling/models.py
def _decode_block_string(self, block_string):
    """Gets a MNasNet block through a string notation of arguments.

    E.g. r2_k3_s2_e1_i32_o16_se0.25_noskip: r - number of repeat blocks,
    k - kernel size, s - strides (1-9), e - expansion ratio, i - input filters,
    o - output filters, se - squeeze/excitation ratio

    Args:
      block_string: a string, a string representation of block arguments.

    Returns:
      A BlockArgs instance.
    Raises:
      ValueError: if the strides option is not correctly specified.
    """
    assert isinstance(block_string, str)
    ops = block_string.split('_')
    options = {}
    for op in ops:
      splits = re.split(r'(\d.*)', op)
      if len(splits) >= 2:
        key, value = splits[:2]
        options[key] = value

    if 's' not in options or len(options['s']) != 2:
      raise ValueError('Strides options should be a pair of integers.')

    return model_def.BlockArgs(
        kernel_size=int(options['k']),
        num_repeat=int(options['r']),
        input_filters=int(options['i']),
        output_filters=int(options['o']),
        expand_ratio=int(options['e']),
        id_skip=('noskip' not in block_string),
        se_ratio=float(options['se']) if 'se' in options else None,
        strides=[int(options['s'][0]), int(options['s'][1])])
Gets a MNasNet block through a string notation of arguments.

    E.g. r2_k3_s2_e1_i32_o16_se0.25_noskip: r - number of repeat blocks,
    k - kernel size, s - strides (1-9), e - expansion ratio, i - input filters,
    o - output filters, se - squeeze/excitation ratio

    Args:
      block_string: a string, a string representation of block arguments.

    Returns:
      A BlockArgs instance.
    Raises:
      ValueError: if the strides option is not correctly specified.
    
Gets a MNasNet block through a string notation of arguments.
Gets a MNasNet block through a string notation of arguments .
def _decode_block_string(self, block_string):
    assert isinstance(block_string, str)
    ops = block_string.split('_')
    options = {}
    for op in ops:
      splits = re.split(r'(\d.*)', op)
      if len(splits) >= 2:
        key, value = splits[:2]
        options[key] = value
    if 's' not in options or len(options['s']) != 2:
      raise ValueError('Strides options should be a pair of integers.')
    return model_def.BlockArgs(
        kernel_size=int(options['k']),
        num_repeat=int(options['r']),
        input_filters=int(options['i']),
        output_filters=int(options['o']),
        expand_ratio=int(options['e']),
        id_skip=('noskip' not in block_string),
        se_ratio=float(options['se']) if 'se' in options else None,
        strides=[int(options['s'][0]), int(options['s'][1])])
def _decode_block_string ( self , block_string ) : assert isinstance ( block_string , str ) ops = block_string . split ( '_' ) options = { } for op in ops : splits = re . split ( r'(\d.*)' , op ) if len ( splits ) >= 2 : key , value = splits [ : 2 ] options [ key ] = value if 's' not in options or len ( options [ 's' ] ) != 2 : raise ValueError ( 'Strides options should be a pair of integers.' ) return model_def . BlockArgs ( kernel_size = int ( options [ 'k' ] ) , num_repeat = int ( options [ 'r' ] ) , input_filters = int ( options [ 'i' ] ) , output_filters = int ( options [ 'o' ] ) , expand_ratio = int ( options [ 'e' ] ) , id_skip = ( 'noskip' not in block_string ) , se_ratio = float ( options [ 'se' ] ) if 'se' in options else None , strides = [ int ( options [ 's' ] [ 0 ] ) , int ( options [ 's' ] [ 1 ] ) ] )
Gets a MNasNet block through a string notation of arguments.
Gets a MNasNet block through a string notation of arguments .
"""Gets a MNasNet block through a string notation of arguments.

    E.g. r2_k3_s2_e1_i32_o16_se0.25_noskip: r - number of repeat blocks,
    k - kernel size, s - strides (1-9), e - expansion ratio, i - input filters,
    o - output filters, se - squeeze/excitation ratio

    Args:
      block_string: a string, a string representation of block arguments.

    Returns:
      A BlockArgs instance.
    Raises:
      ValueError: if the strides option is not correctly specified.
    """
A BlockArgs instance.
A BlockArgs instance .
if the strides option is not correctly specified.
if the strides option is not correctly specified .
ValueError
self
block_string
a string, a string representation of block arguments.
a string a string representation of block arguments .