Internal: add overlap chunk. Args: feats: Feature tensor (e.g., fbank), shape (batch, frames, dim). cache: State cache dict for streaming inference.
(self, feats: np.ndarray, cache: dict = None)
| 478 | return xs_pad, olens, None |
| 479 | |
| 480 | def _add_overlap_chunk(self, feats: np.ndarray, cache: dict = None): |
| 481 | """Internal: add overlap chunk. |
| 482 | |
| 483 | Args: |
| 484 | feats: Feature tensor (e.g., fbank), shape (batch, frames, dim). |
| 485 | cache: State cache dict for streaming inference. |
| 486 | """ |
| 487 | if cache is None: |
| 488 | cache = {} |
| 489 | if len(cache) == 0: |
| 490 | return feats |
| 491 | cache["feats"] = to_device(cache["feats"], device=feats.device) |
| 492 | overlap_feats = torch.cat((cache["feats"], feats), dim=1) |
| 493 | cache["feats"] = overlap_feats[:, -(cache["chunk_size"][0] + cache["chunk_size"][2]) :, :] |
| 494 | return overlap_feats |
| 495 | |
| 496 | def forward_chunk( |
| 497 | self, |
no test coverage detected