o
    i+
                     @   s   d dl Z d dlmZmZmZmZ d dlZddlT ddl	mZ ddl	m
Z
 ejZdZdd	 ZejD ]ZeeeZee
ed
 ZerGeeeeneZee e< q0dS )    N)is_cupyis_jaxscipy_namespace_forSCIPY_ARRAY_API   )*)_ndimage_api)_delegatorsZndimagec                    s    fdd}|S )Nc                    s   t   fdd}|S )Nc            	         s  | i | t  r$dd l}|d }t|j}|| i |S t rCjdkrCt }t|}t|j}|| i |S | i |}t|tj	tj
frX |S t|tr_|S t|tro fdd| D S |d u ru|S t| fdd|D S )Nr   zcupyx.scipy.Zmap_coordinatesc                    s,   i | ]\}}|  t fd d|D qS )c                 3   s    | ]}  |V  qd S N)asarray).0ZvvZxp e/home/kim/smarthome/.venv/lib/python3.10/site-packages/scipy/ndimage/_support_alternative_backends.py	<genexpr>/   s    zIdelegate_xp.<locals>.inner.<locals>.wrapper.<locals>.<dictcomp>.<genexpr>)itemtuple)r   kvr   r   r   
<dictcomp>.   s    z?delegate_xp.<locals>.inner.<locals>.wrapper.<locals>.<dictcomp>c                 3   s*    | ]}t |tjr |n|V  qd S r
   )
isinstancenpndarrayr   )r   xr   r   r   r   7   s
    
z>delegate_xp.<locals>.inner.<locals>.wrapper.<locals>.<genexpr>)r   	importlibimport_modulegetattr__name__r   r   r   r   r   Zgenericr   intdictitemstype)	argskwdsr   Zcupyx_moduleZ
cupyx_funcZspxZ
jax_moduleZjax_funcresult)	delegatorfuncmodule_namer   r   wrapper   s2   




z+delegate_xp.<locals>.inner.<locals>.wrapper)	functoolswraps)r&   r(   r%   r'   )r&   r   inner   s   (zdelegate_xp.<locals>.innerr   )r%   r'   r,   r   r+   r   delegate_xp   s   +r-   
_signature)r)   Zscipy._lib._array_apir   r   r   r   numpyr   r    r	   __all__ZMODULE_NAMEr-   	func_namer   Z	bare_funcr%   fvarsr   r   r   r   <module>   s$    
/
