espnet2.enh.decoder.null_decoder.NullDecoder
espnet2.enh.decoder.null_decoder.NullDecoder
class espnet2.enh.decoder.null_decoder.NullDecoder
Bases: AbsDecoder
NullDecoder is a class that serves as a placeholder decoder, returning the
input arguments unchanged. It inherits from the abstract base class AbsDecoder.
None
- Parameters:None
forward(input
torch.Tensor, ilens: torch.Tensor, fs: int = None) ->
Tuple()
Processes the input waveform and lengths, returning them as-is.
- Returns: The input waveform and its lengths unchanged.
- Return type: Tuple[torch.Tensor, torch.Tensor]
####### Examples
>>> decoder = NullDecoder()
>>> input_waveform = torch.tensor([[0.1, 0.2, 0.3], [0.4, 0.5, 0.6]])
>>> input_lengths = torch.tensor([3, 3])
>>> output_waveform, output_lengths = decoder.forward(input_waveform,
... input_lengths)
>>> output_waveform
tensor([[0.1, 0.2, 0.3],
[0.4, 0.5, 0.6]])
>>> output_lengths
tensor([3, 3])
NOTE
This decoder does not perform any processing on the input data and is primarily used for testing or as a fallback option.
Initialize internal Module state, shared by both nn.Module and ScriptModule.
#
forward(input
Forward pass for the NullDecoder. This method returns the input waveform
and its corresponding lengths without any modifications. The input should be the waveform already provided.
- Parameters:
- input (torch.Tensor) – The waveform input of shape [Batch, sample].
- ilens (torch.Tensor) – The lengths of the input waveforms of shape [Batch].
- fs (int , optional) – The sampling rate in Hz. This argument is not used in the computation.
- Returns: A tuple containing: : - input (torch.Tensor): The original waveform input.
- ilens (torch.Tensor): The original input lengths.
- Return type: Tuple[torch.Tensor, torch.Tensor]
####### Examples
>>> decoder = NullDecoder()
>>> input_waveform = torch.randn(2, 16000) # Example batch of waveforms
>>> input_lengths = torch.tensor([16000, 16000]) # Lengths of waveforms
>>> output_waveform, output_lengths = decoder.forward(input_waveform, input_lengths)
>>> assert torch.equal(output_waveform, input_waveform)
>>> assert torch.equal(output_lengths, input_lengths)
NOTE
This decoder does not perform any decoding operation and simply returns the input as is. It can be useful for testing or as a placeholder in a processing pipeline.