Efficiency, small fix

This commit is contained in:
Daniel Povey 2023-05-16 17:34:21 +08:00
parent cf93d1f129
commit e062c71076

View File

@ -686,6 +686,8 @@ class SubformerEncoder(nn.Module):
changing the batch size. changing the batch size.
""" """
(seq_len, batch_size, num_channels) = src.shape (seq_len, batch_size, num_channels) = src.shape
if chunk_size == seq_len:
return src
src = src.transpose(0, 1).contiguous().reshape(-1, chunk_size, num_channels) src = src.transpose(0, 1).contiguous().reshape(-1, chunk_size, num_channels)
return src.transpose(0, 1).contiguous() return src.transpose(0, 1).contiguous()