class_docstr: Calculate `Signal-to-noise ratio`_ (SNR_) meric for evaluating quality of audio.
  
  .. math::
      \text{SNR} = \frac{P_{signal}}{P_{noise}}
  
  where  :math:`P` denotes the power of each signal. The SNR metric compares the level of the desired signal to
  the level of background noise. Therefore, a high value of SNR means that the audio is clear.
  
  As input to `forward` and `update` the metric accepts the following input
  
  - ``preds`` (:class:`~torch.Tensor`): float tensor with shape ``(...,time)``
  - ``target`` (:class:`~torch.Tensor`): float tensor with shape ``(...,time)``
  
  As output of `forward` and `compute` the metric returns the following output
  
  - ``snr`` (:class:`~torch.Tensor`): float scalar tensor with average SNR value over samples
  
  Args:
      zero_mean: if to zero mean target and preds or not
      kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.
  
  Raises:
      TypeError:
          if target and preds have a different shape
  
  Example:
      >>> from torch import tensor
      >>> from torchmetrics.audio import SignalNoiseRatio
      >>> target = tensor([3.0, -0.5, 2.0, 7.0])
      >>> preds = tensor([2.5, 0.0, 2.0, 8.0])
      >>> snr = SignalNoiseRatio()
      >>> snr(preds, target)
      tensor(16.1805)
class_docstr_tok: ["Calculate","`","Signal-to-noise","ratio","`","_","(","SNR_",")","meric","for","evaluating","quality","of","audio",".","..","math",":",":","\\text","{","SNR","}","=","\\frac","{","P_","{","signal","}","}","{","P_","{","noise","}","}","where",":","math",":","`","P","`","denotes","the","power","of","each","signal",".","The","SNR","metric","compares","the","level","of","the","desired","signal","to","the","level","of","background","noise",".","Therefore",",","a","high","value","of","SNR","means","that","the","audio","is","clear",".","As","input","to","`","forward","`","and","`","update","`","the","metric","accepts","the","following","input","-","``","preds","``","(",":","class",":","`","~torch.Tensor","`",")",":","float","tensor","with","shape","``","(","...",",","time",")","``","-","``","target","``","(",":","class",":","`","~torch.Tensor","`",")",":","float","tensor","with","shape","``","(","...",",","time",")","``","As","output","of","`","forward","`","and","`","compute","`","the","metric","returns","the","following","output","-","``","snr","``","(",":","class",":","`","~torch.Tensor","`",")",":","float","scalar","tensor","with","average","SNR","value","over","samples","Args",":","zero_mean",":","if","to","zero","mean","target","and","preds","or","not","kwargs",":","Additional","keyword","arguments",",","see",":","ref",":","`","Metric","kwargs","`","for","more","info",".","Raises",":","TypeError",":","if","target","and","preds","have","a","different","shape","Example",":",">",">",">","from","torch","import","tensor",">",">",">","from","torchmetrics.audio","import","SignalNoiseRatio",">",">",">","target","=","tensor","(","[","3.0",",","-0.5",",","2.0",",","7.0","]",")",">",">",">","preds","=","tensor","(","[","2.5",",","0.0",",","2.0",",","8.0","]",")",">",">",">","snr","=","SignalNoiseRatio","(",")",">",">",">","snr","(","preds",",","target",")","tensor","(","16.1805",")"]
docstr: Update state with predictions and targets.
docstr_tok: ["Update","state","with","predictions","and","targets","."]
code: def update(self, preds: Tensor, target: Tensor) -> None:
      """Update state with predictions and targets."""
      snr_batch = signal_noise_ratio(
          preds=preds, target=target, zero_mean=self.zero_mean
      )
  
      self.sum_snr += snr_batch.sum()
      self.total += snr_batch.numel()
  
imports: from typing import Any, Optional, Sequence, Union
  from torch import Tensor, tensor
  from torchmetrics.functional.audio.snr import complex_scale_invariant_signal_noise_ratio, scale_invariant_signal_noise_ratio, signal_noise_ratio
  from torchmetrics.metric import Metric
  from torchmetrics.utilities.imports import _MATPLOTLIB_AVAILABLE
  from torchmetrics.utilities.plot import _AX_TYPE, _PLOT_OUT_TYPE
label_desc: Use image node_id 2 for calling the SignalNoiseRatio obj's underlying member method code with example usage: obj.update(preds, target) without return types