o
    پi                     @   s@   d Z ddlZddlm  mZ ddlmZ G dd dejZdS )z% Linear layer (alternate definition)
    N)nnc                   @   s&   e Zd ZdZdejdejfddZdS )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                 C   sV   t j r"| jd ur| jj|jdnd }tj|| jj|jd|dS t|| j| jS )N)dtype)bias)	torchjitis_scriptingr   tor   Flinearweight)selfr   r    r   F/home/ubuntu/.local/lib/python3.10/site-packages/timm/layers/linear.pyforward   s   
zLinear.forwardN)__name__
__module____qualname____doc__r   Tensorr   r   r   r   r   r      s    r   )r   r   torch.nn.functionalr   
functionalr   r   r   r   r   r   <module>   s
    