kaira.utils.snr.calculate_snr
- kaira.utils.snr.calculate_snr(original_signal: Tensor, noisy_signal: Tensor, dim: int | Tuple[int, ...] | None = None, keepdim: bool = False) Tensor[source]
Calculate the SNR between original and noisy signals.
- Parameters:
original_signal (torch.Tensor) – The original clean signal.
noisy_signal (torch.Tensor) – The noisy signal (original signal plus noise).
dim (Optional[Union[int, Tuple[int, ...]]]) – Dimensions to reduce when calculating power. If None, uses all dimensions.
keepdim (bool) – Whether to keep the reduced dimensions in the output. Default is False.
- Returns:
SNR in decibels (dB).
- Return type:
- Raises:
ValueError – If original and noisy signals have different shapes.