
    h5                         S SK JrJrJrJrJr  SSKJr  \" S\S9rS r	 S\	\	\	S.S	\S
\\
   S\\\\/S4   S\\\\/S4   S\\/S4   S\4S jjjrg)    )AnyCallableOptionalTupleTypeVar   )Model_ModelT)boundc                      g N )argskwargss     Q/home/james-whalen/.local/lib/python3.13/site-packages/thinc/layers/with_debug.py<lambda>r      s    T    N)on_init
on_forwardon_backproplayernamer   r   r   returnc          
        ^ ^^^^^ Uc  T R                   OUnT R                  mT R                  mS[        S[        S[
        S[        [        [        4   4U UUU4S jjnS[        S[        S[        SS4U UU4S jjnT R                  XVS	9  T $ )
zDebugging layer that wraps any layer and allows executing callbacks
during the forward pass, backward pass and initialization. The callbacks
will receive the same arguments as the functions they're called in.
NmodelXis_trainr   c                 \   >^ T" XU5        T	" TXS9u  nmS[         S[         4UU4S jjnX44$ )N)r   dYr   c                 $   > T" U 5        T" U 5      $ r   r   )r   layer_callbackr   s    r   backprop-with_debug.<locals>.forward.<locals>.backprop   s    O!"%%r   )r   )
r   r   r   layer_Yr"   r!   r   r   r   orig_forwards
        @r   forwardwith_debug.<locals>.forward   sA    5X&".ua"K	& 	& 	& 	&   r   Yc                 2   > T" XU5        Tb
  T" TX5        g g r   r   )r   r   r(   r   r   	orig_inits      r   initwith_debug.<locals>.init%   s"    ! eQ" !r   )r+   )	r   _funcr+   r	   r   boolr   r   replace_callbacks)	r   r   r   r   r   r&   r+   r%   r*   s	   ` ```  @@r   
with_debugr0   
   s     5::4D;;L

I!u ! ! !sH}9M ! !#E #c #c #d # #
 
G/Lr   r   )typingr   r   r   r   r   r   r	   r
   
do_nothingstrr.   r0   r   r   r   <module>r4      s    : : 
)5
))

 " 2<5?)3""
3-" uc3'-.	"
 %d+T12" 3%+&" "r   