+
    öäûjO
  ã                   ó   € R t ^ RItR R ltR# )zÚShared helpers for AdaLN-style modulation across compute backends.

Pure-torch, dependency-light (no triton/cuda imports) so both the CUDA and
Triton backends can reuse the exact same broadcast logic without drifting.
Nc                óp   € V ^8„  d   QhR\         P                  R\         P                  R\        R\        /# )é   ÚtÚxÚnÚd)ÚtorchÚTensorÚint)Úformats   "Ú^C:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\comfy_kitchen\backends\_modulation.pyÚ__annotate__r      s6   € ÷ -Dñ -DœUŸ\™\ð -D¬e¯l©lð -D¼sð -DÄsñ -Dó    c                ó   € V P                   R,          V8X  Ed   VP                   RR pV P                   RR p\        V4      \        V4      ,
          pV^ 8¼  dÛ   RV,          \        V4      ,           pRpRp\        WTRR7       F8  w  ršWš8X  d   V
^8w  d   V'       d   Rp MK   K"  V	^8X  d   V
^8w  d   RpK4  K6  Rp M	  V'       dm   V P	                  4       V,          pV^ 8”  dO   W+,          ^ 8X  dB   V P                  W³4      pVP                  4       '       g   VP                  4       pWÂV,          3# V P                  V4      P                  W#4      pVP                  4       '       d   V^3# VP                  4       ^3# )u§  Flatten a scale/shift tensor to (R, D) distinct rows + a broadcast group.

Returns (flat, group) where output row r reads vector ``r // group`` and
``group == N // R``. In AdaLN, scale/shift are broadcast over inner dims
(tokens, or spatial H/W): e.g. x (B,1,H,W,D) with scale (B,1,1,1,D). Whenever
the broadcast collapses to contiguous blocks of output rows â€” that is, every
"kept" (non-broadcast) leading dim is outer to every broadcast dim â€” the
distinct rows reshape to (R, D) and row r maps to r // (N // R). That avoids
the expand+copy and the N*D of redundant read traffic. Broadcast patterns
that don't form contiguous blocks fall back to materializing (group == 1).
NTF)Ústrictéÿÿÿÿ)é   )	ÚshapeÚlenÚtupleÚzipÚnumelÚreshapeÚis_contiguousÚ
contiguousÚ	expand_as)r   r   r   r   Úlead_xÚlead_tÚpadÚ	groupableÚseen_broadcastÚs_iÚx_iÚrowsÚflats   &&&&         r   Úadaln_prep_modulationr%      sY  € ð 	‡w�wˆr…{�aÕØ—‘˜˜"�ˆØ—‘˜˜"�ˆä�&‹kœC ›KÕ'ˆØ�!Œ8Ø˜C•Z¤%¨£-Õ/ˆFØˆIØ"ˆNÜ °t×<‘�Ø”:ð ˜a”x§NØ$)˜	Ùñ %3‘xð ˜A”XØ˜a”xØ)-šñ  ð !&�IÙñ =÷ Ø—w‘w“y A•~�Ø˜!”8 ¥¨A¤ØŸ9™9 TÓ-�DØ×-Ñ-×/Ò/Ø#Ÿ™Ó0˜Ø d¥˜?Ð*ð �;‰;�q‹>×!Ñ! !Ó'€DØ×&Ñ&×(Ò(ˆDÀ!ÐCÐC¨d¯o©oÓ.?À!ÐCÐCr   )Ú__doc__r   r%   © r   r   Ú<module>r(      s   ðñó ÷-Dr   