+
    Pj!                         ^ RI Ht ^ RIt^ RIt^ RIHt ^ RIHt	 RR.t
 ! R R]P                  4      t]P                  P                  ]R4       R	RR
R/R R lltR# )    )AnyN)
_to_dlpack)DeviceDLDeviceTypefrom_dlpackc                   R    ] tR t^tRtRtRtRtRtRt	R	t
R
tRtRtRtRtRtRtRtRtR# )r    N)   )   )   )   )   )   )	   )
   )   )   )   )   )   )   )   )__name__
__module____qualname____firstlineno__kDLCPUkDLCUDAkDLCUDAHost	kDLOpenCL	kDLVulkankDLMetalkDLVPIkDLROCMkDLROCMHost	kDLExtDevkDLCUDAManaged	kDLOneAPI	kDLWebGPU
kDLHexagonkDLMAIA__static_attributes__r	       k/Users/ahmed/devFolder/Ultron/claude-voice/gateway/.venv/lib/python3.14/site-packages/torch/utils/dlpack.pyr   r      sM    FGKIIHFGKINIIJGr-   a  to_dlpack(tensor) -> PyCapsule

Returns an opaque object (a "DLPack capsule") representing the tensor.

.. note::
  ``to_dlpack`` is a legacy DLPack interface. The capsule it returns
  cannot be used for anything in Python other than use it as input to
  ``from_dlpack``. The more idiomatic use of DLPack is to call
  ``from_dlpack`` directly on the tensor object - this works when that
  object has a ``__dlpack__`` method, which PyTorch and most other
  libraries indeed have now.

.. warning::
  Only call ``from_dlpack`` once per capsule produced with ``to_dlpack``.
  Behavior when a capsule is consumed multiple times is undefined.

Args:
    tensor: a tensor to be exported

The DLPack capsule shares the tensor's memory.
devicecopyc                \    V ^8  d   QhR\         R\        R,          R\        R,          RR/# )r   
ext_tensorr/   Nr0   returnztorch.Tensor)r   _Devicebool)formats   "r.   __annotate__r7   :   s@     m- m-m- dNm- +	m-
 m-r-   c                  \        V R4      '       Edg   / pRVR&   TpRpRpVe   W#R&   V P                  4       pVe   \        V\        4      '       d   \        P
                  ! V4      p\        V\        P
                  4      '       g   \        R\        V4       24      h\        P                  P                  V4      pWx8g  pV'       g   WR&   V'       d   VRJ d   \        R	V R
V R24      hV^ ,          \        P                  \        P                  39   do   \        P                  P                  RV^,           24      p	V^ ,          \        P                  8H  p
V
'       d   V	P                   ^ 8X  d   ^MV	P                   pWR&   Rp V P"                  ! R/ VB pVf&   VP'                  RR4        V P"                  ! R/ VB pVf(   VP'                  RR4       Rp V P"                  ! R/ VB pVf%   VP'                  RR4       V P"                  ! R/ VB p\        P                  P)                  V4      pVRJ d!   V'       g   V'       g   VP+                  4       pV'       d   VP-                  V4      pV# Vf   Ve   \        R4      hT p\        P                  P)                  V4      #   \$         d     ELi ; i  \$         d     ELi ; i  \$         d     Li ; i)a	  from_dlpack(ext_tensor) -> Tensor

Converts a tensor from an external library into a ``torch.Tensor``.

The returned PyTorch tensor will share the memory with the input tensor
(which may have come from another library). Note that in-place operations
will therefore also affect the data of the input tensor. This may lead to
unexpected issues (e.g., other libraries may have read-only flags or
immutable data structures), so the user should only do this if they know
for sure that this is fine.

Args:
    ext_tensor (object with ``__dlpack__`` attribute, or a DLPack capsule):
        The tensor or DLPack capsule to convert.

        If ``ext_tensor`` is a tensor (or ndarray) object, it must support
        the ``__dlpack__`` protocol (i.e., have a ``ext_tensor.__dlpack__``
        method). Otherwise ``ext_tensor`` may be a DLPack capsule, which is
        an opaque ``PyCapsule`` instance, typically produced by a
        ``to_dlpack`` function or method.

    device (torch.device or str or None): An optional PyTorch device
        specifying where to place the new tensor. If None (default), the
        new tensor will be on the same device as ``ext_tensor``.

    copy (bool or None): An optional boolean indicating whether or not to copy
        ``self``. If None, PyTorch will copy only if necessary.

Examples::

    >>> import torch.utils.dlpack
    >>> t = torch.arange(4)

    # Convert a tensor directly (supported in PyTorch >= 1.10)
    >>> t2 = torch.from_dlpack(t)
    >>> t2[:2] = -1  # show that memory is shared
    >>> t2
    tensor([-1, -1,  2,  3])
    >>> t
    tensor([-1, -1,  2,  3])

    # The old-style DLPack usage, with an intermediate capsule object
    >>> capsule = torch.utils.dlpack.to_dlpack(t)
    >>> capsule
    <capsule object "dltensor" at ...>
    >>> t3 = torch.from_dlpack(capsule)
    >>> t3
    tensor([-1, -1,  2,  3])
    >>> t3[0] = -9  # now we're sharing memory between 3 tensors
    >>> t3
    tensor([-9, -1,  2,  3])
    >>> t2
    tensor([-9, -1,  2,  3])
    >>> t
    tensor([-9, -1,  2,  3])


__dlpack__max_versionTFNr0   z&from_dlpack: unsupported device type: 	dl_devicez&cannot move DLPack tensor from device z to z- without copying. Set copy=None or copy=True.zcuda:streamzQdevice and copy kwargs not supported when ext_tensor is already a DLPack capsule.)r
   r   r	   )hasattr__dlpack_device__
isinstancestrtorchr/   AssertionErrortype_C_torchDeviceToDLDevice
ValueErrorr   r   r$   cudacurrent_streamcuda_streamr9   	TypeErrorpop_from_dlpackcloneto)r2   r/   r0   kwargsrequested_copyproducer_handled_copycross_device_transfer
ext_devicetarget_dl_devicer<   is_cuda
stream_ptrdlpacktensors   &$$           r.   r   r   :   s   @ z<(( "$ &}  $ %!6N  113
&#&&f-fell33$'MdSYl^%\]]  %xx>>vF &0%C! )&6{# % <ZLM]L^ _C C  a=\11<3G3GHHZZ..z!}o/FGF !m|';';;G &&*<*<*AvGYGYJ)8 	**4V4F
 >JJ}d+#..88
 >JJvt$$)!#..88
 >JJ{D)**4V4F&&v. T!*?H]\\^F !YYv&F !1 c  xx$$V,,Y  		    s6   J. 5K   K .J=<J= KKK K )typingr   rA   enumtorch._Cr   	to_dlpacktorch.typesr   r4   __all__IntEnumr   rD   _add_docstrr   r	   r-   r.   <module>ra      sp       , ) 
4<< &   Y ! 2m- "m- 	m- m-r-   