U
    Jc                     @   s4   d dl Z d dlmZ ddlmZ dd Zdd ZdS )	    N)	signature   _basic_validationc                 C   s0   t t|jdkr$tdt| ||| < dS )z\
    Performs basic validation and registers the provided op in the given
    op_table.
       zlCustom sharded op function expects signature: (types, args, kwargs, process_group), but received signature: N)lenr   
parameters	TypeError)opfuncop_table r   N/tmp/pip-unpacked-wheel-gikjz4vx/torch/distributed/_shard/op_registry_utils.py_register_op
   s
    r   c                    s(   t  fdd}t || |S )zZ
    Decorator function to register the given ``op`` in the provided
    ``op_table``
    c                    s   t  || | |||S )Nr   )typesargskwargsZprocess_groupr
   wrapped_funcr   r   wrapper   s    z _decorator_func.<locals>.wrapper)	functoolswrapsr   )r   r
   r   r   r   r   r   _decorator_func   s    r   )r   inspectr   Zcommon_op_utilsr   r   r   r   r   r   r   <module>   s   