espnet2.asr_transducer.utils.make_chunk_mask
Less than 1 minute
espnet2.asr_transducer.utils.make_chunk_mask
espnet2.asr_transducer.utils.make_chunk_mask(size: int, chunk_size: int, num_left_chunks: int = 0, device: device | None = None) → Tensor
Create chunk mask for the subsequent steps (size, size).
Reference: https://github.com/k2-fsa/icefall/blob/master/icefall/utils.py
- Parameters:
- size – Size of the source mask.
- chunk_size – Number of frames in chunk.
- num_left_chunks – Number of left chunks the attention module can see. (null or negative value means full context)
- device – Device for the mask tensor.
- Returns: Chunk mask. (size, size)
- Return type: mask