Ë
    f^(hO  ã                   óV   — d dl mZ d dlmZmZ d dlmZ d„ Zd„ Zd„ Z	d„ Z
d„ Zd	„ Zd
„ Zy)é    )ÚRefine)ÚunifyÚVar)Ú
TensorTypec                 ó�   — t        | «      }|j                  «        t        |j                  «      }t	        | j
                  |«       y)z-
    Calls our symbolic inferencer once.
    N)r   ÚrefineÚunify_eqÚconstraintsÚsubstitute_all_typesÚgraph©ÚtracedÚrÚmgus      úe/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/torch/fx/experimental/unify_refinements.pyÚ infer_symbolic_types_single_passr      s2   € ô 	ˆv‹€AØ‡H�H„JÜ
�1—=‘=Ó
!€CÜ˜Ÿ™ sÕ+ó    c                 ó<  — t        | «      }|j                  «        t        |j                  «      }t	        | j
                  |«       t        | «      }|j                  «        t        |j                  «      }t	        | j
                  |«       |j                  «        y)z¥
    Calls our symbolic inferencer twice.
    This is useful when one pass is not enough
    to infer all the information such as the case
    for braodcasting.
    N)r   r   r	   r
   r   r   Úsymbolic_relationsr   s      r   Úinfer_symbolic_typesr      sl   € ô 	ˆv‹€AØ‡H�H„JÜ
�1—=‘=Ó
!€CÜ˜Ÿ™ sÔ+äˆv‹€AØ‡H�H„JÜ
�1—=‘=Ó
!€CÜ˜Ÿ™ sÔ+à×ÑÕr   c                 ó°   — g }g }| D ]8  }|j                  |j                  «       |j                  |j                  «       Œ: t        |«      t        |«      fS )za
    Convert equality constraints in the right format
    to be used by unification library.
    )ÚappendÚlhsÚrhsÚtuple)Ú
list_of_eqr   r   Úeqs       r   Ú
convert_eqr   %   sR   € ð
 €CØ
€CØò ˆØ�
‰
�2—6‘6ÔØ�
‰
�2—6‘6Õðô �‹:”u˜S“zÐ!Ð!r   c                 ó6   — t        | «      \  }}t        ||«      S )z@
    Apply unification to a set of
    equality constraints
    )r   r   )r   r   r   s      r   r	   r	   2   s   € ô
 ˜*Ó%�H€CˆÜ��c‹?Ðr   c                 ó   — t        |t        «      r|| j                  «       v r| |   S |S t        |t        «      r_g }|j                  D ]:  }|| j                  «       v r|j                  | |   «       Œ*|j                  |«       Œ< t        t        |«      «      S t        |t        «      r&g }|D ]  }|j                  t        | |«      «       Œ |S t        |t        «      r/g }|D ]  }|j                  t        | |«      «       Œ t        |«      S |S )z2
    Apply the most general unifier to a type
    )	Ú
isinstancer   Úkeysr   Ú__args__r   r   ÚlistÚsubstitute_solution_one_type)ÚmappingÚtÚnew_typeÚtyps       r   r%   r%   ;   s  € ô �!”SÔØ�—‘“ÑØ˜1‘:ÐàˆHä	�A”zÔ	"ØˆØ—:‘:ò 	%ˆCØ�g—l‘l“nÑ$Ø—‘ ¨¡Õ-à—‘ Õ$ð		%ô
 œ% ›/Ó*Ð*ä	�A”tÔ	ØˆØò 	HˆCØ�O‰OÔ8¸À#ÓFÕGð	Hàˆä	�A”uÔ	ØˆØò 	HˆCØ�O‰OÔ8¸À#ÓFÕGð	Hä�X‹Ðð ˆr   c                 óà   — d}|r>d}|D ]4  }||   }||   |j                  «       v r||   }||   ||<   |||   k7  sŒ3d}Œ6 |rŒ>| j                  D ]  }t        ||j                  «      |_        Œ y)zž
    Apply the most general unifier to all types in a graph
    till reaching a fixed point. If the input and output graph
    are the same, we converge.
    TFN)r"   Únodesr%   Útype)r   r&   ÚflagÚkÚold_mapping_valÚnew_keyÚns          r   r   r   ^   s�   € ð €DÙ
ØˆØò 	ˆAØ% a™jˆOØ�q‰z˜WŸ\™\›^Ñ+Ø! !™*�Ø$ WÑ-�˜‘
Ø '¨!¡*Ó,Ø‘ð	ò ð �[‰[ò ?ˆÜ-¨g°q·v±vÓ>ˆ�ñ?r   c                 óŠ   — t        | j                  |j                  «      D ]   \  }}|j                  |j                  k7  sŒ  y y)zv
    A check equality to be used in fixed points.
    We do not use graph equality but instead type
    equality.
    FT)Úzipr+   r,   )Úg1Úg2r1   Úms       r   Úcheck_for_type_equalityr7   s   s>   € ô �B—H‘H˜bŸh™hÓ'ò ‰ˆˆ1Ø�6‰6�Q—V‘VÓÙðð r   N)Ú/torch.fx.experimental.graph_gradual_typecheckerr   Ú!torch.fx.experimental.unificationr   r   Útorch.fx.tensor_typer   r   r   r   r	   r%   r   r7   © r   r   ú<module>r<      s2   ðå Bß 8Ý +ò,òò(
"òò òF?ó*	r   