Update model.py

This commit is contained in:
Yifan Yang 2023-02-09 18:21:21 +08:00 committed by GitHub
parent 7c47efd3e1
commit bcec8465c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -88,7 +88,7 @@ class Transducer(nn.Module):
Return a tensor of shape (N, U).
"""
y_shift = F.pad(
y, (context_size, 0), mode="constant", value=self.decoder.blank_id
y, (context_size, 0), mode="constant", value=-1
)[:, :-context_size]
mask = y_shift != y