
    kh                     X    d Z ddlZddlmc mZ ddlmZ  G d dej                        Zy)z% Linear layer (alternate definition)
    N)nnc                   H    e Zd ZdZdej
                  dej
                  fdZy)LinearzApplies a linear transformation to the incoming data: :math:`y = xA^T + b`

    Wraps torch.nn.Linear to support AMP + torchscript usage by manually casting
    weight & bias to input.dtype to work around an issue w/ torch.addmm in this use case.
    inputreturnc                 t   t         j                  j                         rp| j                  &| j                  j	                  |j
                        nd }t        j                  || j                  j	                  |j
                        |      S t        j                  || j                  | j                        S )N)dtype)bias)	torchjitis_scriptingr
   tor	   Flinearweight)selfr   r
   s      N/var/www/teggl/fontify/venv/lib/python3.12/site-packages/timm/layers/linear.pyforwardzLinear.forward   sw    99!!#6:ii6K499<<ekk<2QUD88E4;;>>>#D4PP88E4;;		::    N)__name__
__module____qualname____doc__r   Tensorr    r   r   r   r      s"    
;U\\ ;ell ;r   r   )r   r   torch.nn.functionalr   
functionalr   r   r   r   r   <module>r      s&       ;RYY ;r   