def cast_various_to_minimum_dtype_gb(
    num_parts,
    indptr,
    indices,
    type_per_edge,
    etypes,
    ntypes,
    node_attributes,
    edge_attributes,
    part_meta=None,
    graph=None,
    edge_count=None,
    node_count=None,
    tot_edge_count=None,
    tot_node_count=None,
):
    """Cast various data to minimum dtype."""
    if graph is not None:
        assert part_meta is not None
        tot_edge_count = graph.num_edges()
        tot_node_count = graph.num_nodes()
        node_count = part_meta["num_nodes"]
        edge_count = part_meta["num_edges"]
    else:
        assert tot_edge_count is not None
        assert tot_node_count is not None
        assert edge_count is not None
        assert node_count is not None

    # Cast 1: indptr.
    indptr = _cast_to_minimum_dtype(tot_edge_count, indptr)
    # Cast 2: indices.
    indices = _cast_to_minimum_dtype(tot_node_count, indices)
    # Cast 3: type_per_edge.
    type_per_edge = _cast_to_minimum_dtype(
        len(etypes), type_per_edge, field=ETYPE
    )
    # Cast 4: node/edge_attributes.
    predicates = {
        NID: node_count,
        "part_id": num_parts,
        NTYPE: len(ntypes),
        EID: edge_count,
        ETYPE: len(etypes),
        DGL2GB_EID: edge_count,
        GB_DST_ID: node_count,
    }
    for attributes in [node_attributes, edge_attributes]:
        for key in attributes:
            if key not in predicates:
                continue
            attributes[key] = _cast_to_minimum_dtype(
                predicates[key], attributes[key], field=key
            )
    return indptr, indices, type_per_edge
Cast various data to minimum dtype.
python/dgl/distributed/partition.py