o
    i                     @   s0   d Z ddlZddlmZ G dd dejjZdS )z(Transducer joint network implementation.    N)get_activationc                       s\   e Zd ZdZ		ddededededed	d
f fddZdejdejd	ejfddZ	  Z
S )JointNetworka]  Transducer joint network module.

    Args:
        output_size: Output size.
        encoder_size: Encoder output size.
        decoder_size: Decoder output size..
        joint_space_size: Joint space size.
        joint_act_type: Type of activation for joint network.
        **activation_parameters: Parameters for the activation function.

       tanhoutput_sizeencoder_sizedecoder_sizejoint_space_sizejoint_activation_typereturnNc                    sT   t    tj||| _tjj||dd| _tj||| _t|fi || _	dS )z Construct a JointNetwork object.F)biasN)
super__init__torchnnLinearlin_enclin_declin_outr   joint_activation)selfr   r   r   r	   r
   activation_parameters	__class__ X/home/ubuntu/.local/lib/python3.10/site-packages/espnet2/asr_transducer/joint_network.pyr      s   

zJointNetwork.__init__enc_outdec_outc                 C   s$   |  | || | }| |S )aM  Joint computation of encoder and decoder hidden state sequences.

        Args:
            enc_out: Expanded encoder output state sequences (B, T, 1, D_enc)
            dec_out: Expanded decoder output state sequences (B, 1, U, D_dec)

        Returns:
            joint_out: Joint output state sequences. (B, T, U, D_out)

        )r   r   r   r   )r   r   r   	joint_outr   r   r   forward*   s   
zJointNetwork.forward)r   r   )__name__
__module____qualname____doc__intstrr   r   Tensorr   __classcell__r   r   r   r   r      s0    r   )r#   r   !espnet2.asr_transducer.activationr   r   Moduler   r   r   r   r   <module>   s    