Skip to content

Instantly share code, notes, and snippets.

@diogo149
Created November 7, 2015 00:10
Show Gist options
  • Save diogo149/6893b83409ae4575e2bd to your computer and use it in GitHub Desktop.
Save diogo149/6893b83409ae4575e2bd to your computer and use it in GitHub Desktop.
Gradient Reversal in Theano
from theano.compile import ViewOp
class GradientReversalOp(ViewOp):
def grad(self, inputs, output_gradients):
return [-output_gradients[0]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment