Skip to content

Commit c0a1f78

Browse files
committed
better use sequential
1 parent 4feeabe commit c0a1f78

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

nn/conformer.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def __init__(self, encoder_layer: nn.Module, num_blocks: int, conv_kernel_size:
187187

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

190-
self.conformer_blocks = nn.ModuleList([
190+
self.conformer_blocks = nn.Sequential([
191191
encoder_layer(
192192
conv_kernel_size=conv_kernel_size, ff_act=ff_act, ff_dim=ff_dim, dropout=dropout,
193193
att_dropout=att_dropout, enc_key_dim=enc_key_dim, att_n_heads=att_n_heads, l2=l2
@@ -199,6 +199,5 @@ def forward(self, inp: LayerRef) -> LayerRef:
199199
x_subsample = self.conv_subsample_layer(inp)
200200
x_linear = self.linear(x_subsample)
201201
x = nn.dropout(x_linear, dropout=self.dropout)
202-
for conformer_block in self.conformer_blocks:
203-
x = conformer_block(x)
202+
x = self.conformer_blocks(x)
204203
return x

0 commit comments

Comments
 (0)