class_docstr: Calculate `Perceptual Evaluation of Speech Quality`_ (PESQ).
  
  It's a recognized industry standard for audio quality that takes into considerations characteristics such as:
  audio sharpness, call volume, background noise, clipping, audio interference etc. PESQ returns a score between
  -0.5 and 4.5 with the higher scores indicating a better quality.
  
  This metric is a wrapper for the `pesq package`_. Note that input will be moved to ``cpu`` to perform the metric
  calculation.
  
  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
  
  - ``pesq`` (:class:`~torch.Tensor`): float tensor of PESQ value reduced across the batch
  
  .. note:: using this metrics requires you to have ``pesq`` install. Either install as ``pip install
      torchmetrics[audio]`` or ``pip install pesq``. ``pesq`` will compile with your currently
      installed version of numpy, meaning that if you upgrade numpy at some point in the future you will
      most likely have to reinstall ``pesq``.
  
  .. note:: the ``forward`` and ``compute`` methods in this class return a single (reduced) PESQ value
      for a batch. To obtain a PESQ value for each sample, you may use the functional counterpart in
      :func:`~torchmetrics.functional.audio.pesq.perceptual_evaluation_speech_quality`.
  
  Args:
      fs: sampling frequency, should be 16000 or 8000 (Hz)
      mode: ``'wb'`` (wide-band) or ``'nb'`` (narrow-band)
      keep_same_device: whether to move the pesq value to the device of preds
      n_processes: integer specifying the number of processes to run in parallel for the metric calculation.
          Only applies to batches of data and if ``multiprocessing`` package is installed.
      kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.
  
  Raises:
      ModuleNotFoundError:
          If ``pesq`` package is not installed
      ValueError:
          If ``fs`` is not either  ``8000`` or ``16000``
      ValueError:
          If ``mode`` is not either ``"wb"`` or ``"nb"``
  
  Example:
      >>> import torch
      >>> from torchmetrics.audio import PerceptualEvaluationSpeechQuality
      >>> g = torch.manual_seed(1)
      >>> preds = torch.randn(8000)
      >>> target = torch.randn(8000)
      >>> pesq = PerceptualEvaluationSpeechQuality(8000, 'nb')
      >>> pesq(preds, target)
      tensor(2.2076)
      >>> wb_pesq = PerceptualEvaluationSpeechQuality(16000, 'wb')
      >>> wb_pesq(preds, target)
      tensor(1.7359)
class_docstr_tok: ["Calculate","`","Perceptual","Evaluation","of","Speech","Quality","`","_","(","PESQ",")",".","It","'s","a","recognized","industry","standard","for","audio","quality","that","takes","into","considerations","characteristics","such","as",":","audio","sharpness",",","call","volume",",","background","noise",",","clipping",",","audio","interference","etc",".","PESQ","returns","a","score","between","-0.5","and","4.5","with","the","higher","scores","indicating","a","better","quality",".","This","metric","is","a","wrapper","for","the","`","pesq","package","`","_",".","Note","that","input","will","be","moved","to","``","cpu","``","to","perform","the","metric","calculation",".","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","-","``","pesq","``","(",":","class",":","`","~torch.Tensor","`",")",":","float","tensor","of","PESQ","value","reduced","across","the","batch","..","note",":",":","using","this","metrics","requires","you","to","have","``","pesq","``","install",".","Either","install","as","``","pip","install","torchmetrics","[","audio","]","``","or","``","pip","install","pesq","``",".","``","pesq","``","will","compile","with","your","currently","installed","version","of","numpy",",","meaning","that","if","you","upgrade","numpy","at","some","point","in","the","future","you","will","most","likely","have","to","reinstall","``","pesq","``",".","..","note",":",":","the","``","forward","``","and","``","compute","``","methods","in","this","class","return","a","single","(","reduced",")","PESQ","value","for","a","batch",".","To","obtain","a","PESQ","value","for","each","sample",",","you","may","use","the","functional","counterpart","in",":","func",":","`","~torchmetrics.functional.audio.pesq.perceptual_evaluation_speech_quality","`",".","Args",":","fs",":","sampling","frequency",",","should","be","16000","or","8000","(","Hz",")","mode",":","``","'wb","'","``","(","wide-band",")","or","``","'nb","'","``","(","narrow-band",")","keep_same_device",":","whether","to","move","the","pesq","value","to","the","device","of","preds","n_processes",":","integer","specifying","the","number","of","processes","to","run","in","parallel","for","the","metric","calculation",".","Only","applies","to","batches","of","data","and","if","``","multiprocessing","``","package","is","installed",".","kwargs",":","Additional","keyword","arguments",",","see",":","ref",":","`","Metric","kwargs","`","for","more","info",".","Raises",":","ModuleNotFoundError",":","If","``","pesq","``","package","is","not","installed","ValueError",":","If","``","fs","``","is","not","either","``","8000","``","or","``","16000","``","ValueError",":","If","``","mode","``","is","not","either","``","``","wb","''","``","or","``","``","nb","''","``","Example",":",">",">",">","import","torch",">",">",">","from","torchmetrics.audio","import","PerceptualEvaluationSpeechQuality",">",">",">","g","=","torch.manual_seed","(","1",")",">",">",">","preds","=","torch.randn","(","8000",")",">",">",">","target","=","torch.randn","(","8000",")",">",">",">","pesq","=","PerceptualEvaluationSpeechQuality","(","8000",",","'nb","'",")",">",">",">","pesq","(","preds",",","target",")","tensor","(","2.2076",")",">",">",">","wb_pesq","=","PerceptualEvaluationSpeechQuality","(","16000",",","'wb","'",")",">",">",">","wb_pesq","(","preds",",","target",")","tensor","(","1.7359",")"]
docstr: Compute metric.
docstr_tok: ["Compute","metric","."]
code: def compute(self) -> Tensor:
      """Compute metric."""
      return self.sum_pesq / self.total
  
file_path: torchmetrics/src/torchmetrics/audio/pesq.py
imports: from typing import Any, Optional, Sequence, Union
  from torch import Tensor, tensor
  from torchmetrics.functional.audio.pesq import perceptual_evaluation_speech_quality
  from torchmetrics.metric import Metric
  from torchmetrics.utilities.imports import _MATPLOTLIB_AVAILABLE, _PESQ_AVAILABLE
  from torchmetrics.utilities.plot import _AX_TYPE, _PLOT_OUT_TYPE
label_desc: Use image node_id 3 for calling the PerceptualEvaluationSpeechQuality obj's underlying member method code with example usage: obj.compute() and returns: unknown