Fix Emformer for torchscript using torch 1.6.0

This commit is contained in:
Fangjun Kuang 2022-06-06 17:06:36 +08:00
parent 0a21eaae7f
commit a364837e91

View File

@ -296,7 +296,7 @@ class Emformer(EncoderInterface):
Return the initial state of each layer. NOTE: the returned
tensors are on the given device. `len(ans) == num_emformer_layers`.
"""
if self._init_state:
if len(self._init_state) > 0:
# Note(fangjun): It is OK to share the init state as it is
# not going to be modified by the model
return self._init_state