ó
    ‡Ž¡jøJ  ã                  óÆ  • S r SSKJr  SSKrSSKJs  Jr  SSKJ	r	  SSK
Jr  SSKJr  \R                  " \5      r S       SS jjr  S         SS	 jjr  S         SS
 jjr S           SS jjr S             SS jjr     S               SS jjr  S           SS jjr S       SS jjr S       SS jjrg)uÿ  Vision utility functions for pre-computing very dynamic and
data-dependent tensors that can break model graph capturing.

All functions are standalone (no model weights) and compute tensors from
`grid_thw` + config scalars. They are used by vision encoders and can be
precomputed before `torch.compile` / `torch.export` tracing since they
use untraceable ops (`repeat_interleave`, `.tolist()`, `nonzero()`, loops).

Each `get_*` accepts an optional `kwargs` dict; if it contains the
precomputed tensor under the natural key (`"cu_seqlens"`, `"position_ids"`,
â€¦), the function pops and returns it instead of computing. Vision encoders
write `x = get_vision_x(..., kwargs=kwargs)` and the matching key is
removed from the caller's kwargs as a side-effect of the pop.
é    )ÚannotationsNé   )ÚPreTrainedConfig)Úlogging)Úget_max_seqlenc                ó¤  • Ub  UR                  SS5      =nb  U$ [        R                  R                  5       (       a  U R                  O[        R
                  nU(       a  U SS2S4   U SS2S4   -  U SS2S4   -  nO/[        R                  " U SS2S4   U SS2S4   -  U SS2S4   5      n[        R                  " UR                  SUS9SSS9$ )	u«  Get cumulative sequence lengths from vision grid info, or pop from `kwargs` if precomputed.

Args:
    grid_thw: `(num_images_or_videos, 3)` â€” temporal, height, width per entry.
    merge_temporal: when `False` (default), each frame is its own attention segment (`h * w`
        per frame, `t` segments per entry â€” the qwen2_vl / glm4v convention). When `True`,
        the whole clip is a single segment (`t * h * w`), i.e. attention spans all frames
        jointly (the kimi_k25 convention).
    kwargs: optional caller kwargs â€” if it contains `"cu_seqlens"` it is popped and returned.

Returns:
    `cu_seqlens`: `(num_segments + 1,)` int32 cumulative sequence boundaries.
NÚ
cu_seqlensr   r   é   )ÚdimÚdtype©r   r   )Úvalue)
ÚpopÚtorchÚjitÚ
is_tracingr   Úint32Úrepeat_interleaveÚFÚpadÚcumsum)Úgrid_thwÚmerge_temporalÚkwargsr	   r   Úseqlenss         Ú§C:\Users\johnn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\transformers/vision_utils.pyÚget_vision_cu_seqlensr   *   sÂ   € ð  Ñ¨V¯Z©Z¸ÀdÓ-KÐK˜zÑXØÐÜ#Ÿi™i×2Ñ2×4Ñ4ˆH�NŠN¼%¿+¹+€EÞØš1˜a˜4‘. 8ªA¨q¨D¡>Ñ1°HºQÀ¸T±NÑB‰ä×)Ò)¨(²1°a°4©.¸8ÂAÀqÀD¹>Ñ*IÈ8ÒTUÐWXÐTXÉ>ÓZˆÜ�5Š5�—‘ A¨U�Ð3°VÀ1ÑEÐEó    c                ó0   • [        XUS9n[        XAUS9nXE4$ )z¹Get cumulative and maximum sequence lengths for packed vision attention. ``merge_temporal`` is
forwarded to [`get_vision_cu_seqlens`] (``True`` for clip-level attention, e.g. kimi_k25).)r   r   )r   )r   r   )r   Úconfigr   r   r	   Ú
max_seqlens         r   Úget_vision_attention_seqlensr"   D   s&   € ô ' xÐW]Ñ^€JÜ 
¸6ÑB€JØÐ!Ð!r   c           
     ó  • Ub  UR                  SS5      =nb  U$ U R                  n[        U[        5      (       a.  [        R
                  " U/US9R                  [        U 5      5      n/ n[        U R                  5       UR                  5       5       GHU  u  u  pgp‰[        R                  " [        R                  " XuS9[        R                  " X…S9SS9u  p«Xy-  X˜U	-  U	4nU
R                  U5      R                  SS5      R                  5       n
UR                  U5      R                  SS5      R                  5       nU(       al  [        R                  " XeS9R                  Xx-  5      nUR!                  [        R"                  " XÚR%                  U5      UR%                  U5      /SS	95        GM   UR!                  [        R"                  " X«/SS	9R%                  US5      5        GMX     [        R&                  " US
S	9$ )uË  Get position IDs for vision rotary embeddings, or pop from `kwargs` if precomputed.

Args:
    grid_thw: `(num_images_or_videos, 3)`
    spatial_merge_size: merge block size â€” either a single `int` (same for all images)
        or a `(num_images_or_videos,)` tensor (per-image).
    kwargs: optional caller kwargs â€” if it contains `"position_ids"` it is popped and returned.
    include_temporal: when ``True``, prepend a temporal-index column and return
        `(total_tokens, 3)` â€” for encoders whose rotary embedding rotates T/H/W axes
        (minimax_m3_vl). When ``False`` (default), return `(total_tokens, 2)` for the
        2-axis (h, w) case (qwen2_5_vl / qwen3_vl / glm4v / paddleocr_vl); the h/w
        indices are still repeated ``t`` times for video inputs.

Returns:
    `position_ids`: `(total_tokens, 3)` long if ``include_temporal`` else `(total_tokens, 2)`,
    with the spatial indices laid out block-major over ``mÃ—m`` spatial-merge blocks.
NÚposition_ids©ÚdeviceÚij)Úindexingr   r
   éÿÿÿÿ©r   r   )r   r&   Ú
isinstanceÚintr   ÚtensorÚexpandÚlenÚzipÚtolistÚmeshgridÚarangeÚreshapeÚ	transposeÚflattenr   ÚappendÚstackÚrepeatÚcat)r   Úspatial_merge_sizeÚinclude_temporalr   r$   r&   ÚtÚhÚwÚ
merge_sizeÚhpos_idsÚwpos_idsÚblock_shapeÚtpos_idss                 r   Úget_vision_position_idsrE   Q   s¬  € ð. Ñ¨v¯z©z¸.È$Ó/OÐO˜|Ñ\ØÐà�_‰_€FÜÐ$¤c×*Ñ*Ü"Ÿ\š\Ð+=Ð*>ÀvÑN×UÑUÔVYÐZbÓVcÓdÐà€LÜ!$ X§_¡_Ó%6Ð8J×8QÑ8QÓ8S×!TÑ‰	ˆˆqÜ"Ÿ^š^Ü�LŠL˜Ñ*Ü�LŠL˜Ñ*Øñ
Ñˆð
 ‘¨
¸±OÀZÐPˆØ×#Ñ# KÓ0×:Ñ:¸1¸aÓ@×HÑHÓJˆØ×#Ñ# KÓ0×:Ñ:¸1¸aÓ@×HÑHÓJˆÞÜ—|’| AÑ5×GÑGÈÉÓNˆHØ×Ñ¤§¢¨X·±ÀqÓ7IÈ8Ï?É?Ð[\ÓK]Ð,^ÐdfÑ g×hà×Ñ¤§¢¨XÐ,@ÀbÑ I× PÑ PÐQRÐTUÓ V×Wñ "Uô �9Š9�\ qÑ)Ð)r   c                ó8  • Ub-  UR                  SS5      nUR                  SS5      nUb  Ub  XV4$ / nS/nSnX!-  U-  nUS-  n	U R                  5        GHh  u  p«n[        U
5      [        U5      [        U5      pËn
X±-  nXÁ-  n[        R                  " X­-  U-  5      R                  X­U5      nX�U-  -
  nXŽU-  -
  nUU-   U-  nUU-   U-  n[        R                  " USUSU4SS5      nUR                  U
UUUU5      nUR                  SSS	SS
5      R                  U
UU-  Xˆ5      nUS:g  R                  SS	/5      R                  S5      nUR                  S5      nUUS:g     nUR                  UU-   5        UR                  S5      U	-  US   -   nUR                  UR                  5       5        XzU-  U-  -  nGMk     [        R                  " USS9n[        R                  " X`R                  [        R                   S9n[        R"                  " U5      nXV4$ )ux  Get window attention indices, or pop `"window_index"`/`"cu_window_seqlens"` from `kwargs` if both precomputed.

Args:
    grid_thw: `(num_images_or_videos, 3)`
    spatial_merge_size: merge block size from vision config.
    window_size: window size from vision config.
    patch_size: patch size from vision config.
    kwargs: optional caller kwargs â€” if it contains both `"window_index"` and `"cu_window_seqlens"` they are popped and returned.

Returns:
    `window_index`: `(total_tokens,)` long â€” reorder indices for windowed attention.
    `cu_window_seqlens`: `(num_windows + 1,)` int32 â€” cumulative window boundaries.
NÚwindow_indexÚcu_window_seqlensr   r
   Úconstantiœÿÿÿr   é   é   r)   r*   )r&   r   )r   r1   r,   r   r3   r4   r   r   ÚpermuteÚsumr7   r   Úextendr:   r-   r&   r   Úunique_consecutive)r   r;   Úwindow_sizeÚ
patch_sizer   rG   rH   Úwindow_index_idÚvit_merger_window_sizeÚspatial_merge_unitÚgrid_tÚgrid_hÚgrid_wÚ
llm_grid_hÚ
llm_grid_wÚindexÚpad_hÚpad_wÚnum_windows_hÚnum_windows_wÚindex_paddedr   Ú	index_newÚcu_seqlens_tmps                           r   Úget_vision_window_indexrb   ‚   s`  € ð( ÑØ—z‘z .°$Ó7ˆØ"ŸJ™JÐ':¸DÓAÐØÑ#Ð(9Ñ(EØÐ2Ð2Ø€LØ ˜cÐØ€OØ(Ñ>À*ÑLÐØ+¨QÑ.Ðà"*§/¡/×"3Ñˆ˜Ü!$ V£¬c°&«k¼3¸v»;˜ˆØÑ1ˆ
ØÑ1ˆ
Ü—’˜VÑ0°:Ñ=Ó>×FÑFÀvÐ[eÓfˆØ&Ð6LÑ)LÑLˆØ&Ð6LÑ)LÑLˆØ# eÑ+Ð0FÑFˆØ# eÑ+Ð0FÑFˆÜ—u’u˜U Q¨¨q°%Ð$8¸*ÀdÓKˆØ#×+Ñ+Ø�MÐ#9¸=ÐJ`ó
ˆð $×+Ñ+¨A¨q°!°Q¸Ó:×BÑBØ�M MÑ1Ð3Ió
ˆð   4Ñ'×,Ñ,¨a°¨VÓ4×<Ñ<¸RÓ@ˆØ#×+Ñ+¨BÓ/ˆØ  °Ñ!5Ñ6ˆ	Ø×Ñ˜I¨Ñ7Ô8Ø Ÿ™¨Ó*Ð-?Ñ?ÐBSÐTVÑBWÑWˆØ× Ñ  ×!6Ñ!6Ó!8Ô9Ø JÑ.°Ñ;Ñ;‹ñ- #4ô0 —9’9˜\¨qÑ1€LÜŸšÐ%6¿¹ÔV[×VaÑVaÑbÐÜ×0Ò0Ð1BÓCÐØÐ*Ð*r   c                ó:  • U R                  [        R                  5      n U(       a!  XS-
  -  [        R                  " US-
  SS9-  nOU S-   U-  U-  S-
  n[        R                  " U5      nUS:X  a!  [        R
                  " SSU R                  S9nO7US:X  a!  [        R
                  " S	S
U R                  S9nO[        SU< S35      eUR                  5       SS2S4   U-   n	U	R                  SUS-
  5      n
USS2S4   USS2S4   -
  U-
  R                  5       nUS:X  a  SU-
  R                  SS9nOOSnUS-   U-  US
-   -
  U-  U-  S-   nXÛ-  SU-  -
  U-  SU-  -   U-  SU-  -
  n[        R                  " US:*  Xï5      nUS:X  a  XÉS:¬  X’S-
  :*  -  -  nX¬4$ )u÷  Per-axis interpolation taps into a `side`-length source table and their weights, for `index`
target positions on an axis of length `size`. `mode` selects the kernel width â€” 2 taps
(`"bilinear"`) or 4 taps (`"bicubic"`, Keys convolution kernel with `a=-0.75`). `size` may be a
scalar or a per-element tensor (ragged batches). `padding` controls out-of-range taps: `"border"`
clamps to the edge value (like `F.interpolate`), `"zeros"` gives them zero weight (like
`F.grid_sample(padding_mode="zeros")`).r   )Úming      à?Úbilinearr   r
   r%   Úbicubicr)   rJ   zUnsupported interpolation mode z$ (expected 'bilinear' or 'bicubic').Ng      è¿é   é   rK   Úzeros)Útor   Úfloat32ÚclampÚfloorr3   r&   Ú
ValueErrorÚlongÚabsÚwhere)rZ   ÚsizeÚsideÚmodeÚalign_cornersÚpaddingÚsrcrm   ÚoffsetsÚraw_tapsÚtapsÚdistanceÚweightsÚaÚnearÚfars                   r   Ú _interpolation_axis_taps_weightsr€   ¿   s¼  € ð �H‰H”U—]‘]Ó#€EÞð ˜a‘xÑ ¤5§;¢;¨t°a©x¸QÑ#?Ñ?‰à�s‰{˜dÑ" TÑ)¨CÑ/ˆÜ�KŠK˜Ó€EØˆzÓÜ—,’,˜q !¨E¯L©LÑ9‰Ø	�Ó	Ü—,’,˜r 1¨U¯\©\Ñ:‰äÐ:¸4¹(ÐBfÐgÓhÐhØ�z‰z‹|šA˜t˜GÑ$ wÑ.€HØ�>‰>˜!˜T A™XÓ&€DØ’A�t�G‘˜u¢Q¨ W™~Ñ-°Ñ7×<Ñ<Ó>€HØˆzÓØ�x‘<×&Ñ&¨1Ð&Ð-‰àˆØ�Q‘˜(Ñ" a¨!¡eÑ,°Ñ8¸8ÑCÀaÑGˆØ‘˜q 1™uÑ$¨Ñ0°1°q±5Ñ8¸HÑDÀqÈ1ÁuÑLˆÜ—+’+˜h¨!™m¨TÓ7ˆØ�'Óð ¨!™m°À1¹HÑ0DÑEÑFˆØˆ=Ðr   c                ó�  • Ub-  UR                  SS5      nUR                  SS5      nUb  Ub  Xx4$ Un	Un
U R                  nU SS2S4   U SS2S4   -  U SS2S4   -  n[        R                  " U SS2S4   U5      n[        R                  " U SS2S4   U5      n[        R                  " [        R
                  " UR                  S5      SS S5      U5      n[        R                  " UR                  5       US	9U-
  XÞ-  -  nXê-  nUU
-  nUU
-  U
-  nUXª-  -  U-  nUXª-  U-  -  nUU
-  U-   nUU
-  U-   n[        UXÙX#U5      u  nn[        UXéX#U5      u  nnUR                  S   nUSS2SS2S4   U	-  USS2SSS24   -   R                  SUU-  5      nUSS2SS2S4   USS2SSS24   -  R                  SUU-  5      nUU4$ )
uÙ  Per-patch gather indices/weights that resample a square learned `(num_grid_per_side,
num_grid_per_side)` position-embedding table to each image's `(h, w)` grid, or pop
`"interp_indices"`/`"interp_weights"` from `kwargs` if both precomputed.

Reproduces `F.interpolate(mode=mode, align_corners=align_corners)` as `(total_patches, n_taps)`
indices + weights (`n_taps` = 4 for `"bilinear"`, 16 for `"bicubic"` â€” the Keys kernel with
`a=-0.75`), consumed by a fused `F.embedding_bag` or a weighted `embedding` sum. Fully vectorised
over packed patches (ragged `(h, w)` handled with `repeat_interleave`, no per-image loop), so it
supports dynamic shapes like the other grid_thw precompute helpers. `spatial_merge_size > 1`
emits patches in spatial-merge-block order (for encoders that consume merged tokens); `1` keeps
raster order.

Args:
    grid_thw: `(num_images_or_videos, 3)` â€” temporal, height, width per entry.
    num_grid_per_side: `int(num_position_embeddings ** 0.5)` from the vision config.
    mode: `"bilinear"` or `"bicubic"`.
    align_corners: matches the corresponding `F.interpolate` flag.
    spatial_merge_size: merge block size; `1` keeps raster patch order.
    kwargs: optional caller kwargs â€” if it contains both `"interp_indices"` and `"interp_weights"`
        they are popped and returned.

Returns:
    `indices`: `(total_thw, n_taps)` long â€” gather indices into the flattened pos_embed table.
    `weights`: `(total_thw, n_taps)` float â€” interpolation weights.
NÚinterp_indicesÚinterp_weightsr   r   r
   r)   r   r%   )r   r&   r   r   r   r   r   r3   rM   r€   Úshaper4   )r   Únum_grid_per_sidert   ru   r;   rv   r   r‚   rƒ   rs   Úmerger&   ÚcountsÚheightsÚwidthsÚstartsÚwithinÚblocks_wÚin_colÚin_rowÚ	block_colÚ	block_rowÚrowÚcolÚh_tapsÚ	h_weightsÚw_tapsÚ	w_weightsÚnÚindicesr|   s                                  r   Ú,get_vision_interpolation_indices_and_weightsr™   ç   s
  € ðD ÑØŸ™Ð$4°dÓ;ˆØŸ™Ð$4°dÓ;ˆØÑ%¨.Ñ*DØ!Ð1Ð1à€DØ€EØ�_‰_€Fà’a˜�d‰^˜h¢q¨! t™nÑ,¨xº¸1¸©~Ñ=€FÜ×%Ò% hªq°!¨t¡n°fÓ=€GÜ×$Ò$ Xªa°¨d¡^°VÓ<€FÜ×$Ò$¤Q§U¢U¨6¯=©=¸Ó+;¸C¸RÐ+@À&Ó%IÈ6ÓR€Fä�lŠl˜6Ÿ:™:›<°Ñ7¸&Ñ@ÀWÑEUÑV€Fð ‰€HØ�e‰^€FØ˜‰o Ñ&€FØ˜E™MÑ*¨hÑ6€IØ˜5™=¨8Ñ3Ñ4€IØ
�eÑ
˜fÑ
$€CØ
�eÑ
˜fÑ
$€Cä8¸¸gÈTÐbiÓjÑ€FˆIÜ8¸¸fÈDÐahÓiÑ€FˆIØ�‰�Q‰€Aà’aš˜D�jÑ! DÑ(¨6²!°Tº1°*Ñ+=Ñ=×FÑFÀrÈ1ÈqÉ5ÓQ€GØššA˜t˜Ñ$ y²°Dº!°Ñ'<Ñ<×EÑEÀbÈ!ÈaÉ%ÓP€GØ�GÐÐr   c                óð   • [         R                  S5        Ub-  UR                  SS5      nUR                  SS5      nUb  Ub  XV4$ [        XSSUS9u  pxUR	                  SS	5      UR	                  SS	5      4$ )
uÒ   Deprecated â€” use [`get_vision_interpolation_indices_and_weights`] with `mode="bilinear"`,
`align_corners=True`. Returns the legacy `(4, total_thw)` layout (transpose of the unified helper's
`(total_thw, 4)`).a  `get_vision_bilinear_indices_and_weights` is deprecated and will be removed in v5.17. Use `get_vision_interpolation_indices_and_weights(..., mode='bilinear', align_corners=True)` instead (it returns `(total_thw, n_taps)`, the transpose of this function's output).NÚbilinear_indicesÚbilinear_weightsre   T)rt   ru   r;   r   r   )ÚloggerÚwarning_oncer   r™   r5   )	r   r…   r;   ru   r   r›   rœ   r˜   r|   s	            r   Ú'get_vision_bilinear_indices_and_weightsrŸ   ,  s—   € ô ×Ñð	_ôð
 ÑØ!Ÿ:™:Ð&8¸$Ó?ÐØ!Ÿ:™:Ð&8¸$Ó?ÐØÑ'Ð,<Ñ,HØ#Ð5Ð5ÜCØ¨*ÀDÐ]oñÑ€Gð ×Ñ˜Q Ó" G×$5Ñ$5°a¸Ó$;Ð;Ð;r   c                ó  • Ub  UR                  SS5      =nb  U$ U R                  n[        R                  " SU-  SSU-  US9n/ nU R	                  5        Hž  u  px[        U5      [        U5      p‡[        R                  " XtS9U-  n	[        R                  " X„S9U-  n
[        R                  " X•SS9n[        R                  " X¥SS9nUR                  USS2S4   U-  U-   R                  5       5        M      [        R                  " U5      $ )uå  Get nearest-neighbor position IDs into a `num_patches_per_side**2` 2-D table, or pop
from `kwargs` if precomputed.

For each image of size `(h, w)`, maps fractional grid coordinates `i/h` to the nearest
bucket on a `num_patches_per_side` grid (via `bucketize`) and flattens to 1-D embedding
indices, concatenated across all images. Used by NaViT-style packers (e.g. MiniCPM-V).

Args:
    target_sizes: `(num_images, 2)` int â€” `(h, w)` per image.
    num_patches_per_side: side length of the learned 2-D position-embedding grid.
    kwargs: optional caller kwargs â€” if it contains `"position_ids"` it is popped and returned.

Returns:
    `position_ids`: `(sum(h_i * w_i),)` long â€” flat indices into a `num_patches_per_side**2` table.
Nr$   r   g      ð?r%   T)Úright)
r   r&   r   r3   r1   r,   Ú	bucketizer7   r6   r:   )Útarget_sizesÚnum_patches_per_sider   Úpos_idsr&   Ú
boundariesÚpos_ids_listÚheightÚwidthÚh_coordsÚw_coordsÚbucket_hÚbucket_ws                r   Úget_vision_nearest_position_idsr®   F  sû   € ð$ Ñ¨&¯*©*°^ÀTÓ*JÐJ˜wÑWØˆØ× Ñ €FÜ—’˜aÐ"6Ñ6¸¸QÐAUÑ=UÐ^dÑe€JØ€LØ%×,Ñ,Ö.‰ˆÜ˜F›¤S¨£Z�Ü—<’< Ñ6¸Ñ?ˆÜ—<’< Ñ5¸Ñ=ˆÜ—?’? 8¸tÑDˆÜ—?’? 8¸tÑDˆØ×Ñ˜X¢a¨ gÑ.Ð1EÑEÈÑP×YÑYÓ[Ö\ñ /ô �9Š9�\Ó"Ð"r   c                óº   • Ub  UR                  SS5      =nb  U$ Uu  pE[        U S   R                  5       5      U-  [        U S   R                  5       5      U-  4$ )u¬  Get post-window-merge `(merged_h, merged_w)` Python ints, or pop from `kwargs` if precomputed.

`.view()` needs Python ints, but `target_sizes[0].item()` is non-traceable. Callers must pop
the precomputed value from `kwargs` when running under `torch.export`. Assumes uniform
`target_sizes` across the batch (standard NaViT preprocessing output).

Args:
    target_sizes: `(num_images, 2)` int â€” `(h, w)` per image.
    window_kernel_size: `(window_h, window_w)` window-attention kernel.
    kwargs: optional caller kwargs â€” if it contains `"merged_shape"` it is popped and returned.

Returns:
    `(merged_h, merged_w)`: per-image grid size after window merging, as Python ints.
NÚmerged_shape)r   r   )r   r   )r   r,   Úitem)r£   Úwindow_kernel_sizer   ÚmergedÚwindow_hÚwindow_ws         r   Úget_vision_merged_shaper¶   g  sh   € ð" Ñ¨¯©°NÀDÓ)IÐI˜vÑVØˆØ+Ñ€HÜˆ|˜DÑ!×&Ñ&Ó(Ó)¨XÑ5´s¸<ÈÑ;M×;RÑ;RÓ;TÓ7UÐYaÑ7aÐaÐar   )FN)r   útorch.Tensorr   Úboolr   údict | NoneÚreturnr·   )
r   r·   r    r   r   r¸   r   r¹   rº   ztuple[torch.Tensor, int | None])
r   r·   r;   zint | torch.Tensorr<   r¸   r   r¹   rº   r·   )N)r   r·   r;   r,   rP   r,   rQ   r,   r   r¹   rº   ú!tuple[torch.Tensor, torch.Tensor])Úborder)rZ   r·   rr   r·   rs   r,   rt   Ústrru   r¸   rv   r½   rº   r»   )re   Fr   r¼   N)r   r·   r…   r,   rt   r½   ru   r¸   r;   r,   rv   r½   r   r¹   rº   r»   )TN)r   r·   r…   r,   r;   r,   ru   r¸   r   r¹   rº   r»   )r£   r·   r¤   r,   r   r¹   rº   r·   )r£   r·   r²   útuple[int, int]r   r¹   rº   r¾   )Ú__doc__Ú
__future__r   r   Útorch.nn.functionalÚnnÚ
functionalr   Úconfiguration_utilsr   Úutilsr   Úutils.genericr   Ú
get_loggerÚ__name__r�   r   r"   rE   rb   r€   r™   rŸ   r®   r¶   © r   r   Ú<module>rÊ      sr  ðñõ #ã ß Ð å 1Ý Ý )ð 
×	Ò	˜HÓ	%€ð QUðFØðFØ,0ðFØBMðFàõFð: !Øð	
"Øð
"àð
"ð ð
"ð ð	
"ð
 %õ
"ð  #Øð	.*Øð.*à*ð.*ð ð.*ð ð	.*ð
 õ.*ðl ð:+Øð:+àð:+ð ð:+ð ð	:+ð
 ð:+ð 'õ:+ð| hpð%Øð%Ø+ð%Ø36ð%Ø>Að%ØRVð%Øadð%à&õ%ðV ØØØØðBØðBàðBð ðBð ð	Bð
 ðBð ðBð ðBð 'õBðR Øð<Øð<àð<ð ð<ð ð	<ð
 ð<ð 'õ<ð6 RVð#Øð#Ø69ð#ØCNð#àõ#ðD \`ðbØðbØ4CðbØMXðbàöbr   