def load_cfg(filename):
    """Load net structure config.
    Paramaters
    ----------
    filename : net structure config file(*.cfg).

    Return
    ----------
    List. lst[i] represent the ith layer's parameters.

    Examples
    ----------
    config file:
    [net]
    batch=1
    subdivisions=1
    [convolutional]
    ...

    blocks:
    blocks[0]['type'] = 'net'
    blocks[0]['batch'] = 1
    blocks[0]['subdivisions'] = 1
    blocks[1]['type'] = convolutional
    """
    blocks = []
    block = {}
    with open(filename, 'r') as f:
        lines = f.readlines()
    for line in lines:
        line = line.strip(' \n')
        # Get rid of blank line and comment.
        if len(line) == 0 or line[0] == '#':
            continue
        if line[0] == "[":
            if len(block) != 0:
                blocks.append(block)
                block = {}
            block["type"] = line[1:-1].strip()
        else:
            key, value = line.split('=')
            block[key.strip()] = value.strip()
    if len(block) != 0:
        blocks.append(block)
    return blocks