Ë
    �…jë
  ã                   ój   — d dl Z d dlmZ d dlmZ d dlmZ  e j                  e«      Z	 G d„ de«      Z
y)é    N)ÚFusion)Úhelper)Ú	OnnxModelc                   ó*   ‡ — e Zd Zdefˆ fd„Zd„ Zˆ xZS )ÚFusionQuickGeluÚmodelc                 ó*   •— t         ‰| �  |ddg«       y )NÚ	QuickGeluÚMul)ÚsuperÚ__init__)Úselfr   Ú	__class__s     €új/root/aria/tools/markitdown-venv/lib/python3.12/site-packages/onnxruntime/transformers/fusion_quickgelu.pyr   zFusionQuickGelu.__init__   s   ø€ Ü‰Ñ˜ ¨e¨WÕ5ó    c                 ó4  — |j                   dk7  rt        j                  d«       y |}|j                  d   }| j                  j                  |dgdg«      }|€t        j                  d«       y |d   }| j                  j                  |dgdg«      }|€t        j                  d«       y |d   }| j                  j                  |j                  d   «      j                  «       }t        |dz
  «      d	k\  rt        j                  d
«       y |j                  d   |k7  rt        j                  d«       y t        j                  d|g|j                  d   g| j                  j                  d«      ¬«      }	d|	_        |	j                  j                  t        j                   d|«      g«       | j"                  j                  |||g«       | j$                  j'                  |	«       | j(                  | j*                  |	j,                  <   | j/                  d«       y )Nr   z/fuse_quickgelu: failed to match second Mul noder   ÚSigmoidé   z,fuse_quickgelu: failed to match Sigmoid nodez.fuse_quickgelu: failed to match first Mul nodeg     <û?gü©ñÒMbP?z3fuse_quickgelu: failed to match approximation valuezFfuse_quickgelu: failed to match root input with first Mul node's inputr
   )ÚinputsÚoutputsÚnamezcom.microsoftÚalpha)Úop_typeÚloggerÚdebugÚinputr   Úmatch_parent_pathÚget_constant_valueÚitemÚabsr   Ú	make_nodeÚoutputÚcreate_node_nameÚdomainÚ	attributeÚextendÚmake_attributeÚnodes_to_removeÚnodes_to_addÚappendÚthis_graph_nameÚnode_name_to_graph_namer   Úincrease_counter)
r   ÚnodeÚinput_name_to_nodesÚoutput_name_to_nodeÚsecond_mul_nodeÚ
root_inputÚsigmoid_nodeÚfirst_mul_nodeÚapproximation_valueÚnew_nodes
             r   ÚfusezFusionQuickGelu.fuse   sÞ  € ð �<‰<˜5Ò Ü�L‰LÐJÔKØàˆØ$×*Ñ*¨1Ñ-ˆ
à—z‘z×3Ñ3°OÀiÀ[ÐSTÐRUÓVˆØÐÜ�L‰LÐGÔHØØ# A‘ˆàŸ™×5Ñ5°lÀUÀGÈaÈSÓQˆØÐ!Ü�L‰LÐIÔJØØ'¨Ñ*ˆà"Ÿj™j×;Ñ;¸N×<PÑ<PÐQRÑ<SÓT×YÑYÓ[ÐÜÐ" \Ñ1Ó2°dÒ:Ü�L‰LÐNÔOØà×Ñ Ñ" jÒ0Ü�L‰LÐaÔbØä×#Ñ#ØØ�<Ø$×+Ñ+¨AÑ.Ð/Ø—‘×,Ñ,¨[Ó9ô	
ˆð *ˆŒØ×Ñ×!Ñ!¤6×#8Ñ#8¸ÐBUÓ#VÐ"WÔXà×Ñ×#Ñ# ^°\À?Ð$SÔTØ×Ñ× Ñ  Ô*Ø6:×6JÑ6Jˆ×$Ñ$ X§]¡]Ñ3Ø×Ñ˜kÕ*r   )Ú__name__Ú
__module__Ú__qualname__r   r   r7   Ú__classcell__)r   s   @r   r   r      s   ø„ ð6˜iõ 6ö7+r   r   )ÚloggingÚfusion_baser   Úonnxr   Ú
onnx_modelr   Ú	getLoggerr8   r   r   © r   r   ú<module>rB      s1   ðó å Ý Ý  à	ˆ×	Ñ	˜8Ó	$€ô;+�fõ ;+r   