a
    ßñhs\  ã                   @   s	  U d Z ddlZddlZddlZddlZddlZejdk r@edƒ‚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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 ƒƒ�rNej e dej edd¡¡dd¡Z)ndZ)ddlm*Z+ ddl,Z,e+�rÂe(dd„ e'D ƒƒ�rÂe+ -dd¡Z.de. Z/ej eddd e+ ¡Z0ej e e/e0¡d¡Z1ndZ1e' 2e%ejj&e)e1gƒ¡ ej3d!d"d#�Z4e5e4d$ƒZ6e4 7d¡Z8ej9e4j:_;e6�r$ej9e4j<_;ej9e4j=_;e'D ]`Z>ejd%k�rDe ?e>¡ nBe6�r(e4 <e>¡Z@e@du �r(e Ae B¡ ¡ZCeC jDd&e>› d'�7  _DeC‚�q(z,e Ed(¡ e Ed)¡ e+d*v�r´e Ed+¡ W n eF�yÒ   eGd,ƒ Y n0 e, ,ej e!d-¡¡ZHd.ZIeHD ]ÖZJd.ZKe6�r\e4 =eJdd/¡Z@e B¡ ZLe@du �rNeLd0k�rNe AeL¡ZCeC jDd1eJ› d2�7  _DeC‚ne@du�r\d"ZKeK�sðeI�sˆd3 e'ejMd4 g ¡ejMd4< d"ZIe4 :eJ¡Z@e@du �rðe Ae B¡ ¡ZCeC jDd1eJ› d2�7  _DeC‚�qðe4 7e8¡ d5d6„ ZNe�sìe d7¡�rze O¡ d8k�rzddlZPe5ePd9ƒ�re5ePd:ƒ�sHzddlQZPW n  eR�yF   ddlSmTZP Y n0 e U¡ ZVe WePjXePjYB ¡ dd;lZT e WeV¡ [V[Pne�r†eNƒ  dd;lZT e�r ddlZm[Z[ zdd<lZm\Z\ W nN eR�yþ   ddlZm[Z] ejd=k�røe]j du �røeRe ^d>¡ _¡ ƒd‚‚ Y n0 ed?d„ e`e[ƒD ƒ7 Zd@dA„ ZadBdC„ ZbdDdE„ ZcdFdG„ ZddHdI„ ZedJdK„ ZfdLdM„ ZgddNlhmiZi ddOljmkZk G dPdQ„ dQe[jlekƒZmG dRdS„ dSe[jnekƒZoG dTdU„ dUe[jpekƒZqG dVdW„ dWe[jrekƒZsG dXdY„ dYe[jtekƒZuG dZd[„ d[e[jvekƒZwG d\d]„ d]e[jxekƒZyG d^d_„ d_e[jzekƒZ{G d`da„ dae[j|ekƒZ}G dbdc„ dce[j~ekƒZG ddde„ dee[j€ekƒZ�G dfdg„ dge[j‚ekƒZƒG dhdi„ die[j„ekƒZ…G djdk„ dke[j†ekƒZ‡G dldm„ dme[jˆekƒZ‰emeoeseueweye{eqe}e…e‡e‰eeƒe�hZŠe‹ƒ ZŒee e�dn< ddolŽm�Z�m�Z�m‘Z‘m’Z’m“Z“ ddpl”m•Z•m–Z– ddql—m˜Z˜ drds„ Z™e[ \e™ƒ ¡ [™e�r"dd;lšT e`e[j›ƒD ]2Zœeœ �dt¡�r@�q,eže[j›eœƒeŸƒ eœ< e  eœ¡ �q,dd;l¡T [l[n[r[t[v[x[z[|[„[~[€[‚ddl¢Z£ddl¤Z£ddul¤m¥Z¥m¦Z¦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­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´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»Z£ddl¼Z£ddl½Z£ddl¾Z£ddl¿Z£ddlÀZ£e[ Áe$e£jŠƒ¡ ddvlÂmÃZÃmÄZÄmÅZÅ [Ã[Ä[Ådwdx„ ZÆddylÇmÈZÈ ddzlÉmÊZÊ ddlË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~„ 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)é   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)Ú__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ÚDoubleStorageÚFloatStorageÚLongStorageÚ
IntStorageÚShortStorageÚCharStorageÚByteStorageÚBoolStorageZDoubleTensorZFloatTensorZ
LongTensorZ	IntTensorZShortTensorZ
CharTensorZ
ByteTensorZ
BoolTensorÚTensorÚlobpcgÚset_deterministicÚis_deterministicÚ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© r8   úN/home/yuhw/wc/uboone-dl-vtx/venv/lib/python3.9/site-packages/torch/__init__.pyÚ
<listcomp>=   ó    r:   ZNVTOOLSEXT_PATHzNVIDIA CorporationZ
NvToolsExtÚx64)Úcudac                 C   s"   g | ]}t   tj |d ¡¡ ‘qS )zcudart64*.dll)Úglobr1   r2   r4   r5   r8   r8   r9   r:   E   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.dll)z9.2z10.0z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   s`   t  ¡ 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ÚWindowsZlibtorch_global_depsÚDarwinz.dylibz.sor/   )Úmode)ÚplatformÚsystemr1   r2   ÚabspathÚ__file__r4   ÚdirnameÚctypesÚCDLLÚRTLD_GLOBAL)Zlib_nameÚhereZlib_pathr8   r8   r9   Ú_load_global_deps†   s    rT   ZTORCH_USE_RTLD_GLOBALrH   rR   Ú	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   r@   ZBase)Úendswith)r6   Únamer8   r8   r9   r:   Þ   s   
þ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 )Nr0   Ú
__module__ÚbuiltinsÚ__builtin__r?   Ú__qualname__Ú__name__)	Ú
isinstanceÚtorchr(   ÚtypeÚhasattrr[   r^   r_   Ú	__class__)ÚoÚmoduleÚ
class_namer8   r8   r9   r   ç   s     ÿÿ


r   c                 C   s   t | tjƒS )aI  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
    )r`   ra   r(   ©Úobjr8   r8   r9   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
    )rb   Ú_storage_classesrh   r8   r8   r9   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)r`   Ú_string_classesr   Ú_CZ_set_default_tensor_type)Útr8   r8   r9   r     s    
r   c                 C   s   t  | ¡ dS )a  Sets the default floating point dtype to :attr:`d`.
    This dtype is:

    1. The inferred dtype for python floats in :func:`torch.tensor`.
    2. Used to infer dtype for python complex numbers. The default complex dtype is set to
       ``torch.complex128`` if default floating point dtype is ``torch.float64``,
       otherwise it's set to ``torch.complex64``

    The default floating point dtype is initially ``torch.float32``.

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

    Example:
        >>> # initial default for floating point is torch.float32
        >>> torch.tensor([1.2, 3]).dtype
        torch.float32
        >>> # initial default for floating point is torch.complex64
        >>> torch.tensor([1.2, 3j]).dtype
        torch.complex64
        >>> torch.set_default_dtype(torch.float64)
        >>> torch.tensor([1.2, 3]).dtype    # a new floating point tensor
        torch.float64
        >>> torch.tensor([1.2, 3j]).dtype   # a new complex tensor
        torch.complex128

    N)rl   Z_set_default_dtype©Údr8   r8   r9   Úset_default_dtype*  s    rp   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 True, operations will use deterministic algorithms when available,
    and if only nondeterministic algorithms are available they will throw a
    :class:RuntimeError when called.

    .. warning::
        This feature is in beta, and its design and implementation may change
        in the future.

    The following normally-nondeterministic operations will act
    deterministically when `d=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

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

        * :class:`torch.nn.AvgPool3d` when called on a CUDA tensor that requires grad
        * :class:`torch.nn.AdaptiveAvgPool2d` when called on a CUDA tensor that requires grad
        * :class:`torch.nn.AdaptiveAvgPool3d` when called on a CUDA tensor that requires grad
        * :class:`torch.nn.MaxPool3d` when called on a CUDA tensor that requires grad
        * :class:`torch.nn.AdaptiveMaxPool2d` when called on a CUDA tensor that requires grad
        * :class:`torch.nn.FractionalMaxPool2d` when called on a CUDA tensor that requires grad
        * :class:`torch.nn.FractionalMaxPool3d` when called on a CUDA tensor that requires grad
        * :func:`torch.nn.functional.interpolate` when called on a CUDA tensor that requires grad
            and one of the following modes is used:
            - `linear`
            - `bilinear`
            - `bicubic`
            - `trilinear`
        * :class:`torch.nn.ReflectionPad1d` when called on a CUDA tensor that requires grad
        * :class:`torch.nn.ReflectionPad2d` when called on a CUDA tensor that requires grad
        * :class:`torch.nn.ReplicationPad1d` when called on a CUDA tensor that requires grad
        * :class:`torch.nn.ReplicationPad2d` when called on a CUDA tensor that requires grad
        * :class:`torch.nn.ReplicationPad3d` when called on a CUDA tensor that requires grad
        * :class:`torch.nn.NLLLoss` when called on a CUDA tensor that requires grad
        * :class:`torch.nn.CTCLoss` when called on a CUDA tensor that requires grad
        * :class:`torch.nn.EmbeddingBag` when called on a CUDA tensor that requires grad
        * :func:`torch.scatter_add_` when called on a CUDA tensor
        * :func:`torch.index_add_` when called on a CUDA tensor
        * :func:`torch.index_select` when called on a CUDA tensor that requires grad
        * :func:`torch.repeat_interleave` when called on a CUDA tensor that requires grad
        * :func:`torch.histc` when called on a CUDA tensor
        * :func:`torch.bincount` when called on 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
    non-deterministic operations.

    Args:
        d (:class:`bool`): If True, force operations to be deterministic.
                           If False, allow non-deterministic operations.
    N)rl   Z_set_deterministicrn   r8   r8   r9   r*   H  s    Hr*   c                   C   s   t  ¡ S )z�Returns True if the global deterministic flag is turned on. Refer to
    :func:`torch.set_deterministic` documentation for more details.
    )rl   Z_get_deterministicr8   r8   r8   r9   r+   ’  s    r+   )r(   )Ú_StorageBasec                   @   s   e Zd ZdS )r    N©r_   r[   r^   r8   r8   r8   r9   r       s   r    c                   @   s   e Zd ZdS )r!   Nrr   r8   r8   r8   r9   r!   ¤  s   r!   c                   @   s   e Zd ZdS )ÚHalfStorageNrr   r8   r8   r8   r9   rs   ¨  s   rs   c                   @   s   e Zd ZdS )r"   Nrr   r8   r8   r8   r9   r"   ¬  s   r"   c                   @   s   e Zd ZdS )r#   Nrr   r8   r8   r8   r9   r#   °  s   r#   c                   @   s   e Zd ZdS )r$   Nrr   r8   r8   r8   r9   r$   ´  s   r$   c                   @   s   e Zd ZdS )r%   Nrr   r8   r8   r8   r9   r%   ¸  s   r%   c                   @   s   e Zd ZdS )r&   Nrr   r8   r8   r8   r9   r&   ¼  s   r&   c                   @   s   e Zd ZdS )r'   Nrr   r8   r8   r8   r9   r'   À  s   r'   c                   @   s   e Zd ZdS )ÚBFloat16StorageNrr   r8   r8   r8   r9   rt   Ä  s   rt   c                   @   s   e Zd ZdS )ÚComplexDoubleStorageNrr   r8   r8   r8   r9   ru   Ç  s   ru   c                   @   s   e Zd ZdS )ÚComplexFloatStorageNrr   r8   r8   r8   r9   rv   Ê  s   rv   c                   @   s   e Zd ZdS )ÚQUInt8StorageNrr   r8   r8   r8   r9   rw   Í  s   rw   c                   @   s   e Zd ZdS )ÚQInt8StorageNrr   r8   r8   r8   r9   rx   Ð  s   rx   c                   @   s   e Zd ZdS )ÚQInt32StorageNrr   r8   r8   r8   r9   ry   Ó  s   ry   Ú_tensor_classes)r   r   r   r   r   )r   r   )r   c                  C   sJ   t  ¡ dkrdS tdddƒ} ttdƒƒ tj | ¡s@td|  ƒ‚|  d¡S )NrH   r;   ra   r.   Ztorch_shm_managerz$Unable to find torch_shm_manager at zutf-8)	rK   rL   r   r   r1   r2   r3   ÚRuntimeErrorÚencode)r2   r8   r8   r9   Úmanager_pathé  s    r}   Ú__)r   r   Úset_grad_enabled)Ú_torch_docsÚ_tensor_docsÚ_storage_docsc                   C   s   t jS )z?Returns whether PyTorch was built with _GLIBCXX_USE_CXX11_ABI=1)rl   Z_GLIBCXX_USE_CXX11_ABIr8   r8   r8   r9   Úcompiled_with_cxx11_abiI  s    rƒ   )Úops)Úclasses)Úregister_after_fork)r)   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ˆ   rb   ra   r(   ÚAssert)Ú	conditionÚmessager‡   rˆ   r8   r8   r9   r‰   j  s    r‰   )×Ú__doc__r1   ÚsysrK   ÚtextwraprP   Úversion_infoÚ	ExceptionÚ_utilsr   Z_utils_internalr   r   r   r   Úversionr	   Z_sixr
   rk   Útypingr   r   r   Ú__all__ÚgetenvZpfiles_pathr2   r4   Úexec_prefixZpy_dll_pathrO   rN   Zth_dll_pathÚbase_exec_prefixZbase_py_dll_pathÚlistÚfilterr3   Z	dll_pathsÚallZnvtoolsext_dll_pathr=   Zcuda_versionr>   ÚreplaceZcuda_version_1Zcuda_path_varZdefault_pathZ	cuda_pathÚextendÚWinDLLÚkernel32rc   Zwith_load_library_flagsZSetErrorModeZprev_error_modeÚc_void_pZLoadLibraryWÚrestyperC   ZLoadLibraryExWZdll_pathZadd_dll_directoryÚresZWinErrorZget_last_errorÚerrÚstrerrorrQ   ÚOSErrorÚprintZdllsZpath_patchedÚdllZ	is_loadedZ
last_errorÚenvironrT   rL   Z	_dl_flagsZDLFCNÚImportErrorZ	torch._dlZ_dlÚgetdlopenflagsZ	old_flagsÚsetdlopenflagsrR   rU   Ztorch._Crl   rW   Z_C_for_compiled_checkÚdedentÚstripÚdirr   r   r   r   rp   r*   r+   Ztensorr(   Zstoragerq   ZDoubleStorageBaser    ZFloatStorageBaser!   ZHalfStorageBasers   ZLongStorageBaser"   ZIntStorageBaser#   ZShortStorageBaser$   ZCharStorageBaser%   ZByteStorageBaser&   ZBoolStorageBaser'   ZBFloat16StorageBasert   ZComplexDoubleStorageBaseru   ZComplexFloatStorageBaserv   ZQUInt8StorageBaserw   ZQInt8StorageBaserx   ZQInt32StorageBasery   rj   Úsetrz   Ú__annotations__Úrandomr   r   r   r   r   Zserializationr   r   Z_tensor_strr   r}   Ztorch._C._VariableFunctionsZ_VariableFunctionsrZ   Ú
startswithÚgetattrÚglobalsÚappendZ
functionalZ
torch.cudara   Ztorch.autogradr   r   r   Ztorch.futuresZtorch.nnZtorch.nn.intrinsicZtorch.nn.quantizedZtorch.optimZtorch.optim._multi_tensorZtorch.multiprocessingZtorch.sparseZtorch.utils.backcompatZ
torch.onnxZ	torch.jitZtorch.linalgZ	torch.hubZtorch.randomZtorch.distributionsZtorch.testingZtorch.backends.cudaZtorch.backends.mklZtorch.backends.mkldnnZtorch.backends.openmpZtorch.backends.quantizedZtorch.quantizationZtorch.utils.dataZtorch.__config__Ztorch.__future__Z_init_namesr0   r€   r�   r‚   rƒ   Z
torch._opsr„   Ztorch._classesr…   Ztorch.quasirandomZcontiguous_formatZlegacy_contiguous_formatZtorch.multiprocessing._atforkr†   Zget_num_threadsZ_lobpcgr)   ZatenZquantized_lstmZquantized_grur‰   r8   r8   r8   r9   Ú<module>   s¤  

ÿ















ÿ
õ		J

ý


