+
    Jåûj<Z  ã                   ó.  € R t ^ RIt^ RIt^ RIt^ RIHt RR.t ! R R]P                  P                  4      t ! R R]P                  P                  4      t	 ! R R	]P                  P                  4      t
 ! R
 R]P                  P                  4      tR# )z�
We will recreate all the RNN modules as we require the modules to be decomposed
into its building blocks to be able to observe.
N)ÚTensorÚLSTMCellÚLSTMc                   óÚ   a a€ ] tR t^t oRt]P                  P                  tR.t	RRR/V3R lV 3R llllt
RV3R lR lltRV3R lR	 lltR
 t]RR l4       t]RR l4       tRtVtV ;t# )r   a×  A quantizable long short-term memory (LSTM) cell.

For the description and the argument types, please, refer to :class:`~torch.nn.LSTMCell`

`split_gates`: specify True to compute the input/forget/cell/output gates separately
to avoid an intermediate tensor which is subsequently chunk'd. This optimization can
be beneficial for on-device inference latency. This flag is cascaded down from the
parent classes.

Examples::

    >>> import torch.ao.nn.quantizable as nnqa
    >>> rnn = nnqa.LSTMCell(10, 20)
    >>> input = torch.randn(6, 10)
    >>> hx = torch.randn(3, 20)
    >>> cx = torch.randn(3, 20)
    >>> output = []
    >>> for i in range(6):
    ...     hx, cx = rnn(input[i], (hx, cx))
    ...     output.append(hx)
Úsplit_gatesFc                ó0   <€ V ^8„  d   QhRS[ RS[ RS[RR/# ©é   Ú	input_dimÚ
hidden_dimÚbiasÚreturnN©ÚintÚbool)ÚformatÚ__classdict__s   "€Ú_C:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\torch\ao\nn\quantizable\modules\rnn.pyÚ__annotate__ÚLSTMCell.__annotate__,   s3   ø€ ÷ 8:ñ 8:áð8:ñ ð8:ñ ð	8:ð 
ñ8:ó    c               ó  <€ R VRV/p\         S	V `  4        Wn        W n        W0n        W`n        V'       gš   \        P                  P                  ! V^V,          3RV/VB V n	        \        P                  P                  ! V^V,          3RV/VB V n
        \        P                  P                  P                  P                  4       V n        EM\        P                  P                  4       V n	        \        P                  P                  4       V n
        \        P                  P                  4       V n        R F¢  p\        P                  P                  ! W3RV/VB V P                  V&   \        P                  P                  ! W"3RV/VB V P                  V&   \        P                  P                  P                  P                  4       V P                  V&   K¤  	  \        P                  P!                  4       V n        \        P                  P!                  4       V n        \        P                  P'                  4       V n        \        P                  P!                  4       V n        \        P                  P                  P                  P                  4       V n        \        P                  P                  P                  P                  4       V n        \        P                  P                  P                  P                  4       V n        \        P                  P                  P                  P                  4       V n        RV n        RV n        \        P8                  V n        \        P8                  V n        R# )ÚdeviceÚdtyper   N)ÚinputÚforgetÚcellÚoutput)ç      ð?é    )ÚsuperÚ__init__Ú
input_sizeÚhidden_sizer   r   ÚtorchÚnnÚLinearÚigatesÚhgatesÚaoÚ	quantizedÚFloatFunctionalÚgatesÚ
ModuleDictÚSigmoidÚ
input_gateÚforget_gateÚTanhÚ	cell_gateÚoutput_gateÚfgate_cxÚigate_cgateÚfgate_cx_igate_cgateÚogate_cyÚinitial_hidden_state_qparamsÚinitial_cell_state_qparamsÚquint8Úhidden_state_dtypeÚcell_state_dtype)
Úselfr
   r   r   r   r   r   Úfactory_kwargsÚgÚ	__class__s
   &&&&&&$  €r   r!   ÚLSTMCell.__init__,   sp  ø€ ð # F¨G°UÐ;ˆÜ‰ÑÔØ#ŒØ%ÔØŒ	Ø&ÔçÜ+0¯8©8¯?ª?Ø˜1˜z�>ñ,Ø04ð,Ø8Fñ,ˆDŒKô ,1¯8©8¯?ª?Ø˜A 
�Nñ,Ø15ð,Ø9Gñ,ˆDŒKô +0¯(©(¯+©+×*?Ñ*?×*OÑ*OÓ*QˆDŽJô  Ÿ(™(×-Ñ-Ó/ˆDŒKÜŸ(™(×-Ñ-Ó/ˆDŒKÜŸ™×,Ñ,Ó.ˆDŒJÛ:�ä!&§¡§¢Øñ"Ø04ð"Ø8Fñ"�—‘˜A‘ô "'§¡§¢Øñ"Ø15ð"Ø9Gñ"�—‘˜A‘ô !&§¡§¡× 5Ñ 5× EÑ EÓ G�—
‘
˜1“ñ ;ô  Ÿ(™(×*Ñ*Ó,ˆŒÜ Ÿ8™8×+Ñ+Ó-ˆÔÜŸ™Ÿ™›ˆŒÜ Ÿ8™8×+Ñ+Ó-ˆÔäŸ™Ÿ™×-Ñ-×=Ñ=Ó?ˆŒÜ Ÿ8™8Ÿ;™;×0Ñ0×@Ñ@ÓBˆÔÜ$)§H¡H§K¡K×$9Ñ$9×$IÑ$IÓ$KˆÔ!äŸ™Ÿ™×-Ñ-×=Ñ=Ó?ˆŒà?GˆÔ)Ø=EˆÔ'Ü/4¯|©|ˆÔÜ-2¯\©\ˆÖr   c                óf   <€ V ^8„  d   QhRS[ RS[S[ S[ 3,          R,          RS[S[ S[ 3,          /# )r	   ÚxÚhiddenNr   ©r   Útuple)r   r   s   "€r   r   r   f   s<   ø€ ÷ )ñ )Ùð)Ù!&¡v©v ~Õ!6¸Õ!=ð)á	‰v‘vˆ~Õ	ñ)r   c                óÂ  € Ve   V^ ,          e   V^,          f.   V P                  VP                  ^ ,          VP                  4      pVw  r4V P                  '       g˜   V P	                  V4      pV P                  V4      pV P                  P                  WV4      pVP                  ^^4      w  r‰r«V P                  V4      pV P                  V	4      p	V P                  V
4      p
V P                  V4      pMã/ p\        V P                  P                  4       V P                  P                  4       V P
                  P                  4       4       F(  w  w  r×rVVP                  V! V4      V! V4      4      WÍ&   K*  	  V P                  VR,          4      pV P                  VR,          4      p	V P                  VR,          4      p
V P                  VR,          4      pV P                   P#                  W”4      pV P$                  P#                  WŠ4      pV P&                  P                  Wï4      pTp\(        P*                  ! V4      pV P,                  P#                  VV4      pVV3# )Nr   r   r   r   )Úinitialize_hiddenÚshapeÚis_quantizedr   r'   r(   r,   ÚaddÚchunkr/   r0   r2   r3   ÚzipÚitemsÚvaluesr4   Úmulr5   r6   r$   Útanhr7   )r=   rC   rD   ÚhxÚcxr'   r(   r,   r/   r0   r2   Úout_gateÚgateÚkeyr4   r5   r6   ÚcyÚtanh_cyÚhys   &&&                 r   ÚforwardÚLSTMCell.forwardf   sô  € ð Š>˜V A�YÒ.°&¸µ)Ò2CØ×+Ñ+¨A¯G©G°A­J¸¿¹ÓGˆFØ‰ˆà××ÐØ—[‘[ “^ˆFØ—[‘[ “_ˆFØ—J‘J—N‘N 6Ó2ˆEà;@¿;¹;ÀqÈ!Ó;LÑ8ˆJ YàŸ™¨Ó4ˆJØ×*Ñ*¨;Ó7ˆKØŸ™ yÓ1ˆIØ×'Ñ'¨Ó1‰Hð ˆDÜ03Ø—
‘
× Ñ Ó"Ø—‘×"Ñ"Ó$Ø—‘×"Ñ"Ó$ö1Ñ,‘�˜fð
 "ŸI™I¡f¨Q£i±¸³Ó<�“	ñ1ð Ÿ™¨¨g­Ó7ˆJØ×*Ñ*¨4°­>Ó:ˆKØŸ™ t¨F¥|Ó4ˆIØ×'Ñ'¨¨X­Ó7ˆHà—=‘=×$Ñ$ [Ó5ˆØ×&Ñ&×*Ñ*¨:ÓAˆØ#×8Ñ8×<Ñ<¸XÓSÐØ!ˆô —*’*˜R“.ˆØ�]‰]×Ñ˜x¨Ó1ˆØ�2ˆvˆr   c                óB   <€ V ^8„  d   QhRS[ RS[RS[S[S[3,          /# )r	   Ú
batch_sizerJ   r   )r   r   rF   r   )r   r   s   "€r   r   r   ‘   s.   ø€ ÷ ñ ÙðÙ-1ðá	‰v‘vˆ~Õ	ñr   c                óZ  € \         P                  ! WP                  34      \         P                  ! WP                  34      rCV'       da   V P                  w  rVV P                  w  rx\         P
                  ! W5W`P                  R 7      p\         P
                  ! WGW€P                  R 7      pW43# )©ÚscaleÚ
zero_pointr   )r$   Úzerosr#   r8   r9   Úquantize_per_tensorr;   r<   )	r=   r]   rJ   ÚhÚcÚh_scaleÚh_zpÚc_scaleÚc_zps	   &&&      r   rH   ÚLSTMCell.initialize_hidden‘   s“   € ô �KŠK˜×%5Ñ%5Ð6Ó7Ü�KŠK˜×%5Ñ%5Ð6Ó7ð ÷ Ø"×?Ñ?‰OˆWØ"×=Ñ=‰OˆWÜ×)Ò)Ø¨T×9PÑ9PôˆAô ×)Ò)Ø¨T×9NÑ9NôˆAð ˆtˆr   c                ó   € R # )ÚQuantizableLSTMCell© ©r=   s   &r   Ú	_get_nameÚLSTMCell._get_name£   s   € Ù$r   c                óø  € VRJ VRJ 8w  d   \        R4      hVP                  ^,          pVP                  ^,          pV ! VVVRJVR7      pV'       gÃ   \        P                  P	                  V4      VP
                  n        Ve/   \        P                  P	                  V4      VP
                  n        \        P                  P	                  V4      VP                  n        Ve/   \        P                  P	                  V4      VP                  n        V# \        W.W4.VP
                  VP                  .4       F¼  w  ršp\        V	P                  ^^ R7      VP                  4       4       F)  w  rÍ\        P                  P	                  V4      Vn        K+  	  V
f   Kd  \        V
P                  ^^ R7      VP                  4       4       F)  w  rí\        P                  P	                  V4      Vn        K+  	  K¾  	  V# )z¥Uses the weights and biases to create a new LSTM cell.

Args:
    wi, wh: Weights for the input and hidden layers
    bi, bh: Biases for the input and hidden layers
Nz/bi and bh must both be None or both have values)r
   r   r   r   )Údim)ÚAssertionErrorrI   r$   r%   Ú	Parameterr'   Úweightr   r(   rM   rL   rO   )ÚclsÚwiÚwhÚbiÚbhr   r"   r#   r   ÚwÚbr,   Úw_chunkrU   Úb_chunks   &&&&&&         r   Úfrom_paramsÚLSTMCell.from_params¦   s‰  € ð �$ˆJ˜B $˜JÔ'Ü Ð!RÓSÐSØ—X‘X˜a•[ˆ
Ø—h‘h˜q•kˆÙØ Ø"Ø˜D�.Ø#ô	
ˆ÷ Ü!&§¡×!3Ñ!3°BÓ!7ˆD�K‰KÔØŠ~Ü#(§8¡8×#5Ñ#5°bÓ#9�—‘Ô Ü!&§¡×!3Ñ!3°BÓ!7ˆD�K‰KÔØŠ~Ü#(§8¡8×#5Ñ#5°bÓ#9�—‘Ô ð ˆô  # B 8¨b¨X¸¿¹ÀTÇ[Á[Ð7QÖR‘��eÜ%(¨¯©°¸¨Ó):¸E¿L¹L»NÖ%K‘M�GÜ"'§(¡(×"4Ñ"4°WÓ"=�D–Kñ &Lð ”=Ü),¨Q¯W©W°Q¸A¨WÓ->ÀÇÁÃÖ)O™˜Ü$)§H¡H×$6Ñ$6°wÓ$?˜ž	ó *Pñ  Sð ˆr   c                óœ  € \        V4      V P                  Jd%   \        R V P                   R\        V4       24      h\        VR4      '       g   \        R4      hV P	                  VP
                  VP                  VP                  VP                  VR7      pVP                  Vn	        VP                  VP                  n	        VP                  VP                  n	        V'       de   VP                  P                  4        F  pVP                  Vn	        K  	  VP                  P                  4        F  pVP                  Vn	        K  	  V# )úExpected module type ú, got Úqconfigz$The float module must have 'qconfig'©r   )ÚtypeÚ_FLOAT_MODULErs   Úhasattrr   Ú	weight_ihÚ	weight_hhÚbias_ihÚbias_hhr„   r'   r(   rO   )rv   ÚotherÚuse_precomputed_fake_quantr   Úobservedr?   s   &&&&  r   Ú
from_floatÚLSTMCell.from_floatÌ   s  € ä�‹;˜c×/Ñ/Ó/Ü Ø'¨×(9Ñ(9Ð':¸&ÄÀeÃÀÐNóð ô �u˜i×(Ò(Ü Ð!GÓHÐHØ—?‘?Ø�O‰OØ�O‰OØ�M‰MØ�M‰MØ#ð #ó 
ˆð !Ÿ=™=ˆÔØ"'§-¡-ˆ�‰ÔØ"'§-¡-ˆ�‰Ôßà—_‘_×+Ñ+Ö-�Ø!ŸM™M�–	ñ .à—_‘_×+Ñ+Ö-�Ø!ŸM™M�–	ñ .àˆr   )r   r2   r<   r4   r6   r0   r,   r(   r#   r;   r5   r'   r9   r8   r/   r"   r7   r3   r   ©TNN©N)F)NNF)FF)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r$   r%   r   r‡   Ú__constants__r!   rZ   rH   ro   Úclassmethodr   r�   Ú__static_attributes__Ú__classdictcell__Ú__classcell__©r@   r   s   @@r   r   r      s   ù‡ € ñð, —H‘H×%Ñ%€MØ"�O€Mñ8:ð ÷8:ö 8:÷t)ò )÷Vò ò$%ð ó#ó ð#ðJ óó ÷ð r   c                   ót   a a€ ] tR t^çt oRtR
RR/V3R lV 3R lllltRV3R lR llt]R 4       tR	t	Vt
V ;t# )Ú_LSTMSingleLayerz®A single one-directional LSTM layer.

The difference between a layer and a cell is that the layer can process a
sequence, while the cell only expects an instantaneous value.
r   Fc                ó0   <€ V ^8„  d   QhRS[ RS[ RS[RR/# r   r   )r   r   s   "€r   r   Ú_LSTMSingleLayer.__annotate__î   s3   ø€ ÷ 
ñ 
áð
ñ ð
ñ ð	
ð 
ñ
r   c               óZ   <€ R VRV/p\         SV `  4        \        W3RVRV/VB V n        R# ©r   r   r   r   N)r    r!   r   r   )	r=   r
   r   r   r   r   r   r>   r@   s	   &&&&&&$ €r   r!   Ú_LSTMSingleLayer.__init__î   sE   ø€ ð # F¨G°UÐ;ˆÜ‰ÑÔÜØñ
Ø(,ð
Ø:Eð
ØIWñ
ˆŽ	r   c                óJ   <€ V ^8„  d   QhRS[ RS[S[ S[ 3,          R,          /# ©r	   rC   rD   NrE   )r   r   s   "€r   r   r¢   þ   s)   ø€ ÷ %ñ %™ð %©©v±v¨~Õ)>ÀÕ)Eñ %r   c                óä   € . pVP                   ^ ,          p\        V4       F3  pV P                  W,          V4      pVP                  V^ ,          4       K5  	  \        P
                  ! V^ 4      pWb3# )r   )rI   Úranger   Úappendr$   Ústack)r=   rC   rD   ÚresultÚseq_lenÚiÚresult_tensors   &&&    r   rZ   Ú_LSTMSingleLayer.forwardþ   s_   € ØˆØ—'‘'˜!•*ˆÜ�w–ˆAØ—Y‘Y˜q�t VÓ,ˆFØ�M‰M˜& �)Ö$ñ  ô Ÿš F¨AÓ.ˆØÐ$Ð$r   c                ó¦   € \         P                  ! V/ VB pV ! VP                  VP                  VP                  VP
                  R 7      pW4n        V# )r…   )r   r   r"   r#   r   r   r   )rv   ÚargsÚkwargsr   Úlayers   &*,  r   r   Ú_LSTMSingleLayer.from_params  sJ   € ä×#Ò# TÐ4¨VÑ4ˆÙØ�O‰O˜T×-Ñ-¨t¯y©yÀd×FVÑFVô
ˆð Œ
Øˆr   )r   r’   r“   )r”   r•   r–   r—   r˜   r!   rZ   rš   r   r›   rœ   r�   rž   s   @@r   r    r    ç   sA   ù‡ € ññ
ð ÷
ö 
÷ %ò %ð ñó ÷ð r   r    c                   óx   a a€ ] tR tRt oRtRRR/V3R lV 3R lllltRV3R lR llt]RR	 l4       tR
t	Vt
V ;t# )Ú
_LSTMLayeri  z#A single bi-directional LSTM layer.Fr   c                ó<   <€ V ^8„  d   QhRS[ RS[ RS[RS[RS[RR/# )r	   r
   r   r   Úbatch_firstÚbidirectionalr   Nr   )r   r   s   "€r   r   Ú_LSTMLayer.__annotate__  sG   ø€ ÷ ñ áðñ ðñ ð	ñ
 ðñ ðð 
ñr   c               óÆ   <€ R VRV/p	\         S
V `  4        W@n        WPn        \	        W3RVRV/V	B V n        V P                  '       d   \	        VV3RVRV/V	B V n        R# R# r¤   )r    r!   r¹   rº   r    Úlayer_fwÚlayer_bw)r=   r
   r   r   r¹   rº   r   r   r   r>   r@   s   &&&&&&&&$ €r   r!   Ú_LSTMLayer.__init__  s”   ø€ ð # F¨G°UÐ;ˆÜ‰ÑÔØ&ÔØ*ÔÜ(Øñ
Ø(,ð
Ø:Eð
ØIWñ
ˆŒð ××ÐÜ,ØØñð ðð (ð	ð
 !ñˆDŽMñ r   c                óJ   <€ V ^8„  d   QhRS[ RS[S[ S[ 3,          R,          /# r§   rE   )r   r   s   "€r   r   r»   0  s)   ø€ ÷ 5ñ 5™ð 5©©v±v¨~Õ)>ÀÕ)Eñ 5r   c                ó´  € V P                   '       d   VP                  ^ ^4      pVf   RRrCMVw  r4RpV P                  '       d>   Vf   RpMV^,          pV^ ,          pVf   RpMV^,          pV^ ,          pVe   Ve   Wg3pVf   Vf   RpM>\        P                  P                  V4      \        P                  P                  V4      3pV P                  W4      w  r˜\        V R4      '       Ed   V P                  '       Ed   VP                  ^ 4      p
V P                  W¥4      w  rµVP                  ^ 4      p\        P                  ! W›.V	P                  4       ^,
          4      pVf
   Vf   RpRpM¾Vf#   \        P                  P                  V4      w  rÞM˜Vf#   \        P                  P                  V4      w  rÞMr\        P                  ! V^ ,          V^ ,          .^ 4      p\        P                  ! V^,          V^,          .^ 4      pM#T	p\        P                  P                  V4      w  rÞV P                   '       d   VP                  ^ ^4       WÍV33# )r   Nr¾   )r¹   Ú	transposerº   r$   ÚjitÚ_unwrap_optionalr½   rˆ   Úflipr¾   Úcatrr   r«   Ú
transpose_)r=   rC   rD   Úhx_fwÚcx_fwÚ	hidden_bwÚhx_bwÚcx_bwÚ	hidden_fwÚ	result_fwÚ
x_reversedÚ	result_bwr¬   rd   re   s   &&&            r   rZ   Ú_LSTMLayer.forward0  s
  € Ø××ÐØ—‘˜A˜qÓ!ˆAØŠ>Ø  $‘5à!‰LˆEØ26ˆ	Ø××ÐØŠ}Ø‘à˜a��Ø˜a��ØŠ}Ø‘à˜a��Ø˜a��ØÒ  UÒ%6Ø!˜L�	ØŠ=˜Uš]Ø‰Iô —	‘	×*Ñ*¨5Ó1Ü—	‘	×*Ñ*¨5Ó1ðˆIð  $Ÿ}™}¨QÓ:Ñˆ	ä�4˜×$Ó$¨×);×);Ñ);ØŸ™ ›ˆJØ#'§=¡=°Ó#GÑ ˆIØ!Ÿ™ qÓ)ˆIä—Y’Y 	Ð5°y·}±}³ÈÕ7JÓKˆFØÒ  YÒ%6Ø�Ø‘ØÒ"ÜŸ™×3Ñ3°IÓ>‘��AØÒ"ÜŸ™×3Ñ3°IÓ>‘��Aä—K’K ¨1¥¨y¸­|Ð <¸aÓ@�Ü—K’K ¨1¥¨y¸­|Ð <¸aÓ@‘àˆFÜ—9‘9×-Ñ-¨iÓ8‰DˆAà××ÐØ×Ñ˜a Ô#à˜1�vˆ~Ðr   c           	     ó\  € \        VR4      '       g   Vf   \        R4      hVP                  RVP                  4      pVP                  RVP                  4      pVP                  RVP
                  4      pVP                  RVP                  4      pVP                  RVP                  4      p	VP                  R	R
4      p
V ! VVVVV	V
R7      p\        VRV4      Vn	        \        VRV 24      p\        VRV 24      p\        VRV 2R4      p\        VRV 2R4      p\        P                  WÍWïV
R7      Vn        VP                  '       d`   \        VRV R24      p\        VRV R24      p\        VRV R2R4      p\        VRV R2R4      p\        P                  WÍWïV
R7      Vn        V# )z•
There is no FP equivalent of this class. This function is here just to
mimic the behavior of the `prepare` within the `torch.ao.quantization`
flow.
r„   Nú3other must have qconfig or qconfig must be providedr"   r#   r   r¹   rº   r   Fr…   Úweight_ih_lÚweight_hh_lÚ	bias_ih_lÚ	bias_hh_lÚ_reverse)rˆ   rs   Úgetr"   r#   r   r¹   rº   Úgetattrr„   r    r   r½   r¾   )rv   r�   Ú	layer_idxr„   r³   r"   r#   r   r¹   rº   r   r´   rw   rx   ry   rz   s   &&&&,           r   r�   Ú_LSTMLayer.from_floatg  sÄ  € ô �u˜i×(Ò(¨Wª_Ü Ð!VÓWÐWà—Z‘Z ¨e×.>Ñ.>Ó?ˆ
Ø—j‘j °×0AÑ0AÓBˆØ�z‰z˜& %§*¡*Ó-ˆØ—j‘j °×0AÑ0AÓBˆØŸ
™
 ?°E×4GÑ4GÓHˆØ—j‘j °Ó6ˆáàààààØ#ô
ˆô    y°'Ó:ˆŒÜ�U˜k¨)¨Ð5Ó6ˆÜ�U˜k¨)¨Ð5Ó6ˆÜ�U˜i¨	 {Ð3°TÓ:ˆÜ�U˜i¨	 {Ð3°TÓ:ˆä)×5Ñ5Ø�B¨ð 6ó 
ˆŒð ××ÐÜ˜ +¨i¨[¸Ð AÓBˆBÜ˜ +¨i¨[¸Ð AÓBˆBÜ˜ )¨I¨;°hÐ ?ÀÓFˆBÜ˜ )¨I¨;°hÐ ?ÀÓFˆBÜ-×9Ñ9Ø˜¨Kð :ó ˆEŒNð ˆr   )r¹   rº   r¾   r½   )TFFNNr“   )r   N)r”   r•   r–   r—   r˜   r!   rZ   rš   r�   r›   rœ   r�   rž   s   @@r   r·   r·     s@   ù‡ € Ù.ñð ÷ö ÷85ò 5ðn ó0ó ÷0ð 0r   r·   c                   óº   a a€ ] tR tRt oRt]P                  P                  tRRR/V3R lV 3R llllt	RV3R lR llt
R	 t]RR
 l4       t]R 4       tRtVtV ;t# )r   i›  a  A quantizable long short-term memory (LSTM).

For the description and the argument types, please, refer to :class:`~torch.nn.LSTM`

Attributes:
    layers : instances of the `_LSTMLayer`

.. note::
    To access the weights and biases, you need to access them per layer.
    See examples below.

Examples::

    >>> import torch.ao.nn.quantizable as nnqa
    >>> rnn = nnqa.LSTM(10, 20, 2)
    >>> input = torch.randn(5, 3, 10)
    >>> h0 = torch.randn(2, 3, 20)
    >>> c0 = torch.randn(2, 3, 20)
    >>> output, (hn, cn) = rnn(input, (h0, c0))
    >>> # To get the weights:
    >>> # xdoctest: +SKIP
    >>> print(rnn.layers[0].weight_ih)
    tensor([[...]])
    >>> print(rnn.layers[0].weight_hh)
    AssertionError: There is no reverse path in the non-bidirectional layer
Fr   c                óN   <€ V ^8„  d   QhRS[ RS[ RS[ RS[RS[RS[RS[RS[R	R
/	# )r	   r"   r#   Ú
num_layersr   r¹   Údropoutrº   r   r   N)r   r   Úfloat)r   r   s   "€r   r   ÚLSTM.__annotate__¹  sp   ø€ ÷ K2ñ K2áðK2ñ ðK2ñ ð	K2ñ
 ðK2ñ ðK2ñ ðK2ñ ðK2ñ ðK2ð 
ñK2r   c
          	     óö  <a a
a€ R VRV	/o\         SS `  4        VS n        VS n        VS n        VS n        VS n        \        V4      S n        VS n	        RS n
        \        V\        P                  4      '       d)   ^ Tu;8:  d   ^8:  d   M M\        V\        4      '       d   \        R4      hV^ 8”  d>   \         P"                  ! R^R7       V^8X  d   \         P"                  ! RV RV 2^R7       \%        S P                  S P                  S P
                  3RRR	S P                  R
S
/SB .pVP'                  VV V
3R l\)        ^V4       4       4       \*        P,                  P/                  V4      S n        R# )r   r   Fzbdropout should be a number in range [0, 1] representing the probability of an element being zeroedz|dropout option for quantizable LSTM is ignored. If you are training, please, use nn.LSTM version followed by `prepare` step.)Ú
stacklevelz‡dropout option adds dropout after all but last recurrent layer, so non-zero dropout expects num_layers greater than 1, but got dropout=z and num_layers=r¹   rº   r   c           
   3   óœ   <"  € T FA  p\        SP                  SP                  SP                  3R RRSP                  RS/SB x € KC  	  R# 5i)r¹   Frº   r   N)r·   r#   r   rº   )Ú.0Ú_r>   r=   r   s   & €€€r   Ú	<genexpr>Ú LSTM.__init__.<locals>.<genexpr>ø  sh   øé € ð 
ñ *�ô Ø× Ñ Ø× Ñ Ø—	‘	ñð "ð	ð
 #×0Ñ0ðð (ðð !öó *ùs   ƒA	AN)r    r!   r"   r#   rß   r   r¹   rá   rà   rº   ÚtrainingÚ
isinstanceÚnumbersÚNumberr   Ú
ValueErrorÚwarningsÚwarnr·   Úextendr©   r$   r%   Ú
ModuleListÚlayers)r=   r"   r#   rß   r   r¹   rà   rº   r   r   r   ró   r>   r@   s   f&&&&&&&&&d @€r   r!   ÚLSTM.__init__¹  s‚  û€ ð # F¨G°UÐ;ˆÜ‰ÑÔØ$ˆŒØ&ˆÔØ$ˆŒØˆŒ	Ø&ˆÔÜ˜W“~ˆŒØ*ˆÔØˆŒô ˜7¤G§N¡N×3Ò3Ø˜Ö$ 1×$Ü˜'¤4×(Ò(äðóð ð �QŒ;Ü�MŠMð.ð õ	ð ˜QŒÜ—’ðBàBIÀð K&Ø&0 \ð3ð  !õô Ø—‘Ø× Ñ Ø—	‘	ñð "ð	ð
 #×0Ñ0ðð (ðð !ñð

ˆð 	�‰ö 
ô ˜1˜jÔ)ó
ô 	
ô —h‘h×)Ñ)¨&Ó1ˆŽr   c                óJ   <€ V ^8„  d   QhRS[ RS[S[ S[ 3,          R,          /# r§   rE   )r   r   s   "€r   r   râ     s)   ø€ ÷ 5)ñ 5)™ð 5)©©v±v¨~Õ)>ÀÕ)Eñ 5)r   c                ó„  € V P                   '       d   VP                  ^ ^4      pVP                  ^4      pV P                  '       d   ^M^pVf«   \        P
                  ! VVV P                  \        P                  VP                  R7      pVP                  ^ 4       VP                  '       d%   \        P                  ! VR^ VP                  R7      p\        V P                  4       Uu. uF  qeV3NK  	  ppMë\        P                  P!                  V4      p\#        V^ ,          \$        4      '       d®   V^ ,          P'                  V P                  WCV P                  4      p	V^,          P'                  V P                  WCV P                  4      p
\        V P                  4       Uu. uF1  pW›,          P)                  ^ 4      W«,          P)                  ^ 4      3NK3  	  ppMTp. p. p\+        V P,                  4       Fv  w  r¾V! WV,          4      w  pw  ppVP/                  \        P                  P!                  V4      4       VP/                  \        P                  P!                  V4      4       Kx  	  \        P0                  ! V4      p\        P0                  ! V4      pVP'                  RVP2                  R,          VP2                  R,          4      pVP'                  RVP2                  R,          VP2                  R,          4      pV P                   '       d   VP                  ^ ^4      pVVV33# u upi u upi )r   )r   r   r   r_   éÿÿÿÿéþÿÿÿ)r¹   rÂ   Úsizerº   r$   rb   r#   rá   r   Úsqueeze_rJ   rc   r   r©   rß   rÃ   rÄ   rë   r   ÚreshapeÚsqueezeÚ	enumerateró   rª   r«   rI   )r=   rC   rD   Úmax_batch_sizeÚnum_directionsrb   rç   ÚhxcxÚhidden_non_optrR   rS   ÚidxÚhx_listÚcx_listr´   rd   re   Ú	hx_tensorÚ	cx_tensors   &&&                r   rZ   ÚLSTM.forward  s˜  € Ø××ÐØ—‘˜A˜qÓ!ˆAàŸ™ ›ˆØ"×0×0Ð0™°aˆØŠ>Ü—K’KØØØ× Ñ Ü—k‘kØ—x‘xôˆEð �N‰N˜1ÔØ�~�~ˆ~Ü×1Ò1Ø °¸!¿'¹'ô�ô -2°$·/±/Ô,BÓCÑ,B q˜E“NÑ,BˆDÐCˆDä"ŸY™Y×7Ñ7¸Ó?ˆNÜ˜.¨Õ+¬V×4Ò4Ø# AÕ&×.Ñ.Ø—O‘O ^ÀT×EUÑEUó�ð $ AÕ&×.Ñ.Ø—O‘O ^ÀT×EUÑEUó�ô
  % T§_¡_Ô5óá5˜ð •W—_‘_ QÓ'¨­¯©¸Ó);Ó<Ù5ð ð �ð
 &�àˆØˆÜ# D§K¡KÖ0‰JˆCÙ˜a c¥Ó+‰IˆA‰v��1Ø�N‰Nœ5Ÿ9™9×5Ñ5°aÓ8Ô9Ø�N‰Nœ5Ÿ9™9×5Ñ5°aÓ8Ö9ñ 1ô —K’K Ó(ˆ	Ü—K’K Ó(ˆ	ð ×%Ñ% b¨)¯/©/¸"Õ*=¸y¿¹ÈrÕ?RÓSˆ	Ø×%Ñ% b¨)¯/©/¸"Õ*=¸y¿¹ÈrÕ?RÓSˆ	à××ÐØ—‘˜A˜qÓ!ˆAà�9˜iÐ(Ð(Ð(ùòE Dùòs   Ã+L8Æ)7L=c                ó   € R # )ÚQuantizableLSTMrm   rn   s   &r   ro   ÚLSTM._get_name=  s   € Ù r   c                ó6  € \        WP                  4      '       g%   \        R V P                   R\        V4       24      h\	        VR4      '       g   V'       g   \        R4      hV ! VP
                  VP                  VP                  VP                  VP                  VP                  VP                  VR7      p\        VRV4      Vn        \        VP                  4       F)  p\        P!                  WVRVR7      VP"                  V&   K+  	  VP$                  '       d>   VP'                  4        \(        P*                  P,                  P/                  VRR7      pV# VP1                  4        \(        P*                  P,                  P3                  VRR7      pV# )	r‚   rƒ   r„   rÓ   r…   F)r¹   r   T)Úinplace)rë   r‡   rs   r†   rˆ   r"   r#   rß   r   r¹   rà   rº   rÚ   r„   r©   r·   r�   ró   rê   Útrainr$   r)   ÚquantizationÚprepare_qatÚevalÚprepare)rv   r�   r„   r   r�   r  s   &&&&  r   r�   ÚLSTM.from_float@  sY  € ä˜%×!2Ñ!2×3Ò3Ü Ø'¨×(9Ñ(9Ð':¸&ÄÀeÃÀÐNóð ô �u˜i×(Ò(·Ü Ð!VÓWÐWÙØ×ÑØ×ÑØ×ÑØ�J‰JØ×ÑØ�M‰MØ×ÑØ#ô	
ˆô # 5¨)°WÓ=ˆÔÜ˜×)Ñ)Ö*ˆCÜ#-×#8Ñ#8Ø˜G°ÀKð $9ó $ˆH�O‰O˜CÓ ñ +ð �>�>ˆ>Ø�N‰NÔÜ—x‘x×,Ñ,×8Ñ8¸È4Ð8ÓPˆHð ˆð �M‰MŒOÜ—x‘x×,Ñ,×4Ñ4°XÀtÐ4ÓLˆHØˆr   c                ó   € \        R 4      h)zuIt looks like you are trying to convert a non-quantizable LSTM module. Please, see the examples on quantizable LSTMs.)ÚNotImplementedError)rv   r�   s   &&r   Úfrom_observedÚLSTM.from_observedb  s   € ô "ð1ó
ð 	
r   )	r¹   r   rº   rà   r#   r"   ró   rß   rê   )é   TFg        FNNr“   )NF)r”   r•   r–   r—   r˜   r$   r%   r   r‡   r!   rZ   ro   rš   r�   r  r›   rœ   r�   rž   s   @@r   r   r   ›  so   ù‡ € ñð6 —H‘H—M‘M€MñK2ð "÷K2ö K2÷Z5)ò 5)òn!ð óó ððB ñ
ó ÷
ð 
r   )r˜   rì   rï   r$   r   Ú__all__r%   ÚModuler   r    r·   r   rm   r   r   Ú<module>r     s}   ðñó Û ã Ý ð �vÐ
€ôRˆu�x‰x�‰ô Rôj'�u—x‘x—‘ô 'ôTG�—‘—‘ô GôTO
ˆ5�8‰8�?‰?ö O
r   