mirror of
https://github.com/k2-fsa/icefall.git
synced 2025-09-19 05:54:20 +00:00
Fix error in how src was reshaped
This commit is contained in:
parent
0412d19f50
commit
5f5df4367d
@ -684,8 +684,12 @@ class SubformerEncoder(nn.Module):
|
|||||||
"""
|
"""
|
||||||
Reshape embeddings 'src' to have a different chunk size (in frames)
|
Reshape embeddings 'src' to have a different chunk size (in frames)
|
||||||
"""
|
"""
|
||||||
num_channels = src.shape[-1]
|
(seq_len, batch_size, num_channels) = src.shape
|
||||||
return src.reshape(chunk_size, -1, num_channels)
|
num_chunks = src.shape[0] // chunk_size
|
||||||
|
src = src.reshape(num_chunks, chunk_size, batch_size, num_channels)
|
||||||
|
return src.contiguous().reshape(chunk_size, num_chunks * batch_size,
|
||||||
|
num_channels)
|
||||||
|
|
||||||
|
|
||||||
def _attn_offset_to_chunk_size(self, attn_offset: Tensor, batch_size: int, chunk_size: int) -> Tensor:
|
def _attn_offset_to_chunk_size(self, attn_offset: Tensor, batch_size: int, chunk_size: int) -> Tensor:
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user