
    9j!                         d dl mZmZmZmZ dddZd Z G d de      Z G d d	e      Z G d
 de      Z	 G d de      Z
y)    )BinaryUfuncInfoOpInfoReductionOpInfoUnaryUfuncInfoNop_dbc                h    |ddl m} |D ]%  }|j                  | k(  s|j                  |k(  s#|c S  y)zH
    Finds the OpInfo with the given name that has no variant name.
    Nr   r   )2torch.testing._internal.common_methods_invocationsr   namevariant_test_name)referenced_namevariant_namer   opinfos       c/media/conek/DATA/Code/OCR/venv/lib/python3.12/site-packages/torch/testing/_internal/opinfo/refs.py_find_referenced_opinfor   "   s9     }L ;;/)f.F.F,.VM    c                    | |d d d dd}|j                         }d|v r|j                  |d          |d= d|v r|d= d|v r|d= d|v r|d= d|v r|d= |j                  |       |j                  |       d|d<   d|d	<   d|d
<   d|d<   d|d<   |S )NF)r   opaliasesmethod_variantinplace_variantsupports_scriptingkwargsself	__class__skips
decoratorssupports_autogradsupports_gradgradsupports_fwgrad_bwgradsupports_inplace_autogradsupports_forward_ad)copyupdate)r   r   	inherited	overridescommon_kwargsr   s         r   _inherit_constructor_argsr(   1   s     #M ^^F 6fX&'86Nf;&7Ov<  MM- 
MM)
 #(F"'F',F#$*/F&'$)F !Mr   c                   .     e Zd ZdZddddd fd
Z xZS )PythonRefInfozM
    An OpInfo for a Python reference of an OpInfo base class operation.
    N Tr   r   torch_opinfo_variant_namevalidate_view_consistencyc                2   || _         || _        t        |||      | _        || _        t        | j                  t              s!t        dt        | j                               | j                  j                  }t        ||||      }	t        
| 0  di |	 y )Nr   z(Expected torch_opinfo to be OpInfo, got  )torch_opinfo_namer-   r   torch_opinfor.   
isinstancer   AssertionErrortype_original_opinfo_argsr(   super__init__r   r   r   r   r1   r-   r.   r   r%   ukwargsr   s             r   r8   zPythonRefInfo.__init__a   s     "3)B&38
 *C&$++V4 :4@Q@Q;R:ST  %%;;	+D"iH#7#r   __name__
__module____qualname____doc__r8   __classcell__r   s   @r   r*   r*   \   s      "$"&$ $r   r*   c                   ,     e Zd ZdZdddd fd
Z xZS )ReductionPythonRefInfoM
    An OpInfo for a Python reference of an elementwise unary operation.
    Nr+   r   r   r-   c                2   || _         || _        t        |||      | _        t	        | j                  t
              s!t        dt        | j                               | j                  j                  }t        ||||      }d| _
        t        	| 0  di | y )Nr   z1Expected torch_opinfo to be ReductionOpInfo, got Fr0   )r1   r-   r   r2   r3   r   r4   r5   _original_reduction_argsr(   r.   r7   r8   
r   r   r   r   r1   r-   r   r%   r:   r   s
            r   r8   zReductionPythonRefInfo.__init__   s     "3)B&38
 $++_= CDIZIZD[C\]  %%>>	+D"iH */&#7#r   r;   rA   s   @r   rC   rC   |   s     "$$ $r   rC   c                   .     e Zd ZdZddddd fd
Z xZS )ElementwiseUnaryPythonRefInforD   Nr+   Tr,   c                2   || _         || _        t        |||      | _        || _        t        | j                  t              s!t        dt        | j                               | j                  j                  }t        ||||      }	t        
| 0  di |	 y )Nr   z0Expected torch_opinfo to be UnaryUfuncInfo, got r0   )r1   r-   r   r2   r.   r3   r   r4   r5   _original_unary_ufunc_argsr(   r7   r8   r9   s             r   r8   z&ElementwiseUnaryPythonRefInfo.__init__   s     "3)B&38
 *C&$++^< B4HYHYCZB[\  %%@@	+D"iH#7#r   r;   rA   s   @r   rJ   rJ      s      "$"&$ $r   rJ   c                   ,     e Zd ZdZdddd fd
Z xZS )ElementwiseBinaryPythonRefInfozN
    An OpInfo for a Python reference of an elementwise binary operation.
    Nr+   rE   c                $   || _         || _        t        |||      | _        t	        | j                  t
              s!t        dt        | j                               | j                  j                  }t        ||||      }t        	| ,  di | y )Nr   z1Expected torch_opinfo to be BinaryUfuncInfo, got r0   )r1   r-   r   r2   r3   r   r4   r5   _original_binary_ufunc_argsr(   r7   r8   rH   s
            r   r8   z'ElementwiseBinaryPythonRefInfo.__init__   s     "3)B&38
 $++_= CDIZIZD[C\]  %%AA	+D"iH#7#r   r;   rA   s   @r   rN   rN      s     "$$ $r   rN   )#torch.testing._internal.opinfo.corer   r   r   r   r   r(   r*   rC   rJ   rN   r0   r   r   <module>rR      sT    > EI (V$F $@$_ $D$N $B$_ $r   