Skip to content

Commit af5b1e6

Browse files
tamilselvan0x0blisc
authored andcommitted
Update conv_asr.py preventing unnessory calculations (NVIDIA-NeMo#15239)
Signed-off-by: tamilselvan0X0 <[email protected]> Co-authored-by: Jason <[email protected]> Signed-off-by: Akhil Varanasi <[email protected]>
1 parent 348a6c9 commit af5b1e6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

nemo/collections/asr/modules/conv_asr.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -878,11 +878,11 @@ def affine_layer(
878878
@typecheck()
879879
def forward(self, encoder_output, length=None):
880880
pool = self._pooling(encoder_output, length)
881-
embs = []
882881

883882
for layer in self.emb_layers:
884-
pool, emb = layer(pool), layer[: self.emb_id](pool)
885-
embs.append(emb)
883+
last_pool = pool
884+
pool = layer(pool)
885+
emb = layer[: self.emb_id](last_pool)
886886

887887
pool = pool.squeeze(-1)
888888
if self.angular:
@@ -892,7 +892,7 @@ def forward(self, encoder_output, length=None):
892892

893893
out = self.final(pool)
894894

895-
return out, embs[-1].squeeze(-1)
895+
return out, emb.squeeze(-1)
896896

897897

898898
class ConvASREncoderAdapter(ConvASREncoder, adapter_mixins.AdapterModuleMixin):

0 commit comments

Comments
 (0)