def _format_partition(graph, graph_format):
    """Format the partition to the specified format."""
    if isinstance(graph, gb.FusedCSCSamplingGraph):
        return graph
    # formatting dtype
    # TODO(Rui) Formatting forcely is not a perfect solution.
    #   We'd better store all dtypes when mapping to shared memory
    #   and map back with original dtypes.
    for k, dtype in RESERVED_FIELD_DTYPE.items():
        if k in graph.ndata:
            graph.ndata[k] = F.astype(graph.ndata[k], dtype)
        if k in graph.edata:
            graph.edata[k] = F.astype(graph.edata[k], dtype)
    # Create the graph formats specified the users.
    print(
        "Start to create specified graph formats which may take "
        "non-trivial time."
    )
    graph = graph.formats(graph_format)
    graph.create_formats_()
    print(f"Finished creating specified graph formats: {graph_format}")
    return graph
Format the partition to the specified format.
python/dgl/distributed/dist_graph.py