+
    ˜°³jÓ  ã                   ó:   € ^ RI t^ RIHt RR ltR tRR ltR tR# )é    Nc                óØ   aaa€ ^ RI Ho ^ RIHu Ho VVV3R lp\        V \        4      '       d-   V  Uu. uF
  q2! V4      NK  	  pp\        P                  ! V4      # V! V 4      pV# u upi )a&  Render matplotlib figure to numpy format.

Note that this requires the ``matplotlib`` package.

Args:
    figures (matplotlib.pyplot.figure or list of figures): figure or a list of figures
    close (bool): Flag to automatically close the figure

Returns:
    numpy.array: image in [CHW] order
Nc                 ó‚  <€ S	P                  V 4      pVP                  4        \        P                  ! VP	                  4       \        P
                  R 7      pV P                  P                  4       w  r4VP                  WC^.4      R,          p\        P                  ! V^^ R7      pS'       d   SP                  V 4       V# )©Údtype)ÚsourceÚdestination)ºNNNr	   :r   é   N)ÚFigureCanvasAggÚdrawÚnpÚ
frombufferÚbuffer_rgbaÚuint8ÚcanvasÚget_width_heightÚreshapeÚmoveaxisÚclose)
Úfigurer   ÚdataÚwÚhÚ	image_hwcÚ	image_chwr   ÚpltÚplt_backend_aggs
   &      €€€Ú_/home/luca/screen-checking/.venv/lib/python3.14/site-packages/torch/utils/tensorboard/_utils.pyÚrender_to_rgbÚ&figure_to_image.<locals>.render_to_rgb   s‹   ø€ Ø ×0Ñ0°Ó8ˆØ�‰ŒÜŸMšM¨&×*<Ñ*<Ó*>ÄbÇhÁhÔOˆØ�}‰}×-Ñ-Ó/‰ˆØ—L‘L !¨ Ó+¨IÕ6ˆ	Ü—K’K 	°!ÀÔCˆ	ßØ�I‰I�fÔØÐó    )	Úmatplotlib.pyplotÚpyplotÚmatplotlib.backends.backend_aggÚbackendsÚbackend_aggÚ
isinstanceÚlistr   Ústack)Úfiguresr   r   r   ÚimagesÚimager   r   s   &f    @@r   Úfigure_to_imager-      s^   ú€ õ $ß=Ð=÷	ô �'œ4× Ò Ù6=Ó>±g¨F�- Ö'±gˆÐ>Ü�xŠx˜ÓÐá˜gÓ&ˆØˆùò	 ?s   µA'c           
     ó  € V P                   w  rr4pV P                  \        P                  8X  d   \        P                  ! V 4      R,          p R pV! V P                   ^ ,          4      '       g|   \        ^V P                   ^ ,          P                  4       ,          V P                   ^ ,          ,
          4      p\        P                  ! V \        P                  ! WrW4V3R7      3^ R7      p ^VP                  4       ^,
          ^,          ,          pV P                   ^ ,          V,          p	\        P                  ! WW’W4V34      p \        P                  ! V RR7      p \        P                  ! WW„,          W•,          V34      p V # )a2  
Convert a 5D tensor into 4D tensor.

Conversion is done from [batchsize, time(frame), channel(color), height, width]  (5D tensor)
to [time(frame), new_width, new_height, channel] (4D tensor).

A batch of images are spread to a grid, which forms a frame.
e.g. Video with batchsize 16 will have a 4x4 grid.
g     ào@c                 ó@   € V ^ 8g  ;'       d    W ^,
          ,          ^ 8H  # )r   © )Únums   &r   Ú	is_power2Ú!_prepare_video.<locals>.is_power28   s   € Ø�a‰x×4Ð4˜c¨1¥W�o°!Ñ3Ð4r!   )Úshape)Úaxis)Úaxes)é   r   é   é   é   r
   )r4   r   r   r   Úfloat32ÚintÚ
bit_lengthÚconcatenateÚzerosr   Ú	transpose)
ÚVÚbÚtÚcr   r   r2   Úlen_additionÚn_rowsÚn_colss
   &         r   Ú_prepare_videorH   )   s  € ð —G‘G�M€Aˆ!�à‡w�w”"—(‘(ÔÜ�JŠJ�q‹M˜EÕ!ˆò5ñ
 �Q—W‘W˜Q•Z× Ò ä˜1 §¡¨¥
× 5Ñ 5Ó 7Õ7¸!¿'¹'À!½*ÕDÓEˆÜ�NŠN˜AœrŸxšx¨|ÀÀaÐ.HÔIÐJÐQRÔSˆà�A—L‘L“N QÕ&¨1Õ,Õ-€Fà�W‰W�Q�Z˜6Õ!€Fä
�
Š
�1˜v¨!°Ð2Ó3€AÜ
�Š�QÐ/Ô0€AÜ
�
Š
�1˜&�* f¥j°!Ð4Ó5€Aà€Hr!   c           	      óR  € \        V \        P                  4      '       g   \        R 4      hV P                  ^,          ^8X  d   \        P
                  ! W V .^4      p V P                  ^8w  g   V P                  ^,          ^8w  d   \        R4      hV P                  ^ ,          pV P                  ^,          pV P                  ^,          p\        W!4      p\        \        P                  ! \        V4      V,          4      4      p\        P                  ! ^W5,          WA,          3V P                  R7      p^ p\        V4       Fa  p\        V4       FO  p	Wr8¼  d    K  W,          VRWƒ,          V^,           V,          1W”,          V	^,           V,          13&   V^,           pKQ  	  Kc  	  V# )z*plugin error, should pass numpy array herez0Input should be a 4D numpy array with 3 channelsr   r	   )r'   r   ÚndarrayÚAssertionErrorr4   r>   ÚndimÚminr<   ÚceilÚfloatr?   r   Úrange)
ÚIÚncolsÚnimgÚHÚWÚnrowsr   ÚiÚyÚxs
   &&        r   Ú	make_gridrZ   M   s=  € ä�aœŸ™×$Ò$ÜÐIÓJÐJØ‡w�wˆq…z�Q„Ü�NŠN˜A !˜9 aÓ(ˆØ‡v�v�„{�a—g‘g˜a•j A”oÜÐOÓPÐPØ�7‰7�1�:€DØ	�‰��
€AØ	�‰��
€AÜ�Ó€EÜ”—’œ˜d› eÕ+Ó,Ó-€EÜ�XŠX�q˜!�) Q¥YÐ/°q·w±wÔ?€FØ	€AÜ�5Ž\ˆÜ�u–ˆAØŒyÚØBCÅ$ˆF�1�a•e˜q 1�u¨�kÐ)¨1­5°A¸µE¸Qµ;Ð+>Ð>Ñ?Ø�A•ŠAó	 ñ ð €Mr!   c                 óx  € \        \        V4      4      \        V4      8w  d   \        R V 24      h\        V P                  4      \        V4      8w  d   \        RV P                   RV 24      hVP	                  4       p\        V4      ^8X  dO   R Uu. uF  q!P                  V4      NK  	  ppV P                  V4      p\        V4      pVP                  ^^^ 4      # \        V4      ^8X  dd   R Uu. uF  q!P                  V4      NK  	  ppV P                  V4      pVP                  ^,          ^8X  d   \        P                  ! WfV.^4      pV# \        V4      ^8X  dL   R Uu. uF  q!P                  V4      NK  	  ppV P                  V4      p \        P                  ! W V .^4      p V # R# u upi u upi u upi )zNYou can not use the same dimension shorthand twice.             input_format: zKsize of input tensor and input format are different.         tensor shape: z, input_format: ÚNCHWÚHWCÚHWN)ÚlenÚsetrK   r4   ÚupperÚfindr@   rZ   r   r>   r)   )ÚtensorÚinput_formatrD   ÚindexÚtensor_NCHWÚ
tensor_CHWÚ
tensor_HWCs   &&     r   Úconvert_to_HWCri   i   s¬  € Ü
Œ3ˆ|ÓÓ¤ \Ó!2Ô2Üð  Ø'˜.ð*ó +ð 	+ä
ˆ6�<‰<ÓœC Ó-Ô-Üð  Ø—|‘|�nÐ$4°\°NðDó Eð 	Eà×%Ñ%Ó'€Lä
ˆ<Ó˜AÔÙ/5Ó6©v¨!×"Ñ" 1Ö%©vˆÐ6Ø×&Ñ& uÓ-ˆÜ˜{Ó+ˆ
Ø×#Ñ# A q¨!Ó,Ð,ä
ˆ<Ó˜AÔÙ/4Ó5©u¨!×"Ñ" 1Ö%©uˆÐ5Ø×%Ñ% eÓ,ˆ
Ø×Ñ˜AÕ !Ô#ÜŸš¨ÀÐ(LÈaÓPˆJØÐä
ˆ<Ó˜AÔÙ/3Ó4©t¨!×"Ñ" 1Ö%©tˆÐ4Ø×!Ñ! %Ó(ˆÜ—’˜6¨6Ð2°AÓ6ˆØˆñ	 ùò 7ùò 6ùò 5s   ÂF-Ã1F2Å$F7)T)é   )	Únumpyr   Únumpy.typingÚtypingÚnptr-   rH   rZ   ri   r0   r!   r   Ú<module>ro      s!   ðã Ý ôòD!ôHô8r!   