예제 #1
0
def test_reduction_for_dim_none(reduction):
    match = f"The `reduction={reduction}` will not have any effect when `dim` is None."
    with pytest.warns(UserWarning, match=match):
        PSNR(reduction=reduction, dim=None)

    with pytest.warns(UserWarning, match=match):
        psnr(_inputs[0].preds, _inputs[0].target, reduction=reduction, dim=None)
예제 #2
0
파일: loss.py 프로젝트: klaegera-eth/DeFMO
        def supervised(self, gt, rend):
            (gt_rgb, gt_alpha), (rend_rgb, rend_alpha) = self._split(gt, rend)

            gt, rend = gt_rgb * gt_alpha, rend_rgb * rend_alpha
            return -torch.stack(
                [metrics.psnr(r, g, data_range=1) for r, g in zip(rend, gt)]
            )
예제 #3
0
파일: loss.py 프로젝트: klaegera-eth/DeFMO
 def reconstruction(self, reconst, inputs):
     return -torch.stack(
         [metrics.psnr(r, i, data_range=1) for r, i in zip(reconst, inputs)]
     )
예제 #4
0
def test_missing_data_range():
    with pytest.raises(ValueError):
        PSNR(data_range=None, dim=0)

    with pytest.raises(ValueError):
        psnr(_inputs[0].preds, _inputs[0].target, data_range=None, dim=0)