o
    i                     @   s   d dl mZmZmZmZmZ ddlmZ edZedZ	deee	f deee ee	 f fdd	Z
d
eee ee	 f dee dedeee	 eee	 gee f f fddZ		dd
eee ee	 f deee  deee	  ddfddZdS )    )CallableListOptionalTupleTypeVar   )ModelInTOutTlayerreturnc                 C   s   t dt| gtdS )z:Create a model that maps a child layer across list inputs.map_list)layersinit)r   forwardr   )r    r   I/home/ubuntu/.local/lib/python3.10/site-packages/thinc/layers/map_list.pyr   	   s   r   modelXsis_trainc           	         sd   | j d }g }g  |D ]}|||\}}||  | qdtt dtt f fdd}||fS )Nr   dYsr   c                    s   dd t  | D S )Nc                 S   s   g | ]\}}||qS r   r   ).0callbackdYr   r   r   
<listcomp>   s    z6forward.<locals>.backprop_map_list.<locals>.<listcomp>)zip)r   	callbacksr   r   backprop_map_list   s   z"forward.<locals>.backprop_map_list)r   appendr   r
   r	   )	r   r   r   r   YsXYget_dXr   r   r   r   r      s   

r   Nr!   r"   c                 C   s0   | j d j|r|d nd |r|d nd d d S )Nr   )r!   r"   )r   
initialize)r   r!   r"   r   r   r   r      s   0r   )NN)typingr   r   r   r   r   r   r   r	   r
   r   boolr   r   r   r   r   r   <module>   s2    * 


