def data_dict_to_list(graph, data_dict, func, target):
    """Get node or edge feature data of the given name for all the types.

    Parameters
    -------------
    graph :  DGLGraph
        The input graph.
    data_dict : dict[str, Tensor] or dict[(str, str, str), Tensor]] or Tensor
        Node or edge data stored in DGLGraph. The key of the dictionary
        is the node type name or edge type name. If there is only single source
        node type, data_dict is the value of feature(a Tensor) not a dict.
    func : dgl.function.BaseMessageFunction
        Built-in message function.
    target : 'u', 'v' or 'e'
        The target of the lhs or rhs data

    Returns
    --------
    data_list : list(Tensor)
        Feature data stored in a list of tensors. The i^th tensor stores the feature
        data of type ``types[i]``.
    """
    if isinstance(func, fn.BinaryMessageFunction):
        if target in ["u", "v"]:
            output_list = [None] * graph._graph.number_of_ntypes()
            # If there is only single source node type, data_dict should be the value of
            # feature, namely, a tensor.
            if not isinstance(data_dict, dict):
                src_id, dst_id = graph._graph.metagraph.find_edge(0)
                if target == "u":
                    output_list[src_id] = data_dict
                else:
                    output_list[dst_id] = data_dict
            else:
                for srctype, _, dsttype in graph.canonical_etypes:
                    if target == "u":
                        src_id = graph.get_ntype_id(srctype)
                        output_list[src_id] = data_dict[srctype]
                    else:
                        dst_id = graph.get_ntype_id(dsttype)
                        output_list[dst_id] = data_dict[dsttype]
        else:  # target == 'e'
            output_list = [None] * graph._graph.number_of_etypes()
            for rel in graph.canonical_etypes:
                etid = graph.get_etype_id(rel)
                output_list[etid] = data_dict[rel]
        return output_list
    else:
        if target == "u":
            lhs_list = [None] * graph._graph.number_of_ntypes()
            if not isinstance(data_dict, dict):
                src_id, _ = graph._graph.metagraph.find_edge(0)
                lhs_list[src_id] = data_dict
            else:
                for srctype, _, _ in graph.canonical_etypes:
                    src_id = graph.get_ntype_id(srctype)
                    lhs_list[src_id] = data_dict[srctype]
            return lhs_list
        else:  # target == 'e':
            rhs_list = [None] * graph._graph.number_of_etypes()
            for rel in graph.canonical_etypes:
                etid = graph.get_etype_id(rel)
                rhs_list[etid] = data_dict[rel]
            return rhs_list
Get node or edge feature data of the given name for all the types.

    Parameters
    -------------
    graph :  DGLGraph
        The input graph.
    data_dict : dict[str, Tensor] or dict[(str, str, str), Tensor]] or Tensor
        Node or edge data stored in DGLGraph. The key of the dictionary
        is the node type name or edge type name. If there is only single source
        node type, data_dict is the value of feature(a Tensor) not a dict.
    func : dgl.function.BaseMessageFunction
        Built-in message function.
    target : 'u', 'v' or 'e'
        The target of the lhs or rhs data

    Returns
    --------
    data_list : list(Tensor)
        Feature data stored in a list of tensors. The i^th tensor stores the feature
        data of type ``types[i]``.
    
python/dgl/core.py