def test_style_loss_computes_grad(input_tensors: Tuple[torch.Tensor, torch.Tensor], device: str) -> None: x, y = input_tensors x.requires_grad_() loss_value = StyleLoss()(x.to(device), y.to(device)) loss_value.backward() assert x.grad is not None, NONE_GRAD_ERR_MSG
def test_style_loss_computes_grad(input_tensors: Tuple[torch.Tensor, torch.Tensor], device: str) -> None: prediction, target = input_tensors prediction.requires_grad_() loss_value = StyleLoss()(prediction.to(device), target.to(device)) loss_value.backward() assert prediction.grad is not None, NONE_GRAD_ERR_MSG