Created
August 29, 2021 18:11
-
-
Save manuel-delverme/8c8719b55ecf6c0b7f8dd932976ec4b9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def closure(): | |
output = model(data) | |
loss = F.nll_loss(output, target) | |
layer_norm = torch.mean(torch.tensor([p.norm() for p in model.parameters()])) | |
ineq_defect = [ | |
(layer_norm - 0.025).reshape(1, -1), | |
] | |
return loss, None, ineq_defect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment