(arch_def)
return ret
unify the arch_def to:
        {
            ...,
            "arch": [
                {
                    "stage_idx": idx,
                    "block_idx": idx,
                    ...
                },
                {}, ...
            ]
        }
unify the arch_def to:
        {
            ...,
            "arch": [
                {
                    "stage_idx": idx,
                    "block_idx": idx,
                    ...
                },
                {}, ...
            ]
        }
unify the arch_def to : { ... arch : [ { stage_idx : idx block_idx : idx ... } {} ... ] }
def unify_arch_def(arch_def):
    """ unify the arch_def to:
        {
            ...,
            "arch": [
                {
                    "stage_idx": idx,
                    "block_idx": idx,
                    ...
                },
                {}, ...
            ]
        }
    """
    ret = copy.deepcopy(arch_def)

    assert "block_cfg" in arch_def and "stages" in arch_def["block_cfg"]
    assert "stages" not in ret
    # copy 'first', 'last' etc. inside arch_def['block_cfg'] to ret
    ret.update({x: arch_def["block_cfg"][x] for x in arch_def["block_cfg"]})
    ret["stages"] = _block_cfgs_to_list(arch_def["block_cfg"]["stages"])
    del ret["block_cfg"]

    assert "block_op_type" in arch_def
    _add_to_arch(ret["stages"], arch_def["block_op_type"], "block_op_type")
    del ret["block_op_type"]

    return ret
def unify_arch_def ( arch_def ) : ret = copy . deepcopy ( arch_def ) assert "block_cfg" in arch_def and "stages" in arch_def [ "block_cfg" ] assert "stages" not in ret # copy 'first', 'last' etc. inside arch_def['block_cfg'] to ret ret . update ( { x : arch_def [ "block_cfg" ] [ x ] for x in arch_def [ "block_cfg" ] } ) ret [ "stages" ] = _block_cfgs_to_list ( arch_def [ "block_cfg" ] [ "stages" ] ) del ret [ "block_cfg" ] assert "block_op_type" in arch_def _add_to_arch ( ret [ "stages" ] , arch_def [ "block_op_type" ] , "block_op_type" ) del ret [ "block_op_type" ] return ret