diff --git a/modules/dvector.py b/modules/dvector.py index 9b4bfa9..b574e12 100644 --- a/modules/dvector.py +++ b/modules/dvector.py @@ -55,9 +55,8 @@ def embed_utterance(self, utterance: Tensor) -> Tensor: # Pad to multiple of hop length hop_len = self.seg_len // 2 tgt_len = math.ceil(utterance.size(0) / hop_len) * hop_len - padded = torch.cat( - [utterance, torch.zeros(tgt_len - utterance.size(0), utterance.size(1))] - ) + zero_padding = torch.zeros(tgt_len - utterance.size(0), utterance.size(1)) + padded = torch.cat([utterance, zero_padding.to(utterance.device)]) segments = padded.unfold(0, self.seg_len, self.seg_len // 2) segments = segments.transpose(1, 2) # (batch, seg_len, mel_dim)