
    h              	           S SK JrJrJrJr  SSKJr  SSKJr  \" S5      r	\r
\R                  " S5      S\\	\4   S\\	\4   S	\\	\4   4S
 j5       rS r SS\\	\
4   S\\	   S\\
   S	S4S jjrg)    )AnyOptionalTupleTypeVar   )registry)ModelInTz
tuplify.v1layer1layer2returnc                     X4U-   nU Vs/ s H  o3R                   PM     nn[        SSR                  U5      -   S-   [        [        USS0S9$ s  snf )zSend a separate copy of the input to each child layer, and join the
outputs of the children into a tuple on the way out.

Typically used to provide both modified data and the original input to a
downstream layer.
ztuple(z, )nIN)initlayersdims)namer	   jointuplify_forwardr   )r   r   r   layernamess        N/home/james-whalen/.local/lib/python3.13/site-packages/thinc/layers/tuplify.pytuplifyr   
   s_     &F%+,VEZZVE,499U##c)D\  -s   Ac                    ^ / n/ mU R                    H/  nU" X5      u  pVUR                  U5        TR                  U5        M1     U4S jn[        U5      U4$ )Nc                    > [        TU 5       VVs/ s H  u  pU" U5      PM     nnnUS   nUSS   H  nXE-  nM	     U$ s  snnf )Nr      )zip)dYsbpdYdXsdXdx	backpropss         r   backprop_tuplify)tuplify_forward.<locals>.backprop_tuplify(   sP    $'	3$78$7&"r"v$78Vab'BHB 		 9s   ?)r   appendtuple)	modelXis_trainYsr   Ybackpropr&   r%   s	           @r   r   r       sW    	BIA(
		!" 
 9&&&    Nr*   r+   r.   c                 H   Ucw  Uct  U R                    H  nUR                  5         M     U R                   S   R                  S5      (       a.  U R                  SU R                   S   R	                  S5      5        [        U R                   5       H=  u  pCUb&  UR                  S5      c  UR                  XU   S9  M.  UR                  US9  M?     U R                   S   R                  S5      (       a/  U R                  SU R                   S   R	                  S5      5        g g )Nr   r   nO)r+   r.   )r+   )r   
initializehas_dimset_dimget_dim	enumerate)r*   r+   r.   r   iis        r   r   r   2   s     	yQY\\E "<<?""4((MM$Q 7 7 =>
 u||,	=U]]408qbE*q!	 - ||At$$dELLO33D9: %r0   )NN)typingr   r   r   r   configr   r*   r	   r
   OutTr   r   r   r    r0   r   <module>r=      s    0 0  en 
#s(O%*38_
3: *'& KO;d; (;9A$;	;r0   