Skip to content

Commit

Permalink
better use sequential
Browse files Browse the repository at this point in the history
  • Loading branch information
mmz33 committed Nov 4, 2021
1 parent 4feeabe commit c0a1f78
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions nn/conformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def __init__(self, encoder_layer: nn.Module, num_blocks: int, conv_kernel_size:

self.linear = nn.Linear(n_out=enc_key_dim, l2=l2, with_bias=False)

self.conformer_blocks = nn.ModuleList([
self.conformer_blocks = nn.Sequential([
encoder_layer(
conv_kernel_size=conv_kernel_size, ff_act=ff_act, ff_dim=ff_dim, dropout=dropout,
att_dropout=att_dropout, enc_key_dim=enc_key_dim, att_n_heads=att_n_heads, l2=l2
Expand All @@ -199,6 +199,5 @@ def forward(self, inp: LayerRef) -> LayerRef:
x_subsample = self.conv_subsample_layer(inp)
x_linear = self.linear(x_subsample)
x = nn.dropout(x_linear, dropout=self.dropout)
for conformer_block in self.conformer_blocks:
x = conformer_block(x)
x = self.conformer_blocks(x)
return x

0 comments on commit c0a1f78

Please sign in to comment.