
    Ph
                    D   d dl mZ d dlZd dlZd dlZd dlmZ ej                  j                  d      dk(  r ed      d        Z	nd Z	 G d d	e
      Z G d
 de      Z G d de      Z G d de      Z G d de
      Z G d de
      Z G d de
      Z G d de      Zy)    )annotationsN)	lru_cacheTORCHINDUCTOR_WRITE_MISSING_OPS1c                    t        t        j                          dd      5 }|j                  t	        |       dz          d d d        y # 1 sw Y   y xY w)Nz/missing_ops.txta
)opentempfile
gettempdirwritestr)targetfds     ^C:\Users\daisl\Desktop\realtime-object-detection\venv\Lib\site-packages\torch/_inductor/exc.py_record_missing_opr   
   sB    X((*++;<cBbHHS[4'( CBBs   A		Ac                     y )N )r   s    r   r   r      s        c                      e Zd Zed        Zy)OperatorIssuec           	         d|  gt        |      D cg c]  \  }}d| d|  c}}z   }|r|j                  d|        t        j                  dj	                  |      d      S c c}}w )Nztarget: zargs[z]: zkwargs: r	   z  )	enumerateappendtextwrapindentjoin)r   argskwargsiargliness         r   operator_strzOperatorIssue.operator_str   sy    F8$%.7o)
.=FAseA3c#o)
 
 LL8F8,-tyy/66)
s   A'N)__name__
__module____qualname__staticmethodr#   r   r   r   r   r      s    7 7r   r   c                       e Zd Z fdZ xZS )MissingOperatorWithoutDecompc                b    t        |       t        | 	  d| j                  |||              y )Nzmissing lowering
)r   super__init__r#   selfr   r   r   	__class__s       r   r,   z%MissingOperatorWithoutDecomp.__init__!   s0    6"-d.?.?f.U-VWXr   r$   r%   r&   r,   __classcell__r/   s   @r   r)   r)       s    Y Yr   r)   c                       e Zd Z fdZ xZS )MissingOperatorWithDecompc                    t        |       t        | 	  d| j                  |||       t	        j
                  d| d      z          y )Nzmissing decomposition
z9

                There is a decomposition available for z in
                torch._decomp.get_decompositions().  Please add this operator to the
                `decompositions` list in torch._inductor.decompositions
                )r   r+   r,   r#   r   dedentr-   s       r   r,   z"MissingOperatorWithDecomp.__init__'   sX    6"%d&7&7f&M%NOoo88>x @
	
r   r0   r2   s   @r   r4   r4   &   s    
 
r   r4   c                        e Zd Zd fdZ xZS )LoweringExceptionc                |    t         |   t        |      j                   d| d| j	                  |||              y )Nz: r	   )r+   r,   typer$   r#   )r.   excr   r   r   r/   s        r   r,   zLoweringException.__init__7   s?    Cy!!""SED,=,=fdF,S+TU	
r   )r;   	Exceptionr0   r2   s   @r   r8   r8   6   s    
 
r   r8   c                       e Zd Z fdZ xZS )InvalidCxxCompilerc                x    ddl m} t        |   d|j                   d|j
                  j                          y )N   )configz!No working C++ compiler found in z
.cpp.cxx: ) rA   r+   r,   r$   cppcxx)r.   rA   r/   s     r   r,   zInvalidCxxCompiler.__init__>   s1    //@
6::>>JZ[	
r   r0   r2   s   @r   r>   r>   =   s    
 
r   r>   c                        e Zd Zd fdZ xZS )CppWrapperCodeGenErrorc                *    t         |   d|        y )NzC++ wrapper codegen error: )r+   r,   )r.   msgr/   s     r   r,   zCppWrapperCodeGenError.__init__G   s    6se<=r   )rH   r   r0   r2   s   @r   rF   rF   F   s    > >r   rF   c                        e Zd Zd fdZ xZS )CppCompileErrorc                    t        |t              r|j                  d      }t        |   t        j                  d      j                         j                  dj                  |      |             y )Nzutf-8z
                    C++ compile error

                    Command:
                    {cmd}

                    Output:
                    {output}
                 )cmdoutput)

isinstancebytesdecoder+   r,   r   r6   stripformatr   )r.   rM   rN   r/   s      r   r,   zCppCompileError.__init__L   sX    fe$]]7+FOO
 UWVfV5	
r   )rM   z	list[str]rN   r   r0   r2   s   @r   rJ   rJ   K   s    
 
r   rJ   c                      e Zd Zy)CUDACompileErrorN)r$   r%   r&   r   r   r   rU   rU   a   s    r   rU   )
__future__r   osr   r   	functoolsr   environgetr   RuntimeErrorr   r)   r4   r8   r>   rF   rJ   rU   r   r   r   <module>r\      s    " 	   ::>>34;t_) )7L 7Y= Y
 
 
 

 
>\ >

l 
,	 	r   