+
    &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	# )IdentityzA 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   "l/Users/jameslopez/projects/CWCArchive/cwc-podcast/.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#      "(( rxx 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|    		#
*+ii''+ ( 

 		))F"n * DI 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.ARARSTAU@VV]^dhl^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#      "(( rxx 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qx.*:*:;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SM#I sm#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    : -- bcgbhhij  ''$EE**4T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     			#+,ii''[9 ( 

 		))F"n * DI 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%~cU. FdN#%	
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.      288  bhh 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   WP                  ,           pV# )Nr5   )rD   r>   reshaperU   swapaxessqueezer5   )	r   ru   rv   rp   rq   rr   xshapewys	   &&&      r   r%   Bilinear.__call__   s    ))##2ZZC ZZAs# KK	3/HIIb##,,R4FIIaL II#v#s# T>II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   