AddNoise¶
- class torchaudio.transforms.AddNoise(*args, **kwargs)[source]¶
Scales and adds noise to waveform per signal-to-noise ratio. See
torchaudio.functional.add_noise()
for more details.- forward(waveform: Tensor, noise: Tensor, snr: Tensor, lengths: Optional[Tensor] = None) Tensor [source]¶
- Parameters:
waveform (torch.Tensor) – Input waveform, with shape (…, L).
noise (torch.Tensor) – Noise, with shape (…, L) (same shape as
waveform
).snr (torch.Tensor) – Signal-to-noise ratios in dB, with shape (…,).
lengths (torch.Tensor or None, optional) – Valid lengths of signals in
waveform
andnoise
,` (with shape) –
(Default (elements in waveform and noise are treated as valid.) –
None
)
- Returns:
Result of scaling and adding
noise
towaveform
, with shape (…, L) (same shape aswaveform
).- Return type: