---
title: Complex Scale-Invariant Signal-to-Noise Ratio (C-SI-SNR)
description: >-
  Calculate Complex scale-invariant signal-to-noise ratio (C-SI-SNR) metric for
  evaluating quality of audio.
canonical: >-
  https://lightning.ai/docs/torchmetrics/stable/audio/complex_scale_invariant_signal_noise_ratio
---
# Complex Scale-Invariant Signal-to-Noise Ratio (C-SI-SNR) {#complex-scale-invariant-signal-to-noise-ratio-c-si-snr}

## Module Interface {#module-interface}

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

[\[source\]](https://github.com/Lightning-AI/torchmetrics/blob/v1.9.0/src/torchmetrics/audio/snr.py#L245-L351)

Calculate [Complex scale-invariant signal-to-noise ratio](https://arxiv.org/abs/2011.09162) (C-SI-SNR) metric for evaluating quality of audio.

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)")): real float tensor with shape `(...,frequency,time,2)` or complex float tensor with shape `(..., frequency,time)`
    
*   `target` ([`Tensor`](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "(in PyTorch v2.15)")): real float tensor with shape `(...,frequency,time,2)` or complex float tensor with shape `(..., frequency,time)`
    

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

*   `c_si_snr` ([`Tensor`](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "(in PyTorch v2.15)")): float scalar tensor with average C-SI-SNR 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:

*   [**ValueError**](https://docs.python.org/3/builtins/exceptions.html#ValueError "(in Python v3.15)") – If `zero_mean` is not an bool
    
*   [**TypeError**](https://docs.python.org/3/builtins/exceptions.html#TypeError "(in Python v3.15)") – If `preds` is not the shape (…, frequency, time, 2) (after being converted to real if it is complex). If `preds` and `target` does not have the same shape.
    

Example

```python
>>> from torch import randn
>>> from torchmetrics.audio import ComplexScaleInvariantSignalNoiseRatio
>>> preds = randn((1,257,100,2))
>>> target = randn((1,257,100,2))
>>> c_si_snr = ComplexScaleInvariantSignalNoiseRatio()
>>> c_si_snr(preds, target)
tensor(-38.8832)
```

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

[\[source\]](https://github.com/Lightning-AI/torchmetrics/blob/v1.9.0/src/torchmetrics/audio/snr.py#L313-L351)

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 ComplexScaleInvariantSignalNoiseRatio
>>> metric = ComplexScaleInvariantSignalNoiseRatio()
>>> metric.update(torch.rand(1,257,100,2), torch.rand(1,257,100,2))
>>> fig_, ax_ = metric.plot()
```

[![../../\_images/complex\_scale\_invariant\_signal\_noise\_ratio-1.png](/docs/torchmetrics/1.9.0/static/_images/complex_scale_invariant_signal_noise_ratio-1.png)](/docs/torchmetrics/1.9.0/static/_images/complex_scale_invariant_signal_noise_ratio-1.png)

```python
>>> # Example plotting multiple values
>>> import torch
>>> from torchmetrics.audio import ComplexScaleInvariantSignalNoiseRatio
>>> metric = ComplexScaleInvariantSignalNoiseRatio()
>>> values = [ ]
>>> for _ in range(10):
...     values.append(metric(torch.rand(1,257,100,2), torch.rand(1,257,100,2)))
>>> fig_, ax_ = metric.plot(values)
```

[![../../\_images/complex\_scale\_invariant\_signal\_noise\_ratio-2.png](/docs/torchmetrics/1.9.0/static/_images/complex_scale_invariant_signal_noise_ratio-2.png)](/docs/torchmetrics/1.9.0/static/_images/complex_scale_invariant_signal_noise_ratio-2.png)

## Functional Interface {#functional-interface}

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

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

[Complex scale-invariant signal-to-noise ratio](https://arxiv.org/abs/2011.09162) (C-SI-SNR).

Parameters:

*   **preds** ([`Tensor`](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "(in PyTorch v2.15)")) – real float tensor with shape `(...,frequency,time,2)` or complex float tensor with shape `(..., frequency,time)`
    
*   **target** ([`Tensor`](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "(in PyTorch v2.15)")) – real float tensor with shape `(...,frequency,time,2)` or complex float tensor with shape `(..., frequency,time)`
    
*   **zero\_mean** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool "(in Python v3.15)")) – When set to True, the mean of all signals is subtracted prior to computation of the metrics
    

Return type:

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

Returns:

Float tensor with shape `(...,)` of C-SI-SNR values per sample

Raises:

[**RuntimeError**](https://docs.python.org/3/builtins/exceptions.html#RuntimeError "(in Python v3.15)") – If `preds` is not the shape (…,frequency,time,2) (after being converted to real if it is complex). If `preds` and `target` does not have the same shape.

Example

```python
>>> from torch import randn
>>> from torchmetrics.functional.audio import complex_scale_invariant_signal_noise_ratio
>>> preds = randn((1,257,100,2))
>>> target = randn((1,257,100,2))
>>> complex_scale_invariant_signal_noise_ratio(preds, target)
tensor([-38.8832])
```

---

**Navigation**

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