def test_pieapp_computes_grad(x, y, device: str) -> None: x.requires_grad_() loss_value = PieAPP(enable_grad=True)(x.to(device), y.to(device)) loss_value.backward() assert x.grad is not None, 'Expected non None gradient of leaf variable'
def test_pieapp_computes_grad(prediction: torch.Tensor, target: torch.Tensor, device: str) -> None: prediction.requires_grad_() loss_value = PieAPP(enable_grad=True)(prediction.to(device), target.to(device)) loss_value.backward() assert prediction.grad is not None, 'Expected non None gradient of leaf variable'