def to_dlpack(tensor):
    """Return a dlpack tensor sharing the data.

    Parameters
    ----------
    tensor : dragon.Tensor
        The tensor to provide data.

    Returns
    -------
    PyCapsule
        The dlpack tensor.

    """
    return tensor._impl.ToDLPack(tensor.device.to_proto())