
    Pi                     @    d dl Z d dl mZ  G d dej                  ZdS )    N)nnc                   H     e Zd ZdZd fdZdej        dej        fdZ xZS )TanhGatez8Implements a basic learnable gate to scale layer outputsreturnNc                     t                                                       t          j        t	          j        d                    | _        d S )N   )super__init__r   	Parametertorchzerosscale)self	__class__s    o/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/torchtune/modules/tanh_gate.pyr
   zTanhGate.__init__   s6    \%+a..11


    xc                 :    || j                                         z  S )z
        Args:
            x (torch.Tensor): input tensor to gate

        Returns:
            torch.Tensor: The output tensor after gating. Has the same shape as ``x``.
        )r   tanh)r   r   s     r   forwardzTanhGate.forward   s     4:??$$$$r   )r   N)	__name__
__module____qualname____doc__r
   r   Tensorr   __classcell__)r   s   @r   r   r      si        BB2 2 2 2 2 2% %%, % % % % % % % %r   r   )r   r   Moduler    r   r   <module>r      sX          % % % % %ry % % % % %r   