def test_multi_scale_gmsd_loss_forward_backward(prediction: torch.Tensor, target: torch.Tensor, device: str) -> None: prediction.requires_grad_() loss_value = MultiScaleGMSDLoss(chromatic=True)(prediction.to(device), target.to(device)) loss_value.backward() assert torch.isfinite(prediction.grad).all(), LEAF_VARIABLE_ERROR_MESSAGE
def test_multi_scale_gmsd_loss_forward_backward(x, y, device: str) -> None: x.requires_grad_() loss_value = MultiScaleGMSDLoss(chromatic=True)(x.to(device), y.to(device)) loss_value.backward() assert torch.isfinite(x.grad).all(), LEAF_VARIABLE_ERROR_MESSAGE