Fix Emformer for torchscript using torch 1.6.0 (#401)

This commit is contained in:
Fangjun Kuang 2022-06-06 17:08:07 +08:00 committed by GitHub
parent 0a21eaae7f
commit 29fa878fff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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