Shortcuts

torcheval.metrics.functional.peak_signal_noise_ratio

torcheval.metrics.functional.peak_signal_noise_ratio(input: Tensor, target: Tensor, data_range: Optional[float] = None) Tensor[source]

Compute the peak signal-to-noise ratio between two images. It’s class version is torcheval.metrics.PeakSignalNoiseRatio

Parameters:
  • input (Tensor) – Input image (N, C, H, W).
  • target (Tensor) – Target image (N, C, H, W).
  • data_range (float) – the range of the input images. Default: None. If None, the input range computed from the target data (target.max() - targert.min()).

Examples:

>>> import torch
>>> from torcheval.metrics.functional import peak_signal_noise_ratio
>>> input = torch.tensor([[0.1, 0.2], [0.3, 0.4]])
>>> target = input * 0.9
>>> peak_signal_noise_ratio(input, target)
tensor(19.8767)

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources