
    h              	       p    S SK JrJrJrJrJr  SSKJrJr  SSK	J
r
  \" S\
S9r SS\S	S
S\\   S\4S jjrg)    )AnyCallableOptionalTupleTypeVar   )has_os_signpostos_signpost)Model_ModelT)boundNlayer
signposterzos_signpost.Signposternamereturnc           
      P  ^ ^^^^ [         (       d  [        S5      eTc  T R                  OTmT R                  mT R                  mS[
        S[        S[        S[        [        [        4   4UUU4S jjnS[
        S[        S[        S[
        4U UUU4S	 jjnT R                  X4S
9  T $ )zWraps any layer and marks the init, forward and backprop phases using
signpost intervals for macOS Instruments profiling

By default, the name of the layer is used as the name of the range,
followed by the name of the pass.
z?with_signpost_interval layer requires the 'os_signpost' packagemodelXis_trainr   c                    >^ TR                  T S35         T" XUS9u  nmS S S 5        S[        S[        4UUU4S jjnWU4$ ! , (       d  f       N(= f)Nz forward)r   dYr   c                 r   > TR                  T S35         T" U 5      sS S S 5        $ ! , (       d  f       g = f)Nz	 backpropuse_interval)r   layer_callbackr   r   s    ]/home/james-whalen/.local/lib/python3.13/site-packages/thinc/layers/with_signpost_interval.pybackprop9with_signpost_interval.<locals>.forward.<locals>.backprop"   s,    ((D6);<%b) =<<s   (
6)r   r   )	r   r   r   layer_Yr   r   r   orig_forwardr   s	        @r   forward'with_signpost_interval.<locals>.forward   s\    $$vX%67&25h&O#G^ 8	* 	* 	* 	*    87s   A
A_modelYc                 ~   > Tb'  TR                  T S35         T" TX5      sS S S 5        $ T$ ! , (       d  f       g = f)Nz initr   )r#   r   r$   r   r   	orig_initr   s      r   init$with_signpost_interval.<locals>.init(   s?     ((D68 - 98 L 98s   	.
<)r'   )r	   
ValueErrorr   _funcr'   r   r   boolr   r   replace_callbacks)r   r   r   r!   r'   r    r&   s   ```  @@r   with_signpost_intervalr-   	   s     ?M
 	
 5::4D;;L

I!u ! ! !sH}9M ! !U s s u   
G/L    )N)typingr   r   r   r   r   compatr	   r
   r   r   r   strr-    r.   r   <module>r3      sO    : : 1 
)5
) (((( 3-( 	(r.   