Skip to content

optype.dlpack

A collection of low-level types for working DLPack.

Protocols

type signature bound method
CanDLPack[
    +T = int,
    +D: int = int,
]
def __dlpack__(
    *,
    stream: int | None = ...,
    max_version: tuple[int, int] | None = ...,
    dl_device: tuple[T, D] | None = ...,
    copy: bool | None = ...,
) -> types.CapsuleType: ...
CanDLPackDevice[
    +T = int,
    +D: int = int,
]
def __dlpack_device__() -> tuple[T, D]: ...

The + prefix indicates that the type parameter is covariant.

Enums

There are also two convenient IntEnums in optype.dlpack:

  • DLDeviceType for the device types, and
  • DLDataTypeCode for the internal type-codes of the DLPack data types.