o
    0hg                     @   sr   d dl mZmZmZmZ ddddZdd ZG dd	 d	eZG d
d deZG dd deZ	G dd deZ
dS )    )BinaryUfuncInfoOpInfoReductionOpInfoUnaryUfuncInfoNop_dbc                C   s>   |du r
ddl m} |D ]}|j| kr|j|kr|  S qdS )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   opinfo r   W/var/www/vscode/kcb/lib/python3.10/site-packages/torch/testing/_internal/opinfo/refs.py_find_referenced_opinfo"   s   r   c                 C   s   | |d d d dd}|  }d|v r||d  |d= d|v r"|d= d|v r)|d= d|v r0|d= d|v r7|d= || || 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   r   r   r   _inherit_constructor_args1   s6   


r%   c                       ,   e Zd ZdZddddd fdd
Z  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          
         ^   || _ || _t|||d| _|| _t| jtsJ | jj}t||||}	t	 j
di |	 d S Nr   r   )torch_opinfo_namer*   r   torch_opinfor+   
isinstancer   _original_opinfo_argsr%   super__init__
r   r	   r   r   r.   r*   r+   r   r"   ukwargsr   r   r   r3   a   s   zPythonRefInfo.__init____name__
__module____qualname____doc__r3   __classcell__r   r   r6   r   r'   \       r'   c                       *   e Zd ZdZdddd fdd
Z  ZS )ReductionPythonRefInfoM
    An OpInfo for a Python reference of an elementwise unary operation.
    Nr(   r   r   r*   c          	         s^   || _ || _t|||d| _t| jtsJ | jj}t||||}d| _t	 j
di | d S )Nr   Fr   )r.   r*   r   r/   r0   r   _original_reduction_argsr%   r+   r2   r3   	r   r	   r   r   r.   r*   r   r"   r5   r6   r   r   r3   ~   s   
zReductionPythonRefInfo.__init__r7   r   r   r6   r   r?   y       r?   c                       r&   )ElementwiseUnaryPythonRefInfor@   Nr(   Tr)   c          
         r,   r-   )r.   r*   r   r/   r+   r0   r   _original_unary_ufunc_argsr%   r2   r3   r4   r6   r   r   r3      s   z&ElementwiseUnaryPythonRefInfo.__init__r7   r   r   r6   r   rE      r=   rE   c                       r>   )ElementwiseBinaryPythonRefInfozN
    An OpInfo for a Python reference of an elementwise binary operation.
    Nr(   rA   c          	         sX   || _ || _t|||d| _t| jtsJ | jj}t||||}t j	di | d S r-   )
r.   r*   r   r/   r0   r   _original_binary_ufunc_argsr%   r2   r3   rC   r6   r   r   r3      s   
z'ElementwiseBinaryPythonRefInfo.__init__r7   r   r   r6   r   rG      rD   rG   )#torch.testing._internal.opinfo.corer   r   r   r   r   r%   r'   r?   rE   rG   r   r   r   r   <module>   s   +