+
    ƒ°ñj±
  ã                   óF   € ^ RI t ^ RItR
R R lltRR/R R lltR R	 ltR# )é    Nc                ó$   € V ^8„  d   QhR\         /# )é   Ústart)Úfloat)Úformats   "ÚJC:\Ai_Coding\apps\studio\ComfyUI\comfy\ldm\genmo\joint_model\rope_mixed.pyÚ__annotate__r	   	   s   € ÷ (ñ (”5ñ (ó    c                óv   € \         P                  ! WV^,           W4R7      pVRR VR,          ,           ^,          # )a8  linspace through bin centers.

Args:
    start (float): Start of the range.
    stop (float): End of the range.
    num (int): Number of points.
    dtype (torch.dtype): Data type of the points.
    device (torch.device): Device of the points.

Returns:
    centers (Tensor): Centers of the bins. Shape: (num,).
©ÚdtypeÚdeviceN:é   NNéÿÿÿÿ)ÚtorchÚlinspace)r   ÚstopÚnumr   r   Úedgess   &&&&& r   Úcentersr   	   s4   € ô �NŠN˜5¨¨a­°uÔL€EØ�#�2ˆJ˜˜r�Õ" aÕ'Ð'r
   Útarget_areai �  c                óˆ   € V ^8„  d   QhR\         R\         R\         R\        P                  R\        P                  R\        /# )r   ÚTÚpHÚpWr   r   r   )Úintr   r   r   r   )r   s   "r   r	   r	      sL   € ÷ &ñ &Ü
ð&äð&ô 	ð&ô �L‰Lð	&ô
 �;‰;ð&ô ñ&r
   c               óÒ  € \         P                  ! WR7      p\        P                  ! WRV,          ,          4      p\	        V) V,          ^,          W',          ^,          V4      p\	        V) V,          ^,          W,          ^,          V4      p	\         P
                  ! WiVRR7      w  r«p\         P                  ! W«V.RR7      pVP                  R^4      pVP                  WCR7      pV# )z¸
Args:
    T: int - Temporal dimension
    pH: int - Height dimension after patchify
    pW: int - Width dimension after patchify

Returns:
    pos: [T * pH * pW, 3] - position matrix
)r   Úij)Úindexing)Údimr   r   )	r   ÚarangeÚmathÚsqrtr   ÚmeshgridÚstackÚviewÚto)r   r   r   r   r   r   ÚtÚscaleÚwÚhÚgrid_tÚgrid_hÚgrid_wÚposs   &&&&&$        r   Úcreate_position_matrixr0      s¹   € ô& 	�Š�QÔ$€Aô �IŠI�k¨"¥WÕ-Ó.€EÜ���e•˜a• ¥¨a¥°Ó4€AÜ���e•˜a• ¥¨a¥°Ó4€Aô #Ÿ^š^¨A°!¸dÔCÑ€F�Fô �+Š+�v vÐ.°BÔ
7€CØ
�(‰(�2�q‹/€CØ
�&‰&�uˆ&Ó
,€Cà€Jr
   c                óX   € V ^8„  d   QhR\         P                  R\         P                  /# )r   Úfreqsr/   )r   ÚTensor)r   s   "r   r	   r	   D   s$   € ÷  ñ  Ü�<‰<ð ä	�‰ñ r
   c                óÔ   € V P                   ^8X  g   Q h\        P                  ! RVP                  V 4      V 4      p\        P                  ! V4      p\        P
                  ! V4      pW43# )ay  
Project each 3-dim position into per-head, per-head-dim 1D frequencies.

Args:
    freqs: [3, num_heads, num_freqs] - learned rotation frequency (for t, row, col) for each head position
    pos: [N, 3] - position of each token
    num_heads: int

Returns:
    freqs_cos: [N, num_heads, num_freqs] - cosine components
    freqs_sin: [N, num_heads, num_freqs] - sine components
zNd,dhf->Nhf)Úndimr   Úeinsumr'   ÚcosÚsin)r2   r/   Ú	freqs_sumÚ	freqs_cosÚ	freqs_sins   &&   r   Úcompute_mixed_rotationr<   D   sS   € ð  �:‰:˜Œ?Ðˆ?Ü—’˜]¨C¯F©F°5«M¸5ÓA€IÜ—	’	˜)Ó$€IÜ—	’	˜)Ó$€IØÐÐr
   )NN)r"   r   r   r0   r<   © r
   r   Ú<module>r>      s'   ðó ã ÷(ð$&ð ÷&÷R r
   