73cb3ff00533b03ab64127d2287f9bdfe30c035c,kornia/losses/psnr.py,,psnr_loss,#,47
Before Change
See :class:`~kornia.losses.PSNRLoss` for details.
if not torch.is_tensor(input) or not torch.is_tensor(target):
raise TypeError(f"Expected 2 torch tensors but got {type(input)} and {type(target)}")
if input.shape != target.shape:
raise TypeError(f"Expected tensors of equal shapes, but got {input.shape} and {target.shape}")
mse_val = mse_loss(input, target, reduction="mean")
max_val_tensor: torch.Tensor = torch.tensor(max_val).to(input.device).to(input.dtype)
return 10 * torch.log10(max_val_tensor * max_val_tensor / mse_val)
After Change
tensor(-20.0000)
return -1. * psnr(input, target, max_val)
class PSNRLoss(nn.Module):
rCreates a criterion that calculates the PSNR loss.
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances
Project Name: arraiy/torchgeometry
Commit Name: 73cb3ff00533b03ab64127d2287f9bdfe30c035c
Time: 2021-01-16
Author: edgar.riba@gmail.com
File Name: kornia/losses/psnr.py
Class Name:
Method Name: psnr_loss
Project Name: arraiy/torchgeometry
Commit Name: 6a4fa82792bddc6126eaf944956f49f0a0cb7ca7
Time: 2020-12-22
Author: edgar.riba@gmail.com
File Name: kornia/filters/sobel.py
Class Name: Sobel
Method Name: forward
Project Name: Zhaoyi-Yan/Shift-Net_pytorch
Commit Name: df863b1326a1d174c64a4ca9fac997c4ceb56583
Time: 2018-12-23
Author: yanzhaoyi@outlook.com
File Name: models/shift_net/InnerShiftTriple.py
Class Name: InnerShiftTriple
Method Name: forward