a
    –¥»aßy  ã                   @   sz
  U d Z ddlZddlZddlZddlZddlZddlZddlmZ ej	dk rTe
dƒ‚ddlmZ ddlmZmZmZmZ ejd	krˆd
ZnddlmZ ddlmZ ddlmZmZmZ g d¢Zejdk�rîe dd¡Zej  ej!dd¡Z"ej  ej #e$¡d¡Z%ej!ej&k�rej  ej&dd¡Z'ndZ'e(e)ejj*e%e"e'gƒƒZ+e,dd„ e+D ƒƒ�rtej  e dej  edd¡¡dd¡Z-ndZ-ddl.m/Z0 ddl1Z1e0�rèe,dd„ e+D ƒƒ�rèe0 2dd¡Z3d e3 Z4ej  ed!d"d#e0 ¡Z5ej  e e4e5¡d¡Z6ndZ6e+ 7e)ejj*e-e6gƒ¡ ej8d$d%d&�Z9e:e9d'ƒZ;e9 <d¡Z=ej>e9j?_@e;�rJej>e9jA_@ej>e9jB_@e+D ]`ZCej	d(k�rje DeC¡ nBe;�rNe9 AeC¡ZEeEdu �rNe Fe G¡ ¡ZHeH jId)eC› d*�7  _IeH‚�qNz"e Jd+¡ e Jd,¡ e Jd-¡ W n eK�yî   eLd.ƒ Y n0 e1 1ej  e%d/¡¡ZMd0ZNeMD ]ÖZOd0ZPe;�rxe9 BeOdd1¡ZEe G¡ ZQeEdu �rjeQd2k�rje FeQ¡ZHeH jId3eO› d4�7  _IeH‚neEdu�rxd%ZPeP�seN�s¤d5  e+ejRd6 g ¡ejRd6< d%ZNe9 ?eO¡ZEeEdu �re Fe G¡ ¡ZHeH jId3eO› d4�7  _IeH‚�qe9 <e=¡ d7d8„ ZSe�se d9¡�r–e T¡ d:k�r–ddlZUe:eUd;ƒ�r6e:eUd<ƒ�sdzddlVZUW n  eW�yb   ddlXmYZU Y n0 e Z¡ Z[e \eUj]eUj^B ¡ dd=l_T e \e[¡ [[[Une�r¢eSƒ  dd=l_T e�r¼ddl_m`Z` zdd>l_maZa W nN eW�y   ddl_m`Zb ej	d?k�rebj$du �reWe cd@¡ d¡ ƒd‚‚ Y n0 edAd„ eee`ƒD ƒ7 Ze�s†eee`ƒD ]DZfege`efƒZheiehƒeie`ƒu �r@dBef› �ejjv�r@ehejjdBef› �< �q@dCdD„ ZkdEdF„ ZldGdH„ ZmdIdJ„ ZndKdL„ ZodMdN„ ZpdOdP„ ZqdQdR„ ZrdSdT„ ZsddUltmuZumvZvmwZwmxZx e 7g dV¢¡ ddWlymzZz ddXl{m|Z| G dYdZ„ dZe`j}e|ƒZ~G d[d\„ d\e`je|ƒZ€G d]d^„ d^e`j�e|ƒZ‚G d_d`„ d`e`jƒe|ƒZ„G dadb„ dbe`j…e|ƒZ†G dcdd„ dde`j‡e|ƒZˆG dedf„ dfe`j‰e|ƒZŠG dgdh„ dhe`j‹e|ƒZŒG didj„ dje`j�e|ƒZŽG dkdl„ dle`j�e|ƒZ�G dmdn„ dne`j‘e|ƒZ’G dodp„ dpe`j“e|ƒZ”G dqdr„ dre`j•e|ƒZ–G dsdt„ dte`j—e|ƒZ˜G dudv„ dve`j™e|ƒZšG dwdx„ dxe`j›e|ƒZœe~e€e„e†eˆeŠeŒe‚eŽe–e˜eše�e”e’eœhZ�ežƒ ZŸee e dy< ddzl¡m¢Z¢m£Z£m¤Z¤m¥Z¥m¦Z¦ dd{l§m¨Z¨m©Z© dd|lªm«Z« d}d~„ Z¬e` ae¬ƒ ¡ [¬e�rÞdd=l­T dZ®eee`j¯ƒD ]<Z°e° ±d€¡�sìe°e®v �r
�qìege`j¯e°ƒe²ƒ e°< e ³e°¡ �qìdd=l´T [}[[ƒ[…[‡[‰[‹[�[•[�[‘[“[›d�d‚„ Zµddl¶m/Z/ ddƒl¶m·Z· dd„l¶m¸Z¸ dd…l¹mºZºm»Z»m¼Z¼m½Z½ dd†l¶m¾Z¾ dd‡l¶m¿Z¿ ddˆl¶mÀZÀ ddlÁZ¶ddlÂZ¶ddlÃZ¶dd‰l¶mÄZÄ ddŠl¶mÅZÅ ddlÆZ¶dd‹l¶mÇZÇ ddŒl¶mÈZÈ dd�l¶mÉZÉ ddlÊZ¶ddŽl¶mËZË dd�l¶mÌZÌ dd�l¶mÍZÍ dd‘l¶mÎZÎ dd’l¶m¡Z¡ dd“l¶mÏZÏ dd”l¶mÐZÐ ddlÑZ¶ddlÒZ¶ddlÓZ¶ddlÔZ¶ddlÕZ¶dd•l¶mÖZÖ ddl×Z¶dd–l¶mØZØ dd—l¶mÙZÙ dd˜l¶mÚZÚ e` Ûe(e¶j�ƒ¡ dd™lÜmÝZÝmÞZÞmßZß [Ý[Þ[ßdšd›„ ZàddœlámâZâ dd�lãmäZä ddžl¶måZå eæZçddŸlèméZé eée¶jêƒ [édd lëmìZì e¶jâjíjîZîe¶jâjíjïZïdd¡lðmñZñmòZò d¢d£„ ZódS )¤a  
The torch package contains data structures for multi-dimensional
tensors and defines mathematical operations over these tensors.
Additionally, it provides many utilities for efficient serializing of
Tensors and arbitrary types, and other useful utilities.

It has a CUDA counterpart, that enables you to run your tensor computations
on an NVIDIA GPU with compute capability >= 3.0.
é    Né   )Úautocast)é   zGPython 2 has reached end-of-life and is no longer supported by PyTorch.)Ú_import_dotted_name)Úget_file_pathÚ#prepare_multiprocessing_environmentÚUSE_RTLD_GLOBAL_WITH_LIBTORCHÚUSE_GLOBAL_DEPSÚtorch_deployztorch-deploy-1.8)Ú__version__)Ústring_classes)ÚSetÚTypeÚTYPE_CHECKING)+ÚtypenameÚ	is_tensorÚ
is_storageÚset_default_tensor_typeÚset_rng_stateÚget_rng_stateÚmanual_seedÚinitial_seedÚseedÚsaveÚloadÚset_printoptionsÚchunkÚsplitÚstackÚmatmulÚno_gradÚenable_gradZrandZrandnÚinference_modeÚDoubleStorageÚFloatStorageÚLongStorageÚ
IntStorageÚShortStorageÚCharStorageÚByteStorageÚBoolStorageZDoubleTensorZFloatTensorZ
LongTensorZ	IntTensorZShortTensorZ
CharTensorZ
ByteTensorZ
BoolTensorÚTensorÚlobpcgÚuse_deterministic_algorithmsÚ$are_deterministic_algorithms_enabledÚset_warn_alwaysÚis_warn_always_enabledÚwin32ZProgramFileszC:\Program FilesÚLibraryÚbinÚlibÚ c                 C   s$   g | ]}t j t j |d ¡¡ ‘qS )znvToolsExt64_1.dll)ÚosÚpathÚexistsÚjoin©Ú.0Úp© r=   úH/home/yuhw/wc/pochoir/venv/lib/python3.9/site-packages/torch/__init__.pyÚ
<listcomp>E   ó    r?   ZNVTOOLSEXT_PATHzNVIDIA CorporationZ
NvToolsExtÚx64)Úcudac                 C   s"   g | ]}t   tj |d ¡¡ ‘qS )zcudart64*.dll)Úglobr6   r7   r9   r:   r=   r=   r>   r?   M   r@   Ú.Ú_ZCUDA_PATH_VzNVIDIA GPU Computing ToolkitZCUDAÚvzkernel32.dllT)Úuse_last_errorÚAddDllDirectory)r   é   z Error adding "z" to the DLL directories.zvcruntime140.dllzmsvcp140.dllzvcruntime140_1.dllzµMicrosoft Visual C++ Redistributable is not installed, this may lead to the DLL load failure.
                 It can be downloaded at https://aka.ms/vs/16/release/vc_redist.x64.exez*.dllFi   é~   z Error loading "z" or one of its dependencies.ú;ÚPATHc                  C   sj   t  ¡ dkstjdkrd S dt  ¡ dkr,dnd } tj t¡}tj tj 	|¡d| ¡}t
j|t
jd� d S )	NÚWindowsr
   Zlibtorch_global_depsÚDarwinz.dylibz.sor4   ©Úmode)ÚplatformÚsystemÚsysÚ
executabler6   r7   ÚabspathÚ__file__r9   ÚdirnameÚctypesÚCDLLÚRTLD_GLOBAL)Zlib_nameÚhereZlib_pathr=   r=   r>   Ú_load_global_deps�   s    r\   ZTORCH_USE_RTLD_GLOBALrM   rZ   Ú	RTLD_LAZY)Ú*)Ú_initExtension)r   é   a’  
            Failed to load PyTorch C extensions:
                It appears that PyTorch has loaded the `torch/_C` folder
                of the PyTorch repository rather than the C extensions which
                are expected in the `torch._C` namespace. This can occur when
                using the `install` workflow. e.g.
                    $ python setup.py install && python -c "import torch"

                This error can generally be solved using the `develop` workflow
                    $ python setup.py develop && python -c "import torch"  # This should succeed
                or by running Python from a different directory.
            c                 C   s&   g | ]}|d  dkr|  d¡s|‘qS )r   rE   ZBase)Úendswith)r;   Únamer=   r=   r>   r?   å   s   
þz	torch._C.c                 C   s‚   t | tjƒr|  ¡ S d}d}t| dƒrN| jdkrN| jdkrN| jd urN| jd }t| dƒr`| j}nt| dƒrr| j}n| jj}|| S )Nr5   Ú
__module__ÚbuiltinsÚ__builtin__rD   Ú__qualname__Ú__name__)	Ú
isinstanceÚtorchr+   ÚtypeÚhasattrrc   rf   rg   Ú	__class__)ÚoÚmoduleÚ
class_namer=   r=   r>   r   û   s     ÿÿ


r   c                 C   s   t | tjƒS )a©  Returns True if `obj` is a PyTorch tensor.

    Note that this function is simply doing ``isinstance(obj, Tensor)``.
    Using that ``isinstance`` check is better for typechecking with mypy,
    and more explicit - so it's recommended to use that instead of
    ``is_tensor``.

    Args:
        obj (Object): Object to test
    Example::

        >>> x=torch.tensor([1,2,3])
        >>> torch.is_tensor(x)
        True

    )rh   ri   r+   ©Úobjr=   r=   r>   r     s    r   c                 C   s   t | ƒtv S )zgReturns True if `obj` is a PyTorch storage object.

    Args:
        obj (Object): Object to test
    )rj   Ú_storage_classesrp   r=   r=   r>   r   #  s    r   c                 C   s    t | tƒrt| ƒ} t | ¡ dS )aˆ  Sets the default ``torch.Tensor`` type to floating point tensor type
    ``t``. This type will also be used as default floating point type for
    type inference in :func:`torch.tensor`.

    The default floating point tensor type is initially ``torch.FloatTensor``.

    Args:
        t (type or string): the floating point tensor type or its name

    Example::

        >>> torch.tensor([1.2, 3]).dtype    # initial default for floating point is torch.float32
        torch.float32
        >>> torch.set_default_tensor_type(torch.DoubleTensor)
        >>> torch.tensor([1.2, 3]).dtype    # a new floating point tensor
        torch.float64

    N)rh   Ú_string_classesr   Ú_CZ_set_default_tensor_type)Útr=   r=   r>   r   ,  s    
r   c                 C   s   t  | ¡ dS )aj  

    Sets the default floating point dtype to :attr:`d`. Supports torch.float32
    and torch.float64 as inputs. Other dtypes may be accepted without complaint
    but are not supported and are unlikely to work as expected.

    When PyTorch is initialized its default floating point dtype is torch.float32,
    and the intent of set_default_dtype(torch.float64) is to facilitate NumPy-like
    type inference. The default floating point dtype is used to:

    1. Implicitly determine the default complex dtype. When the default floating point
       type is float32 the default complex dtype is complex64, and when the default
       floating point type is float64 the default complex type is complex128.
    2. Infer the dtype for tensors constructed using Python floats or complex Python
       numbers. See examples below.
    3. Determine the result of type promotion between bool and integer tensors and
       Python floats and complex Python numbers.

    Args:
        d (:class:`torch.dtype`): the floating point dtype to make the default.
                                  Either torch.float32 or torch.float64.

    Example:
        >>> # initial default for floating point is torch.float32
        >>> # Python floats are interpreted as float32
        >>> torch.tensor([1.2, 3]).dtype
        torch.float32
        >>> # initial default for floating point is torch.complex64
        >>> # Complex Python numbers are interpreted as complex64
        >>> torch.tensor([1.2, 3j]).dtype
        torch.complex64

        >>> torch.set_default_dtype(torch.float64)

        >>> # Python floats are now interpreted as float64
        >>> torch.tensor([1.2, 3]).dtype    # a new floating point tensor
        torch.float64
        >>> # Complex Python numbers are now interpreted as complex128
        >>> torch.tensor([1.2, 3j]).dtype   # a new complex tensor
        torch.complex128

    N)rt   Z_set_default_dtype)Údr=   r=   r>   Úset_default_dtypeD  s    +rw   c                 C   s   t  | ¡ dS )a   Sets whether PyTorch operations must use "deterministic"
    algorithms. That is, algorithms which, given the same input, and when
    run on the same software and hardware, always produce the same output.
    When enabled, operations will use deterministic algorithms when available,
    and if only nondeterministic algorithms are available they will throw a
    :class:`RuntimeError` when called.

    The following normally-nondeterministic operations will act
    deterministically when ``mode=True``:

        * :class:`torch.nn.Conv1d` when called on CUDA tensor
        * :class:`torch.nn.Conv2d` when called on CUDA tensor
        * :class:`torch.nn.Conv3d` when called on CUDA tensor
        * :class:`torch.nn.ConvTranspose1d` when called on CUDA tensor
        * :class:`torch.nn.ConvTranspose2d` when called on CUDA tensor
        * :class:`torch.nn.ConvTranspose3d` when called on CUDA tensor
        * :func:`torch.bmm` when called on sparse-dense CUDA tensors
        * :func:`torch.Tensor.__getitem__` when attempting to differentiate a CPU tensor
          and the index is a list of tensors
        * :func:`torch.Tensor.index_put` with ``accumulate=False``
        * :func:`torch.Tensor.index_put` with ``accumulate=True`` when called on a CPU
          tensor
        * :func:`torch.Tensor.put_` with ``accumulate=True`` when called on a CPU
          tensor
        * :func:`torch.Tensor.scatter_add_` when ``input`` dimension is one and called
          on a CUDA tensor
        * :func:`torch.gather` when ``input`` dimension is one and called
          on a CUDA tensor that requires grad
        * :func:`torch.index_add` when called on CUDA tensor
        * :func:`torch.index_select` when attempting to differentiate a CUDA tensor
        * :func:`torch.repeat_interleave` when attempting to differentiate a CUDA tensor
        * :func:`torch.Tensor.index_copy` when called on a CPU or CUDA tensor

    The following normally-nondeterministic operations will throw a
    :class:`RuntimeError` when ``mode=True``:

        * :class:`torch.nn.AvgPool3d` when attempting to differentiate a CUDA tensor
        * :class:`torch.nn.AdaptiveAvgPool2d` when attempting to differentiate a CUDA tensor
        * :class:`torch.nn.AdaptiveAvgPool3d` when attempting to differentiate a CUDA tensor
        * :class:`torch.nn.MaxPool3d` when attempting to differentiate a CUDA tensor
        * :class:`torch.nn.AdaptiveMaxPool2d` when attempting to differentiate a CUDA tensor
        * :class:`torch.nn.FractionalMaxPool2d` when attempting to differentiate a CUDA tensor
        * :class:`torch.nn.FractionalMaxPool3d` when attempting to differentiate a CUDA tensor
        * :func:`torch.nn.functional.interpolate` when attempting to differentiate a CUDA tensor
          and one of the following modes is used:

          - ``linear``
          - ``bilinear``
          - ``bicubic``
          - ``trilinear``

        * :class:`torch.nn.ReflectionPad1d` when attempting to differentiate a CUDA tensor
        * :class:`torch.nn.ReflectionPad2d` when attempting to differentiate a CUDA tensor
        * :class:`torch.nn.ReflectionPad3d` when attempting to differentiate a CUDA tensor
        * :class:`torch.nn.ReplicationPad1d` when attempting to differentiate a CUDA tensor
        * :class:`torch.nn.ReplicationPad2d` when attempting to differentiate a CUDA tensor
        * :class:`torch.nn.ReplicationPad3d` when attempting to differentiate a CUDA tensor
        * :class:`torch.nn.NLLLoss` when called on a CUDA tensor
        * :class:`torch.nn.CTCLoss` when attempting to differentiate a CUDA tensor
        * :class:`torch.nn.EmbeddingBag` when attempting to differentiate a CUDA tensor when
          ``mode='max'``
        * :func:`torch.Tensor.scatter_add_` when ``input`` dimension is larger than one
          and called on a CUDA tensor
        * :func:`torch.gather` when ``input`` dimension is larger than one
          and called on a CUDA tensor that requires grad
        * :func:`torch.Tensor.put_` when ``accumulate=False``
        * :func:`torch.Tensor.put_` when ``accumulate=True`` and called on a CUDA tensor
        * :func:`torch.histc` when called on a CUDA tensor
        * :func:`torch.bincount` when called on a CUDA tensor
        * :func:`torch.kthvalue` with called on a CUDA tensor
        * :func:`torch.median` with indices output when called on a CUDA tensor
        * :func:`torch.nn.functional.grid_sample` when attempting to differentiate a CUDA tensor

    A handful of CUDA operations are nondeterministic if the CUDA version is
    10.2 or greater, unless the environment variable ``CUBLAS_WORKSPACE_CONFIG=:4096:8``
    or ``CUBLAS_WORKSPACE_CONFIG=:16:8`` is set. See the CUDA documentation for more
    details: `<https://docs.nvidia.com/cuda/cublas/index.html#cublasApi_reproducibility>`_
    If one of these environment variable configurations is not set, a :class:`RuntimeError`
    will be raised from these operations when called with CUDA tensors:

        * :func:`torch.mm`
        * :func:`torch.mv`
        * :func:`torch.bmm`

    Note that deterministic operations tend to have worse performance than
    nondeterministic operations.

    .. note::

        This flag does not detect or prevent nondeterministic behavior caused
        by calling an inplace operation on a tensor with an internal memory
        overlap or by giving such a tensor as the :attr:`out` argument for an
        operation. In these cases, multiple writes of different data may target
        a single memory location, and the order of writes is not guaranteed.

    Args:
        mode (:class:`bool`): If True, makes potentially nondeterministic
            operations switch to a deterministic algorithm or throw a runtime
            error. If False, allows nondeterministic operations.

    Example::

        >>> torch.use_deterministic_algorithms(True)

        # Forward mode nondeterministic error
        >>> torch.randn(10).index_copy(0, torch.tensor([0]), torch.randn(1))
        ...
        RuntimeError: index_copy does not have a deterministic implementation...

        # Backward mode nondeterministic error
        >>> torch.randn(10, requires_grad=True, device='cuda').index_select(0, torch.tensor([0], device='cuda')).backward()
        ...
        RuntimeError: index_add_cuda_ does not have a deterministic implementation...
    N)rt   Z_set_deterministic_algorithmsrO   r=   r=   r>   r-   q  s    sr-   c                   C   s   t  ¡ S )z˜Returns True if the global deterministic flag is turned on. Refer to
    :func:`torch.use_deterministic_algorithms` documentation for more details.
    )rt   Z_get_deterministic_algorithmsr=   r=   r=   r>   r.   æ  s    r.   c                 C   s   t  | ¡ dS )a”  When this flag is False (default) then some PyTorch warnings may only
    appear once per process. This helps avoid excessive warning information.
    Setting it to True causes these warnings to always appear, which may be
    helpful when debugging.

    Args:
        b (:class:`bool`): If True, force warnings to always be emitted
                           If False, set to the default behaviour
    N)rt   Z_set_warnAlways)Úbr=   r=   r>   r/   ì  s    
r/   c                   C   s   t  ¡ S )z‰Returns True if the global warn_always flag is turned on. Refer to
    :func:`torch.set_warn_always` documentation for more details.
    )rt   Z_get_warnAlwaysr=   r=   r=   r>   r0   ø  s    r0   )ÚeÚnanÚinfÚpi)ry   r|   rz   r{   )r+   )Ú_StorageBasec                   @   s   e Zd ZdS )r#   N©rg   rc   rf   r=   r=   r=   r>   r#     s   r#   c                   @   s   e Zd ZdS )r$   Nr~   r=   r=   r=   r>   r$     s   r$   c                   @   s   e Zd ZdS )ÚHalfStorageNr~   r=   r=   r=   r>   r     s   r   c                   @   s   e Zd ZdS )r%   Nr~   r=   r=   r=   r>   r%     s   r%   c                   @   s   e Zd ZdS )r&   Nr~   r=   r=   r=   r>   r&     s   r&   c                   @   s   e Zd ZdS )r'   Nr~   r=   r=   r=   r>   r'   #  s   r'   c                   @   s   e Zd ZdS )r(   Nr~   r=   r=   r=   r>   r(   '  s   r(   c                   @   s   e Zd ZdS )r)   Nr~   r=   r=   r=   r>   r)   +  s   r)   c                   @   s   e Zd ZdS )r*   Nr~   r=   r=   r=   r>   r*   /  s   r*   c                   @   s   e Zd ZdS )ÚBFloat16StorageNr~   r=   r=   r=   r>   r€   3  s   r€   c                   @   s   e Zd ZdS )ÚComplexDoubleStorageNr~   r=   r=   r=   r>   r�   6  s   r�   c                   @   s   e Zd ZdS )ÚComplexFloatStorageNr~   r=   r=   r=   r>   r‚   9  s   r‚   c                   @   s   e Zd ZdS )ÚQUInt8StorageNr~   r=   r=   r=   r>   rƒ   <  s   rƒ   c                   @   s   e Zd ZdS )ÚQInt8StorageNr~   r=   r=   r=   r>   r„   ?  s   r„   c                   @   s   e Zd ZdS )ÚQInt32StorageNr~   r=   r=   r=   r>   r…   B  s   r…   c                   @   s   e Zd ZdS )ÚQUInt4x2StorageNr~   r=   r=   r=   r>   r†   E  s   r†   Ú_tensor_classes)r   r   r   r   r   )r   r   )r   c                  C   sT   t  ¡ dkstjdkrdS tdddƒ} ttdƒƒ tj | ¡sJt	d|  ƒ‚|  
d¡S )	NrM   r
   r@   ri   r3   Ztorch_shm_managerz$Unable to find torch_shm_manager at zutf-8)rQ   rR   rS   rT   r   r   r6   r7   r8   ÚRuntimeErrorÚencode)r7   r=   r=   r>   Úmanager_pathZ  s    rŠ   )Z
unique_dimÚ__c                 C   sH   ddl m}m} t| ƒtjur8|| fƒr8|t| f| |ƒS | sDJ |ƒ‚dS )zFA wrapper around Python's assert which is symbolically traceable.
    r   )Úhas_torch_functionÚhandle_torch_functionN)Z	overridesrŒ   r�   rj   ri   r+   Ú_assert)Ú	conditionÚmessagerŒ   r�   r=   r=   r>   rŽ   �  s    rŽ   )Úcpu)Úautograd)r    r!   Úset_grad_enabledr"   )Úfft)Úfutures)Únn)Úao)Úoptim)Úmultiprocessing)Úsparse)Úspecial)Úonnx)Újit)Úlinalg)Úhub)Úrandom)Údistributions)Útesting)Úquantization)Ú
__config__)Ú
__future__)Úprofiler)Ú_torch_docsÚ_tensor_docsÚ_storage_docsc                   C   s   t jS )z?Returns whether PyTorch was built with _GLIBCXX_USE_CXX11_ABI=1)rt   Z_GLIBCXX_USE_CXX11_ABIr=   r=   r=   r>   Úcompiled_with_cxx11_abiÝ  s    rª   )Úops)Úclasses)Úquasirandom)Úregister_after_fork)r,   )Úfrom_dlpackÚ	to_dlpackc                 C   sF   t  | ¡j} tjt }t|| ƒr6td | t	|| ƒ¡ƒ‚t
|| |ƒ dS )zùRegister an external runtime module of the specific :attr:`device_type`
    supported by torch.

    After the :attr:`module` is registered correctly, the user can refer
    the external runtime module as part of torch with attribute torch.xxx.
    z@The runtime module of '{}' has already been registered with '{}'N)ri   Zdevicerj   rS   Úmodulesrg   rk   rˆ   ÚformatÚgetattrÚsetattr)Zdevice_typern   Úmr=   r=   r>   Ú_register_device_module   s    


ÿr¶   )ôÚ__doc__r6   rS   rQ   ÚtextwraprX   ÚwarningsZautocast_moder   Úversion_infoÚ	ExceptionÚ_utilsr   Z_utils_internalr   r   r   r	   rT   r   Ztorch_versionZ_sixr   rs   Útypingr   r   r   Ú__all__ÚgetenvZpfiles_pathr7   r9   Úexec_prefixZpy_dll_pathrW   rV   Zth_dll_pathÚbase_exec_prefixZbase_py_dll_pathÚlistÚfilterr8   Z	dll_pathsÚallZnvtoolsext_dll_pathÚversionrB   Zcuda_versionrC   ÚreplaceZcuda_version_1Zcuda_path_varZdefault_pathZ	cuda_pathÚextendZWinDLLÚkernel32rk   Zwith_load_library_flagsZSetErrorModeZprev_error_modeÚc_void_pZLoadLibraryWÚrestyperH   ZLoadLibraryExWZdll_pathZadd_dll_directoryÚresZWinErrorZget_last_errorÚerrÚstrerrorrY   ÚOSErrorÚprintZdllsZpath_patchedÚdllZ	is_loadedZ
last_errorÚenvironr\   rR   Z	_dl_flagsZDLFCNÚImportErrorZ	torch._dlZ_dlÚgetdlopenflagsZ	old_flagsÚsetdlopenflagsrZ   r]   Ztorch._Crt   r_   Z_C_for_compiled_checkÚdedentÚstripÚdirÚattrr³   Ú	candidaterj   r±   r   r   r   r   rw   r-   r.   r/   r0   Úmathry   rz   r{   r|   Z_tensorr+   Zstorager}   ZDoubleStorageBaser#   ZFloatStorageBaser$   ZHalfStorageBaser   ZLongStorageBaser%   ZIntStorageBaser&   ZShortStorageBaser'   ZCharStorageBaser(   ZByteStorageBaser)   ZBoolStorageBaser*   ZBFloat16StorageBaser€   ZComplexDoubleStorageBaser�   ZComplexFloatStorageBaser‚   ZQUInt8StorageBaserƒ   ZQInt8StorageBaser„   ZQInt32StorageBaser…   ZQUInt4x2StorageBaser†   rr   Úsetr‡   Ú__annotations__r    r   r   r   r   r   Zserializationr   r   Z_tensor_strr   rŠ   Ztorch._C._VariableFunctionsZPRIVATE_OPSZ_VariableFunctionsrb   Ú
startswithÚglobalsÚappendZ
functionalrŽ   ri   r‘   r’   Ztorch.autogradr    r!   r“   r"   r”   r•   r–   Ztorch.nn.intrinsicZtorch.nn.quantizableZtorch.nn.quantizedr—   r˜   Ztorch.optim._multi_tensorr™   rš   r›   Ztorch.utils.backcompatrœ   r�   rž   rŸ   r¡   r¢   Ztorch.backends.cudaZtorch.backends.mklZtorch.backends.mkldnnZtorch.backends.openmpZtorch.backends.quantizedr£   Ztorch.utils.datar¤   r¥   r¦   Z_init_namesr5   r§   r¨   r©   rª   Z
torch._opsr«   Ztorch._classesr¬   r­   Zcontiguous_formatZlegacy_contiguous_formatZtorch.multiprocessing._atforkr®   Zget_num_threadsZ_lobpcgr,   ZatenZquantized_lstmZquantized_gruZtorch.utils.dlpackr¯   r°   r¶   r=   r=   r=   r>   Ú<module>   sÔ  


ÿ














ÿ
õ
	-u

ý


