def dtype_of(data):
    """Return the dtype of the data which can be either a tensor or a dict of tensors."""
    return F.dtype(
        next(iter(data.values())) if isinstance(data, Mapping) else data
    )
Return the dtype of the data which can be either a tensor or a dict of tensors.
python/dgl/utils/internal.py