ó
    !Eñi~0  ã                   óÜ   • S SK r S SKJr  S SKrS SKJr  S SKJrJr  S SK	J
r
Jr  SSKJr  SSKJr  / S	Qr " S
 S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\\5      rg)é    N)ÚAny)ÚTensor)Ú
functionalÚinit)Ú	ParameterÚUninitializedParameteré   )ÚLazyModuleMixin)ÚModule)ÚBilinearÚIdentityÚ
LazyLinearÚLinearc                   óN   ^ • \ rS rSrSrS\S\SS4U 4S jjrS\S\4S	 jrS
r	U =r
$ )r   é   aã  A placeholder identity operator that is argument-insensitive.

Args:
    args: any argument (unused)
    kwargs: any keyword argument (unused)

Shape:
    - Input: :math:`(*)`, where :math:`*` means any number of dimensions.
    - Output: :math:`(*)`, same shape as the input.

Examples::

    >>> m = nn.Identity(54, unused_argument1=0.1, unused_argument2=False)
    >>> input = torch.randn(128, 20)
    >>> output = m(input)
    >>> print(output.size())
    torch.Size([128, 20])

ÚargsÚkwargsÚreturnNc                 ó"   >• [         TU ]  5         g )N©ÚsuperÚ__init__)Úselfr   r   Ú	__class__s      €ÚT/home/mande/repo/quber/.venv/lib/python3.13/site-packages/torch/nn/modules/linear.pyr   ÚIdentity.__init__+   s   ø€ Ü‰ÑÕó    Úinputc                 ó   • U$ ©z
Runs the forward pass.
© ©r   r   s     r   ÚforwardÚIdentity.forward.   s	   € ð ˆr   r!   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r   r#   Ú__static_attributes__Ú__classcell__©r   s   @r   r   r      s:   ø† ñð(˜cð ¨Sð °T÷ ð˜Vð ¨÷ ò r   r   c            	       óœ   ^ • \ rS rSr% SrSS/r\\S'   \\S'   \\S'      SS\S\S\	SS4U 4S	 jjjr
SS
 jrS\S\4S jrS\4S jrSrU =r$ )r   é5   aÓ  Applies an affine linear transformation to the incoming data: :math:`y = xA^T + b`.

This module supports :ref:`TensorFloat32<tf32_on_ampere>`.

On certain ROCm devices, when using float16 inputs this module will use :ref:`different precision<fp16_on_mi200>` for backward.

Args:
    in_features: size of each input sample
    out_features: size of each output sample
    bias: If set to ``False``, the layer will not learn an additive bias.
        Default: ``True``

Shape:
    - Input: :math:`(*, H_\text{in})` where :math:`*` means any number of
      dimensions including none and :math:`H_\text{in} = \text{in\_features}`.
    - Output: :math:`(*, H_\text{out})` where all but the last dimension
      are the same shape as the input and :math:`H_\text{out} = \text{out\_features}`.

Attributes:
    weight: the learnable weights of the module of shape
        :math:`(\text{out\_features}, \text{in\_features})`. The values are
        initialized from :math:`\mathcal{U}(-\sqrt{k}, \sqrt{k})`, where
        :math:`k = \frac{1}{\text{in\_features}}`
    bias:   the learnable bias of the module of shape :math:`(\text{out\_features})`.
            If :attr:`bias` is ``True``, the values are initialized from
            :math:`\mathcal{U}(-\sqrt{k}, \sqrt{k})` where
            :math:`k = \frac{1}{\text{in\_features}}`

Examples::

    >>> m = nn.Linear(20, 30)
    >>> input = torch.randn(128, 20)
    >>> output = m(input)
    >>> print(output.size())
    torch.Size([128, 30])
Úin_featuresÚout_featuresÚweightNÚbiasr   c                 ó,  >• XES.n[         TU ]  5         Xl        X l        [	        [
        R                  " X!440 UD65      U l        U(       a&  [	        [
        R                  " U40 UD65      U l        OU R                  SS 5        U R                  5         g ©N©ÚdeviceÚdtyper2   )r   r   r/   r0   r   ÚtorchÚemptyr1   r2   Úregister_parameterÚreset_parameters)r   r/   r0   r2   r6   r7   Úfactory_kwargsr   s          €r   r   ÚLinear.__init__`   s   ø€ ð %+Ñ;ˆÜ‰ÑÔØ&ÔØ(ÔÜÜ�KŠK˜Ð3ÑF°~ÑFó
ˆŒö Ü!¤%§+¢+¨lÑ"M¸nÑ"MÓNˆD�Ià×#Ñ# F¨DÔ1Ø×ÑÕr   c                 óR  • [         R                  " U R                  [        R                  " S5      S9  U R
                  bg  [         R                  " U R                  5      u  pUS:”  a  S[        R                  " U5      -  OSn[         R                  " U R
                  U* U5        gg)úG
Resets parameters based on their initialization used in ``__init__``.
é   )ÚaNr   r	   )r   Úkaiming_uniform_r1   ÚmathÚsqrtr2   Ú_calculate_fan_in_and_fan_outÚuniform_)r   Úfan_inÚ_Úbounds       r   r;   ÚLinear.reset_parametersu   sv   € ô 	×Ò˜dŸk™k¬T¯YªY°q«\Ò:Ø�9‰9Ñ Ü×:Ò:¸4¿;¹;ÓG‰IˆFØ-3°a«Z�AœŸ	š	 &Ó)Ò)¸QˆEÜ�MŠM˜$Ÿ)™) e V¨UÕ3ð !r   r   c                 óX   • [         R                  " XR                  U R                  5      $ r    )ÚFÚlinearr1   r2   r"   s     r   r#   ÚLinear.forward‚   s   € ô �xŠx˜Ÿ{™{¨D¯I©IÓ6Ð6r   c                 óX   • SU R                    SU R                   SU R                  SL 3$ )ú0
Return the extra representation of the module.
zin_features=ú, out_features=ú, bias=N)r/   r0   r2   ©r   s    r   Ú
extra_reprÚLinear.extra_reprˆ   s:   € ð ˜d×.Ñ.Ð/¨¸t×?PÑ?PÐ>QÐQXÐY]×YbÑYbÐjnÐYnÐXoÐpÐpr   ©r2   r/   r0   r1   ©TNN©r   N©r%   r&   r'   r(   r)   Ú__constants__ÚintÚ__annotations__r   Úboolr   r;   r#   ÚstrrT   r*   r+   r,   s   @r   r   r   5   s�   ø‡ ñ#ðJ # NÐ3€MØÓØÓØƒNð ØØñ àð ð ð ð ð	 ð 
÷ ð  ô*4ð7˜Vð 7¨ô 7ðq˜C÷ qò qr   r   c            	       óF   ^ • \ rS rSr   S	S\S\S\SS4U 4S jjjrSrU =r$ )
ÚNonDynamicallyQuantizableLinearé”   Nr/   r0   r2   r   c                 ó$   >• [         TU ]  XX4US9  g )N)r2   r6   r7   r   )r   r/   r0   r2   r6   r7   r   s         €r   r   Ú(NonDynamicallyQuantizableLinear.__init__•   s   ø€ ô 	‰ÑØ¨DÀuð 	ò 	
r   r!   rW   )	r%   r&   r'   r(   r[   r]   r   r*   r+   r,   s   @r   r`   r`   ”   s>   ø† ð
 ØØñ

àð

ð ð

ð ð	

ð 
÷

ö 

r   r`   c                   ó®   ^ • \ rS rSr% Sr/ SQr\\S'   \\S'   \\S'   \\S'      SS\S\S\S	\	S
S4
U 4S jjjr
SS jrS\S\S
\4S jrS
\4S jrSrU =r$ )r   é¢   ao  Applies a bilinear transformation to the incoming data: :math:`y = x_1^T A x_2 + b`.

Args:
    in1_features: size of each first input sample, must be > 0
    in2_features: size of each second input sample, must be > 0
    out_features: size of each output sample, must be > 0
    bias: If set to ``False``, the layer will not learn an additive bias.
        Default: ``True``

Shape:
    - Input1: :math:`(*, H_\text{in1})` where :math:`H_\text{in1}=\text{in1\_features}` and
      :math:`*` means any number of additional dimensions including none. All but the last dimension
      of the inputs should be the same.
    - Input2: :math:`(*, H_\text{in2})` where :math:`H_\text{in2}=\text{in2\_features}`.
    - Output: :math:`(*, H_\text{out})` where :math:`H_\text{out}=\text{out\_features}`
      and all but the last dimension are the same shape as the input.

Attributes:
    weight: the learnable weights of the module of shape
        :math:`(\text{out\_features}, \text{in1\_features}, \text{in2\_features})`.
        The values are initialized from :math:`\mathcal{U}(-\sqrt{k}, \sqrt{k})`, where
        :math:`k = \frac{1}{\text{in1\_features}}`
    bias:   the learnable bias of the module of shape :math:`(\text{out\_features})`.
            If :attr:`bias` is ``True``, the values are initialized from
            :math:`\mathcal{U}(-\sqrt{k}, \sqrt{k})`, where
            :math:`k = \frac{1}{\text{in1\_features}}`

Examples::

    >>> m = nn.Bilinear(20, 30, 40)
    >>> input1 = torch.randn(128, 20)
    >>> input2 = torch.randn(128, 30)
    >>> output = m(input1, input2)
    >>> print(output.size())
    torch.Size([128, 40])
)Úin1_featuresÚin2_featuresr0   rf   rg   r0   r1   Nr2   r   c                 ó:  >• XVS.n[         TU ]  5         Xl        X l        X0l        [        [        R                  " X1U440 UD65      U l        U(       a&  [        [        R                  " U40 UD65      U l	        OU R                  SS 5        U R                  5         g r4   )r   r   rf   rg   r0   r   r8   r9   r1   r2   r:   r;   )	r   rf   rg   r0   r2   r6   r7   r<   r   s	           €r   r   ÚBilinear.__init__Î   s‡   ø€ ð %+Ñ;ˆÜ‰ÑÔØ(ÔØ(ÔØ(ÔÜÜ�KŠK˜°\ÐBÑUÀnÑUó
ˆŒö Ü!¤%§+¢+¨lÑ"M¸nÑ"MÓNˆD�Ià×#Ñ# F¨DÔ1Ø×ÑÕr   c                 ób  • U R                   S::  a  [        SU R                    S35      eS[        R                  " U R                  R                  S5      5      -  n[        R                  " U R                  U* U5        U R                  b$  [        R                  " U R                  U* U5        gg)r?   r   z0in1_features must be > 0, but got (in1_features=Ú)r	   N)	rf   Ú
ValueErrorrC   rD   r1   Úsizer   rF   r2   )r   rI   s     r   r;   ÚBilinear.reset_parametersæ   s’   € ð ×Ñ Ó!ÜØBÀ4×CTÑCTÐBUÐUVÐWóð ð ”D—I’I˜dŸk™k×.Ñ.¨qÓ1Ó2Ñ2ˆÜ�Š�d—k‘k E 6¨5Ô1Ø�9‰9Ñ Ü�MŠM˜$Ÿ)™) e V¨UÕ3ð !r   Úinput1Úinput2c                 óZ   • [         R                  " XU R                  U R                  5      $ r    )rL   Úbilinearr1   r2   )r   ro   rp   s      r   r#   ÚBilinear.forwardó   s   € ô �zŠz˜&¨$¯+©+°t·y±yÓAÐAr   c           	      ór   • SU R                    SU R                   SU R                   SU R                  SL 3$ )rP   zin1_features=z, in2_features=rQ   rR   N)rf   rg   r0   r2   rS   s    r   rT   ÚBilinear.extra_reprù   sL   € ð
 ˜D×-Ñ-Ð.¨o¸d×>OÑ>OÐ=Pð QØ ×-Ñ-Ð.¨g°d·i±iÀtÐ6KÐ5LðNð	
r   )r2   rf   rg   r0   r1   rW   rX   rY   r,   s   @r   r   r   ¢   s¡   ø‡ ñ#òJ E€MØÓØÓØÓØƒNð ØØñ àð ð ð ð ð	 ð
 ð ð 
÷ ð  ô04ðB˜fð B¨fð B¸ô Bð
˜C÷ 
ò 
r   r   c                   óv   ^ • \ rS rSr% Sr\r\\S'   \\S'    SS\	S\
SS4U 4S jjjrSU 4S	 jjrSS
 jrSrU =r$ )r   i  a¾  A :class:`torch.nn.Linear` module where `in_features` is inferred.

In this module, the `weight` and `bias` are of :class:`torch.nn.UninitializedParameter`
class. They will be initialized after the first call to ``forward`` is done and the
module will become a regular :class:`torch.nn.Linear` module. The ``in_features`` argument
of the :class:`Linear` is inferred from the ``input.shape[-1]``.

Check the :class:`torch.nn.modules.lazy.LazyModuleMixin` for further documentation
on lazy modules and their limitations.

Args:
    out_features: size of each output sample
    bias: If set to ``False``, the layer will not learn an additive bias.
        Default: ``True``

Attributes:
    weight: the learnable weights of the module of shape
        :math:`(\text{out\_features}, \text{in\_features})`. The values are
        initialized from :math:`\mathcal{U}(-\sqrt{k}, \sqrt{k})`, where
        :math:`k = \frac{1}{\text{in\_features}}`
    bias:   the learnable bias of the module of shape :math:`(\text{out\_features})`.
            If :attr:`bias` is ``True``, the values are initialized from
            :math:`\mathcal{U}(-\sqrt{k}, \sqrt{k})` where
            :math:`k = \frac{1}{\text{in\_features}}`


r1   r2   Nr0   r   c                 óŒ   >• X4S.n[         TU ]  SSS5        [        S0 UD6U l        Xl        U(       a  [        S0 UD6U l        g g )Nr5   r   Fr!   )r   r   r   r1   r0   r2   )r   r0   r2   r6   r7   r<   r   s         €r   r   ÚLazyLinear.__init__%  sL   ø€ ð %+Ñ;ˆô 	‰Ñ˜˜A˜uÔ%ä,Ñ>¨~Ñ>ˆŒØ(ÔÞä.Ñ@°Ñ@ˆD�Ið r   c                 óp   >• U R                  5       (       d   U R                  S:w  a  [        TU ]  5         ggg)r?   r   N)Úhas_uninitialized_paramsr/   r   r;   )r   r   s    €r   r;   ÚLazyLinear.reset_parameters4  s5   ø€ ð
 ×,Ñ,×.Ñ.°4×3CÑ3CÀqÓ3HÜ‰GÑ$Õ&ð 4IÐ.r   c                 ó¤  • U R                  5       (       a¦  [        R                  " 5          UR                  S   U l        U R
                  R                  U R                  U R                  45        U R                  b&  U R                  R                  U R                  45        U R                  5         SSS5        U R                  S:X  at  UR                  S   U R
                  R                  S   :w  a5  [        SUR                  S    SU R
                  R                  S    35      eUR                  S   U l        gg! , (       d  f       N“= f)zG
Infers ``in_features`` based on ``input`` and initializes parameters.
éÿÿÿÿNr   z%The in_features inferred from input: z/ is not equal to in_features from self.weight: )rz   r8   Úno_gradÚshaper/   r1   Úmaterializer0   r2   r;   ÚAssertionErrorr"   s     r   Úinitialize_parametersÚ LazyLinear.initialize_parameters<  s  € ð
 ×(Ñ(×*Ñ*Ü—’•Ø#(§;¡;¨r¡?�Ô Ø—‘×'Ñ'¨×):Ñ):¸D×<LÑ<LÐ(MÔNØ—9‘9Ñ(Ø—I‘I×)Ñ)¨4×+<Ñ+<Ð*>Ô?Ø×%Ñ%Ô'÷ !ð ×Ñ˜qÓ Ø�{‰{˜2‰ $§+¡+×"3Ñ"3°BÑ"7Ó7Ü$Ø;¸E¿K¹KÈ¹OÐ;Lð MEà—{‘{×(Ñ(¨Ñ,Ð-ð/óð ð
  %Ÿ{™{¨2™ˆDÕð !÷ !•ús   «B	EÅ
ErV   rW   rX   )r%   r&   r'   r(   r)   r   Úcls_to_becomer   r\   r[   r]   r   r;   r‚   r*   r+   r,   s   @r   r   r     sX   ø‡ ñð8 €Mà"Ó"Ø
 Ó ð HLñAØðAØ'+ðAà	÷Að A÷'÷/ò /r   r   )rC   Útypingr   r8   r   Útorch.nnr   rL   r   Útorch.nn.parameterr   r   Úlazyr
   Úmoduler   Ú__all__r   r   r`   r   r   r!   r   r   Ú<module>r‹      sl   ðã Ý ã Ý ß *ß @å !Ý ò€ôˆvô ô>WqˆVô Wqô~
 fô 
ô^
ˆvô ^
ôBL/� &õ L/r   