# This file was generated by stubgen-pyx v0.2.19 from cuda_core/cuda/core/_dlpack.pyx

from enum import IntEnum
from typing import Any, Callable, TypeAlias, TypedDict

_DLDeviceType: TypeAlias = int
DLDataTypeCode: TypeAlias = int

class DLDeviceType(IntEnum):
    kDLCPU = 1
    kDLCUDA = 2
    kDLCUDAHost = 3
    kDLCUDAManaged = 13

class DLDevice(TypedDict):
    device_type: _DLDeviceType
    device_id: int

class DLDataType(TypedDict):
    code: int
    bits: int
    lanes: int

class DLTensor(TypedDict):
    data: None
    device: DLDevice
    ndim: int
    dtype: DLDataType
    shape: int
    strides: int
    byte_offset: int

class DLManagedTensor(TypedDict):
    dl_tensor: DLTensor
    manager_ctx: None
    deleter: Callable[..., Any]

class DLPackVersion(TypedDict):
    major: int
    minor: int

class DLManagedTensorVersioned(TypedDict):
    version: DLPackVersion
    manager_ctx: None
    deleter: Callable[..., Any]
    flags: int
    dl_tensor: DLTensor

class DLPackExchangeAPIHeader(TypedDict):
    version: DLPackVersion
    prev_api: DLPackExchangeAPIHeader

class DLPackExchangeAPI(TypedDict):
    header: DLPackExchangeAPIHeader
    managed_tensor_allocator: ...
    managed_tensor_from_py_object_no_sync: ...
    managed_tensor_to_py_object_no_sync: ...
    dltensor_from_py_object_no_sync: ...
    current_work_stream: ...

def classify_dl_device(buf: object) -> tuple[int, int]:
    """Classify a buffer into a DLPack (device_type, device_id) pair.

    ``buf`` must expose ``is_device_accessible``, ``is_host_accessible``,
    ``is_managed``, and ``device_id`` attributes.
    """
def make_py_capsule(buf: object, versioned: bool) -> object: ...
