espnet2.enh.layers.dptnet.ImprovedTransformerLayer
espnet2.enh.layers.dptnet.ImprovedTransformerLayer
class espnet2.enh.layers.dptnet.ImprovedTransformerLayer(rnn_type, input_size, att_heads, hidden_size, dropout=0.0, activation='relu', bidirectional=True, norm='gLN')
Bases: Module
Container module of the (improved) Transformer proposed in [1].
Reference: : Dual-path transformer network: Direct context-aware modeling for end-to-end monaural speech separation; Chen et al, Interspeech 2020.
- Parameters:
- rnn_type (str) – select from ‘RNN’, ‘LSTM’ and ‘GRU’.
- input_size (int) – Dimension of the input feature.
- att_heads (int) – Number of attention heads.
- hidden_size (int) – Dimension of the hidden state.
- dropout (float) – Dropout ratio. Default is 0.
- activation (str) – activation function applied at the output of RNN.
- bidirectional (bool , optional) – True for bidirectional Inter-Chunk RNN (Intra-Chunk is always bidirectional).
- norm (str , optional) – Type of normalization to use.
Initializes internal Module state, shared by both nn.Module and ScriptModule.
forward(x, attn_mask=None)
Defines the computation performed at every call.
Should be overridden by all subclasses.
NOTE
Although the recipe for forward pass needs to be defined within this function, one should call the Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.