U
    <ºcþ  ã                   @   sN   d dl Z d dlm  m  mZ d dlm  m  mZ G dd„ dej	ƒZ
dS )é    Nc                       sj   e Zd ZdZejZdejf‡ fdd„	Z	ej
ej
dœdd„Zdd	„ Ze‡ fd
d„ƒZe‡ fdd„ƒZ‡  ZS )Ú
LinearReLUa®  
    A LinearReLU module fused from Linear and ReLU modules

    We adopt the same interface as :class:`torch.ao.nn.quantized.Linear`.

    Attributes:
        Same as torch.ao.nn.quantized.Linear

    Examples::

        >>> # xdoctest: +SKIP
        >>> m = nn.intrinsic.LinearReLU(20, 30)
        >>> input = torch.randn(128, 20)
        >>> output = m(input)
        >>> print(output.size())
        torch.Size([128, 30])
    Tc                    s   t ƒ  ||||¡ d S ©N)ÚsuperÚ__init__)ÚselfZin_featuresZout_featuresZbiasZdtype©Ú	__class__© úT/tmp/pip-unpacked-wheel-gikjz4vx/torch/nn/intrinsic/quantized/modules/linear_relu.pyr      s    zLinearReLU.__init__)ÚxÚreturnc                 C   s   t jj || jj| j| j¡S r   )ÚtorchÚopsÚ	quantizedZlinear_reluZ_packed_paramsZscaleZ
zero_point)r   r   r	   r	   r
   Úforward   s       ÿzLinearReLU.forwardc                 C   s   dS )NZQuantizedLinearReLUr	   )r   r	   r	   r
   Ú	_get_name    s    zLinearReLU._get_namec                    s   t t| ƒ |¡S r   )r   r   Ú
from_float)ÚclsÚmodr   r	   r
   r   #   s    zLinearReLU.from_floatc                    s   t ƒ  |d ||¡S )Nr   )r   Úfrom_reference)r   Zref_linear_reluZoutput_scaleZoutput_zero_pointr   r	   r
   r   '   s    zLinearReLU.from_reference)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Únnir   Z_FLOAT_MODULEr   Zqint8r   ZTensorr   r   Úclassmethodr   r   Ú__classcell__r	   r	   r   r
   r      s   r   )r   Ztorch.ao.nn.quantizedZaoÚnnr   ZnnqZtorch.ao.nn.intrinsicZ	intrinsicr   ZLinearr   r	   r	   r	   r
   Ú<module>   s   