예제 #1
0
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'
예제 #2
0
파일: test_pieapp.py 프로젝트: pyd1998/piq
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'