Skip to content

Instantly share code, notes, and snippets.

@svenkreiss
Created June 27, 2020 11:16
Show Gist options
  • Save svenkreiss/81c5815774f0768887432b38f73ed983 to your computer and use it in GitHub Desktop.
Save svenkreiss/81c5815774f0768887432b38f73ed983 to your computer and use it in GitHub Desktop.
class GradScale100(torch.autograd.Function):
@staticmethod
def forward(ctx, input):
return input
@staticmethod
def backward(ctx, grad_output):
return grad_output * 0.01
@svenkreiss
Copy link
Author

use: logb = GradScale100.apply(self.logb)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment