diff --git a/wenet/transformer/subsampling.py b/wenet/transformer/subsampling.py index 1d252b940..7432e8119 100644 --- a/wenet/transformer/subsampling.py +++ b/wenet/transformer/subsampling.py @@ -388,3 +388,7 @@ def forward( x = self.norm(x) x = self.out(x) return x, pos_emb, new_mask.unsqueeze(1) + + def position_encoding(self, offset: Union[int, torch.Tensor], + size: int) -> torch.Tensor: + return self.pos_enc_class.position_encoding(offset, size)