espnet2.enh.layers.dprnn.merge_feature
Less than 1 minute
espnet2.enh.layers.dprnn.merge_feature
espnet2.enh.layers.dprnn.merge_feature(input, rest)
Merge the splitted features into full utterance.
This function takes the split features and reconstructs the original full utterance. It combines the segments produced by the split_feature function, accounting for any remaining elements that were padded during the segmentation process.
- Parameters:
- input (torch.Tensor) – The input features with shape (B, N, L, K), where B is the batch size, N is the number of features, L is the number of segments, and K is the segment size.
- rest (int) – The number of elements that were padded and should be removed from the output.
- Returns: The reconstructed features with shape (B, N, T), where T is the length of the original sequence after removing the padded elements.
- Return type: torch.Tensor
Examples
>>> input = torch.rand(2, 3, 4, 5) # Example input tensor
>>> rest = 1 # Example rest value
>>> output = merge_feature(input, rest)
>>> print(output.shape) # Should output: torch.Size([2, 3, 19])
NOTE
The rest parameter should match the padding applied during the splitting process to ensure correct reconstruction of the original sequence length.