a
    d                     @   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ejejd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   sZ   t j rD| jd ur$| jj|jdnd }tj|| jj|jd|dS t|| j| jS d S )N)dtype)bias)	torchZjitZis_scriptingr   tor   FZlinearZweight)selfr   r    r   [/var/www/html/stable-diffusion-webui/venv/lib/python3.9/site-packages/timm/layers/linear.pyforward   s    
zLinear.forwardN)__name__
__module____qualname____doc__r   ZTensorr   r   r   r   r   r      s   r   )r   r   Ztorch.nn.functionalr   Z
functionalr
   r   r   r   r   r   <module>   s   