def test_multi_scale_ssim_loss_equality(target: torch.Tensor, device: str) -> None: target = target.to(device) prediction = target.clone() loss = MultiScaleSSIMLoss()(prediction, target) assert (loss.abs() <= 1e-6).all(), f'If equal tensors are passed SSIM loss must be equal to 0 ' \ f'(considering floating point operation error up to 1 * 10^-6), got {loss}'
def test_multi_scale_ssim_loss_equality(y, device: str) -> None: y = y.to(device) x = y.clone() loss = MultiScaleSSIMLoss()(x, y) assert (loss.abs() <= 1e-6).all(), f'If equal tensors are passed SSIM loss must be equal to 0 ' \ f'(considering floating point operation error up to 1 * 10^-6), got {loss}'