    def from_dict(dag: Dict[str, Any]):
        """Return a DAGRepr from a dag dictionary.

        Args:
            dag (`str`): The dag dictionary.

        Returns:
            DAGRepr
        """
        dag_dict = deepcopy(dag)
        for uid, node in dag_dict.items():
            if node['op_info']['type'] == OPType.PIPELINE:
                DAGRepr.rebuild_dag(dag, uid, node['op_info'], node['iter_info'], node['inputs'], node['outputs'])

        def _get_name(val):
            if val['op_info']['type'] == OPType.CALLABLE:
                if isinstance(val['op_info']['operator'], types.FunctionType):
                    name = val['op_info']['operator'].__name__
                else:
                    name = type(val['op_info']['operator']).__name__
            elif val['op_info']['type'] == OPType.LAMBDA:
                name = 'lambda'
            elif val['op_info']['type'] in [OPType.HUB, OPType.BUILTIN]:
                fn = val['op_info']['operator']
                if isinstance(fn, str):
                    name = fn
                else:
                    name = fn.__class__.__name__

            return name

        nodes = {}
        node_index = 0
        for key, val in dag.items():
            # Deal with AutoConfig
            if 'config' in val and val['config'] is not None and isinstance(val['config'], TowheeConfig):
                val['config'] = val['config'].config
                assert isinstance(val['config'], dict)

            # Deal with input and output.
            if key in [InputConst.name, OutputConst.name]:
                val['config'] = {'name': key}

            # Concat nodes does not have op_info.
            elif val['iter_info']['type'] == ConcatConst.name:
                val['config'] = {'name': 'concat-' + str(node_index)}
                node_index += 1

            # If config does not specified.
            elif 'config' not in val or not val['config']:
                name = _get_name(val)
                val['config'] = {'name': name + '-' + str(node_index)}
                node_index += 1

            # Process dict config.
            elif isinstance(val['config'], dict):
                if 'name' not in val['config']:
                    name = _get_name(val)
                    val['config']['name'] = name + '-' + str(node_index)
                elif val['config']['name'] in [InputConst.name, OutputConst.name]:
                    val['config']['name'] = val['config']['name'] + '-' + str(node_index)
                node_index += 1

            nodes[key] = NodeRepr(uid=key, **val)
        top_sort = DAGRepr.get_top_sort(nodes)
        DAGRepr.check_nodes(nodes, top_sort)
        dag_nodes, schema_edges = DAGRepr.set_edges(nodes, top_sort)
        return DAGRepr(nodes=dag_nodes, edges=schema_edges, dag_dict=dag, top_list=top_sort)
Return a DAGRepr from a dag dictionary.

Args:
dag (`str`): The dag dictionary.

Returns:
DAGRepr
towhee/runtime/dag_repr.py