+
    "Ý³jž  ã                  óš   € ^ RI Ht ^ RIHt ^ RIt^ RIHt ^ RIHu Ht	  ^ RI
Ht  ! R R]P                  4      tR#   ] d    Rt L"i ; i)é    )Úannotations)ÚOptionalN)ÚNVFP4Tensorc                  óR   a € ] tR t^tRtRR/R V 3R llltR R ltR R	 ltR
tV ;t	# )ÚTorchFP4LinearzGExecute one linear layer directly from NVFP4-packed checkpoint weights.ÚbiasNc               ó8   € V ^8„  d   QhRRRRRRRRRRRR	R
RRR/# )é   Úin_featuresÚintÚout_featuresÚweightútorch.TensorÚweight_scaleÚweight_block_sizeÚ
orig_dtypeztorch.dtyper   zOptional[torch.Tensor]ÚreturnÚNone© )Úformats   "Úa/home/luca/screen-checking/.venv/lib/python3.14/site-packages/gptqmodel/nn_modules/qlinear/fp4.pyÚ__annotate__ÚTorchFP4Linear.__annotate__   s\   € ÷ ñ ð ðð ð	ð
 ðð #ðð ðð  ðð %ðð 
ñó    c               	ó&  <€ \         SV `  4        Wn        W n        \	        V4      V n        W`n        V P                  R V4       V P                  RV4       \        V\        P                  4      '       d   V P                  RV4       R# RV n        R# )r   r   r   N)ÚsuperÚ__init__r   r   r   r   r   Úregister_bufferÚ
isinstanceÚtorchÚTensorr   )	Úselfr   r   r   r   r   r   r   Ú	__class__s	   &$$$$$$$€r   r   ÚTorchFP4Linear.__init__   sw   ø€ ô 	‰ÑÔØ&ÔØ(ÔÜ!$Ð%6Ó!7ˆÔØ$ŒØ×Ñ˜X vÔ.Ø×Ñ˜^¨\Ô:Ü�dœEŸL™L×)Ò)Ø× Ñ  ¨Ö.àˆDŽIr   c               ó   € V ^8„  d   QhRR/# )r
   r   z'NVFP4Tensor'r   )r   s   "r   r   r   -   s   € ÷ 

ñ 

 ñ 

r   c                ó–   € \         f   \        R4      h\        V P                  V P                  V P                  V P
                  R7      # )zIWrap the stored packed weight buffers into the torchao NVFP4 tensor view.z4TorchFP4Linear requires torchao NVFP4Tensor support.)Ú
block_sizer   )r   ÚRuntimeErrorr   r   r   r   )r"   s   &r   Ú_native_weightÚTorchFP4Linear._native_weight-   sC   € ô ÒÜÐUÓVÐVÜØ�K‰KØ×ÑØ×-Ñ-Ø—‘ô	
ð 	
r   c               ó    € V ^8„  d   QhRRRR/# )r
   Úxr   r   r   )r   s   "r   r   r   9   s   € ÷ 8ñ 8˜ð 8¨,ñ 8r   c                ó  € V P                   p\        V\        P                  4      '       d8   VP                  VP                  8w  d   VP                  VP                  R7      p\        P                  ! WP                  4       V4      # )zFDispatch one dense linear projection through the NVFP4 tensor wrapper.)Údtype)	r   r   r    r!   r.   ÚtoÚFÚlinearr)   )r"   r,   r   s   && r   ÚforwardÚTorchFP4Linear.forward9   s[   € ð �y‰yˆÜ�dœEŸL™L×)Ò)¨d¯j©j¸A¿G¹GÔ.CØ—7‘7 §¡�7Ó)ˆDÜ�xŠx˜×.Ñ.Ó0°$Ó7Ð7r   )r   r   r   r   r   )
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r)   r2   Ú__static_attributes__Ú__classcell__)r#   s   @r   r   r      s)   ø† ÙQðð (,÷ò õ.

÷8ó 8r   r   )Ú
__future__r   Útypingr   r    Útorch.nnÚnnÚtorch.nn.functionalÚ
functionalr0   Ú)torchao.prototype.mx_formats.nvfp4_tensorr   Ú	ExceptionÚModuler   r   r   r   Ú<module>rD      sG   ðõ #å ã Ý ß Ð ðÝEô
,8�R—Y‘Yö ,8øð	 ô Ø‚Kðús   ¡> ¾	A
Á	A
