---
title: Scale-Invariant Signal-to-Distortion Ratio (SI-SDR)
description: Scale-invariant signal-to-distortion ratio (SI-SDR).
canonical: >-
  https://lightning.ai/docs/torchmetrics/stable/audio/scale_invariant_signal_distortion_ratio
---
# Scale-Invariant Signal-to-Distortion Ratio (SI-SDR) {#scale-invariant-signal-to-distortion-ratio-si-sdr}

## Module Interface {#module-interface}

### `class torchmetrics.audio.ScaleInvariantSignalDistortionRatio(zero_mean=False, **kwargs)` {#torchmetrics.audio.ScaleInvariantSignalDistortionRatio}

[\[source\]](https://github.com/Lightning-AI/torchmetrics/blob/v1.9.0/src/torchmetrics/audio/sdr.py#L173-L279)

[Scale-invariant signal-to-distortion ratio](https://arxiv.org/abs/1811.02508) (SI-SDR).

The SI-SDR value is in general considered an overall measure of how good a source sound.

As input to forward and update the metric accepts the following input

*   `preds` ([`Tensor`](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "(in PyTorch v2.15)")): float tensor with shape `(...,time)`
    
*   `target` ([`Tensor`](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "(in PyTorch v2.15)")): float tensor with shape `(...,time)`
    

As output of forward and compute the metric returns the following output

*   `si_sdr` ([`Tensor`](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "(in PyTorch v2.15)")): float scalar tensor with average SI-SDR value over samples
    

Parameters:

*   **zero\_mean** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool "(in Python v3.15)")) – if to zero mean target and preds or not
    
*   **kwargs** ([`Any`](https://docs.python.org/3/library/typing.html#typing.Any "(in Python v3.15)")) – Additional keyword arguments, see [Advanced metric settings](/docs/torchmetrics/1.9.0/user-guide/overview.md#metric-kwargs) for more info.
    

Raises:

[**TypeError**](https://docs.python.org/3/builtins/exceptions.html#TypeError "(in Python v3.15)") – if target and preds have a different shape

Example

```python
>>> from torch import tensor
>>> from torchmetrics.audio import ScaleInvariantSignalDistortionRatio
>>> target = tensor([3.0, -0.5, 2.0, 7.0])
>>> preds = tensor([2.5, 0.0, 2.0, 8.0])
>>> si_sdr = ScaleInvariantSignalDistortionRatio()
>>> si_sdr(preds, target)
tensor(18.4030)
```

#### `plot(val=None, ax=None)` {#torchmetrics.audio.ScaleInvariantSignalDistortionRatio.plot}

[\[source\]](https://github.com/Lightning-AI/torchmetrics/blob/v1.9.0/src/torchmetrics/audio/sdr.py#L235-L279)

Plot a single or multiple values from the metric.

Parameters:

*   **val** (`Union`\[[`Tensor`](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "(in PyTorch v2.15)"), [`Sequence`](https://docs.python.org/3/library/collections.abc.html#collections.abc.Sequence "(in Python v3.15)")\[[`Tensor`](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "(in PyTorch v2.15)")\], [`None`](https://docs.python.org/3/builtins/constants.html#None "(in Python v3.15)")\]) – Either a single result from calling metric.forward or metric.compute or a list of these results. If no value is provided, will automatically call metric.compute and plot that result.
    
*   **ax** ([`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.15)")\[[`Axes`](https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.html#matplotlib.axes.Axes "(in Matplotlib v3.11.2)")\]) – An matplotlib axis object. If provided will add plot to that axis
    

Return type:

[`tuple`](https://docs.python.org/3/builtins/stdtypes.html#tuple "(in Python v3.15)")\[[`Figure`](https://matplotlib.org/stable/api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure "(in Matplotlib v3.11.2)"), `Union`\[[`Axes`](https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.html#matplotlib.axes.Axes "(in Matplotlib v3.11.2)"), [`ndarray`](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray "(in NumPy v2.5)")\]\]

Returns:

Figure and Axes object

Raises:

[**ModuleNotFoundError**](https://docs.python.org/3/builtins/exceptions.html#ModuleNotFoundError "(in Python v3.15)") – If matplotlib is not installed

```python
>>> # Example plotting a single value
>>> import torch
>>> from torchmetrics.audio import ScaleInvariantSignalDistortionRatio
>>> target = torch.randn(5)
>>> preds = torch.randn(5)
>>> metric = ScaleInvariantSignalDistortionRatio()
>>> metric.update(preds, target)
>>> fig_, ax_ = metric.plot()
```

[![../../\_images/scale\_invariant\_signal\_distortion\_ratio-1.png](/docs/torchmetrics/1.9.0/static/_images/scale_invariant_signal_distortion_ratio-1.png)](/docs/torchmetrics/1.9.0/static/_images/scale_invariant_signal_distortion_ratio-1.png)

```python
>>> # Example plotting multiple values
>>> import torch
>>> from torchmetrics.audio import ScaleInvariantSignalDistortionRatio
>>> target = torch.randn(5)
>>> preds = torch.randn(5)
>>> metric = ScaleInvariantSignalDistortionRatio()
>>> values = [ ]
>>> for _ in range(10):
...     values.append(metric(preds, target))
>>> fig_, ax_ = metric.plot(values)
```

[![../../\_images/scale\_invariant\_signal\_distortion\_ratio-2.png](/docs/torchmetrics/1.9.0/static/_images/scale_invariant_signal_distortion_ratio-2.png)](/docs/torchmetrics/1.9.0/static/_images/scale_invariant_signal_distortion_ratio-2.png)

## Functional Interface {#functional-interface}

### `torchmetrics.functional.audio.scale_invariant_signal_distortion_ratio(preds, target, zero_mean=False)` {#torchmetrics.functional.audio.scale_invariant_signal_distortion_ratio}

[\[source\]](https://github.com/Lightning-AI/torchmetrics/blob/v1.9.0/src/torchmetrics/functional/audio/sdr.py#L200-L238)

[Scale-invariant signal-to-distortion ratio](https://arxiv.org/abs/1811.02508) (SI-SDR).

The SI-SDR value is in general considered an overall measure of how good a source sound.

Parameters:

*   **preds** ([`Tensor`](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "(in PyTorch v2.15)")) – float tensor with shape `(...,time)`
    
*   **target** ([`Tensor`](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "(in PyTorch v2.15)")) – float tensor with shape `(...,time)`
    
*   **zero\_mean** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool "(in Python v3.15)")) – If to zero mean target and preds or not
    

Return type:

[`Tensor`](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "(in PyTorch v2.15)")

Returns:

Float tensor with shape `(...,)` of SDR values per sample

Raises:

[**RuntimeError**](https://docs.python.org/3/builtins/exceptions.html#RuntimeError "(in Python v3.15)") – If `preds` and `target` does not have the same shape

Example

```python
>>> from torchmetrics.functional.audio import scale_invariant_signal_distortion_ratio
>>> target = torch.tensor([3.0, -0.5, 2.0, 7.0])
>>> preds = torch.tensor([2.5, 0.0, 2.0, 8.0])
>>> scale_invariant_signal_distortion_ratio(preds, target)
tensor(18.4030)
```

---

**Navigation**

- Parent: [Audio](/docs/torchmetrics/1.9.0/audio.md)
