+
    NV-j¼  ã                   óˆ   € ^ RI t ^ RIHtHt ^ RIHt ^ RIHt ^ RI	H
t
Ht  ! R R]4      t ! R R]4      t ! R	 R
]4      tR# )é    N)ÚAnyÚOptional)ÚModule)ÚQQLinearÚQuantizedLinearc                   óT   a a€ ] tR t^t oRtV3R lV 3R lltV3R lR ltRtVtV ;t	# )ÚIdentityz�A placeholder identity operator that is argument-insensitive.

Args:
    args: any argument (unused)
    kwargs: any keyword argument (unused)
c                ó*   <€ V ^8„  d   QhRS[ RS[ RR/# )é   ÚargsÚkwargsÚreturnN)r   )ÚformatÚ__classdict__s   "€Úe/Volumes/fast/ai/experiments/ui-tars-smoke/.venv/lib/python3.14/site-packages/mlx/nn/layers/linear.pyÚ__annotate__ÚIdentity.__annotate__   s"   ø€ ÷ ñ ™cð ©Sð °Tñ ó    c                ó$   <€ \         SV `  4        R # ©N)ÚsuperÚ__init__)Úselfr   r   Ú	__class__s   &*,€r   r   ÚIdentity.__init__   s   ø€ Ü‰ÑÖr   c                óN   <€ V ^8„  d   QhRS[ P                  RS[ P                  /# ©r   Úxr   ©ÚmxÚarray)r   r   s   "€r   r   r      s#   ø€ ÷ ñ ™"Ÿ(™(ð ¡r§x¡xñ r   c                ó   € V# r   © ©r   r   s   &&r   Ú__call__ÚIdentity.__call__   s   € Øˆr   r#   )
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r%   Ú__static_attributes__Ú__classdictcell__Ú__classcell__©r   r   s   @@r   r	   r	      s#   ù‡ € ñ÷ó ÷÷ ð r   r	   c                   ó€   a a€ ] tR t^t oRtRV3R lV 3R llltV3R lR ltV3R lR ltRV3R lR	 lltR
t	Vt
V ;t# )ÚLinearaj  Applies an affine transformation to the input.

Concretely:

.. math::

    y = x W^\top + b

where:
where :math:`W` has shape ``[output_dims, input_dims]`` and :math:`b` has shape ``[output_dims]``.

The values are initialized from the uniform distribution :math:`\mathcal{U}(-{k}, {k})`,
where :math:`k = \frac{1}{\sqrt{D_i}}` and :math:`D_i` is equal to ``input_dims``.

Args:
    input_dims (int): The dimensionality of the input features
    output_dims (int): The dimensionality of the output features
    bias (bool, optional): If set to ``False`` then the layer will
      not use a bias. Default is ``True``.
c                ó0   <€ V ^8„  d   QhRS[ RS[ RS[RR/# )r   Ú
input_dimsÚoutput_dimsÚbiasr   N©ÚintÚbool)r   r   s   "€r   r   ÚLinear.__annotate__0   s*   ø€ ÷ ñ ¡3ð ±Sð Áð ÐPTñ r   c                ó  <€ \         SV `  4        \        P                  ! R V,          4      p\        P
                  P                  V) VW!3R7      V n        V'       d,   \        P
                  P                  V) VV3R7      V n        R# R# ©g      ð?)ÚlowÚhighÚshapeN©	r   r   ÚmathÚsqrtr    ÚrandomÚuniformÚweightr5   )r   r3   r4   r5   Úscaler   s   &&&& €r   r   ÚLinear.__init__0   s|   ø€ Ü‰ÑÔÜ—	’	˜# 
Õ*Ó+ˆÜ—i‘i×'Ñ'Ø�ØØÐ+ð (ó 
ˆŒ÷
 ÜŸ	™	×)Ñ)Ø�FØØ"�nð *ó ˆDŽIñ r   c                ó    <€ V ^8„  d   QhRS[ /# ©r   r   ©Ústr)r   r   s   "€r   r   r9   ?   s   ø€ ÷ oñ o™Sñ or   c                óŠ   € R V P                   P                  ^,           RV P                   P                  ^ ,           RRV 9    2# )zinput_dims=ú, output_dims=ú, bias=r5   ©rD   r>   )r   s   &r   Ú_extra_reprÚLinear._extra_repr?   sE   € Ø˜TŸ[™[×.Ñ.¨qÕ1Ð2°.ÀÇÁ×ARÑARÐSTÕAUÐ@VÐV]Ð^dÐhlÑ^lÐ]mÐnÐnr   c                óN   <€ V ^8„  d   QhRS[ P                  RS[ P                  /# r   r   )r   r   s   "€r   r   r9   B   s#   ø€ ÷ ñ ™"Ÿ(™(ð ¡r§x¡xñ r   c                ó¨   € R V 9   d2   \         P                  ! V R ,          WR,          P                  4      pV# WR,          P                  ,          pV# ©r5   rD   )r    ÚaddmmÚTr$   s   &&r   r%   ÚLinear.__call__B   sG   € Ø�TŒ>Ü—’˜˜f� q¨x­.×*:Ñ*:Ó;ˆAð ˆð ˜•N×$Ñ$Õ$ˆAØˆr   c                óR   <€ V ^8„  d   QhRS[ S[,          RS[ S[,          RS[RS[/# )r   Ú
group_sizeÚbitsÚmodeÚquantize_input)r   r7   rJ   r8   )r   r   s   "€r   r   r9   I   sA   ø€ ÷ #Iñ #Iá™S•Mð#Iñ ‘s�mð#Iñ ð	#Iñ
 ñ#Ir   c                óš   € V'       d.   VR9  d   \        RV R24      h\        P                  ! WW#4      # \        P                  ! WW#4      # )aK  Return a quantized approximation of this layer.

If ``quantize_input`` is ``False``, returns a :obj:`QuantizedLinear`
(weights are quantized). If ``quantize_input`` is ``True``, returns
a :obj:`QQLinear` (weights and activations are quantized).

Args:
    group_size (Optional[int]): The quantization group size (see
        :func:`mlx.core.quantize`). Default: ``None``.
    bits (Optional[int]): The number of bits per parameter (see
        :func:`mlx.core.quantize`). Default: ``None``.
    mode (str): The quantization method to use (see
        :func:`mlx.core.quantize`). Default: ``"affine"``.
    quantize_input (bool): Whether to quantize input. Default: ``False``.

Returns:
    QuantizedLinear or QQLinear: A quantized version of this layer.

Notes:
    Quantized input is only supported for ``"nvfp4"`` and ``"mxfp8"``
    modes.
zLQuantized activations are only supported for 'nvfp4' and 'mxfp8' modes, got Ú.)Únvfp4Úmxfp8)Ú
ValueErrorr   Úfrom_linearr   )r   rX   rY   rZ   r[   s   &&&&&r   Úto_quantizedÚLinear.to_quantizedI   sT   € ÷: ØÐ-Ô-Ü ØbÐcgÐbhÐhiÐjóð ô ×'Ò'¨¸$ÓEÐEÜ×*Ò*¨4¸TÓHÐHr   rS   ©T)NNÚaffineF)r'   r(   r)   r*   r+   r   rO   r%   rb   r,   r-   r.   r/   s   @@r   r1   r1      s<   ù‡ € ñ÷*õ ÷oð o÷ð ÷#I÷ #Iò #Ir   r1   c                   ój   a a€ ] tR t^ot oRtR	V3R lV 3R llltV3R lR ltV3R lR ltRtVt	V ;t
# )
ÚBilinearaå  Applies a bilinear transformation to the inputs.

Concretely:

.. math::

    y_i = x_1^\top W_i x_2 + b_i

where:
:math:`W` has shape ``[output_dims, input1_dims, input2_dims]``, :math:`b` has shape ``[output_dims ]``,
and :math:`i` indexes the output dimension.

The values are initialized from the uniform distribution :math:`\mathcal{U}(-{k}, {k})`,
where :math:`k = \frac{1}{\sqrt{D_1}}` and :math:`D_1` is ``input1_dims``.

Args:
    input1_dims (int): The dimensionality of the input1 features
    input2_dims (int): The dimensionality of the input2 features
    output_dims (int): The dimensionality of the output features
    bias (bool, optional): If set to ``False`` then the layer will
      not use a bias. Default is ``True``.
c          
      ó6   <€ V ^8„  d   QhRS[ RS[ RS[ RS[RR/# )r   Úinput1_dimsÚinput2_dimsr4   r5   r   Nr6   )r   r   s   "€r   r   ÚBilinear.__annotate__‡   s5   ø€ ÷ ñ ÙðÙ-0ðÙ?BðÙJNðà	ñr   c                ó  <€ \         SV `  4        \        P                  ! R V,          4      p\        P
                  P                  V) VW2V3R7      V n        V'       d,   \        P
                  P                  V) VV3R7      V n        R# R# r;   r?   )r   ri   rj   r4   r5   rE   r   s   &&&&& €r   r   ÚBilinear.__init__‡   s€   ø€ ô 	‰ÑÔÜ—	’	˜# Õ+Ó,ˆÜ—i‘i×'Ñ'Ø�ØØ¨[Ð9ð (ó 
ˆŒ÷
 ÜŸ	™	×)Ñ)Ø�FØØ"�nð *ó ˆDŽIñ r   c                ó    <€ V ^8„  d   QhRS[ /# rH   rI   )r   r   s   "€r   r   rk   ˜   s   ø€ ÷ 
ñ 
™Sñ 
r   c           	     óV   € V P                   P                  w  rpR V RV RV RRV 9    2# )zinput1_dims=z, input2_dims=rL   rM   r5   rN   )r   ÚoutÚin2Úin1s   &   r   rO   ÚBilinear._extra_repr˜   sB   € ØŸ™×)Ñ)‰ˆ�#à˜3˜%˜~¨c¨U°.ÀÀð FØ˜d‘NÐ#ð%ð	
r   c                óh   <€ V ^8„  d   QhRS[ P                  RS[ P                  RS[ P                  /# )r   Úx1Úx2r   r   )r   r   s   "€r   r   rk   Ÿ   s.   ø€ ÷ ñ ™2Ÿ8™8ð ©¯©ð ±b·h±hñ r   c                óÚ  € V P                   P                  w  r4pVP                  R R pVP                  RV4      pVP                  R^V4      pV P                   P                  W4,          V4      pWP                  ,          pVP                  RW44      P	                  RR4      pW(,          pVP                  ^4      pVP                  ! . VOVN5!  pRV 9   d   W€P                  ,           pV# )Nr5   éÿÿÿÿéþÿÿÿ)rD   r>   ÚreshaperU   ÚswapaxesÚsqueezer5   )	r   ru   rv   rp   rq   rr   ÚxshapeÚwÚys	   &&&      r   r%   ÚBilinear.__call__Ÿ   sÍ   € àŸ™×)Ñ)‰ˆ�#Ø—‘˜#˜2�ˆØ�Z‰Z˜˜CÓ ˆØ�Z‰Z˜˜A˜sÓ#ˆð �K‰K×Ñ ¥	¨3Ó/ˆØ—‘�HˆØ�I‰I�b˜#Ó#×,Ñ,¨R°Ó4ˆØ�FˆØ�I‰I�a‹Lˆð �IŠIÐ#�vÐ#˜sÓ#ˆð �TŒ>Ø—I‘I•ˆAàˆr   rS   rd   )r'   r(   r)   r*   r+   r   rO   r%   r,   r-   r.   r/   s   @@r   rg   rg   o   s-   ù‡ € ñ÷.õ ÷"
ð 
÷÷ ð r   rg   )r@   Útypingr   r   Úmlx.coreÚcorer    Úmlx.nn.layers.baser   Úmlx.nn.layers.quantizedr   r   r	   r1   rg   r#   r   r   Ú<module>r†      sA   ðó ß  å Ý %ß =ôˆvô ôRIˆVô RIôjEˆvö Er   