Skip to content

Instantly share code, notes, and snippets.

@cjratcliff
Created November 24, 2017 00:01
Show Gist options
  • Save cjratcliff/f226db30a2526bb540f5f2387e249bf7 to your computer and use it in GitHub Desktop.
Save cjratcliff/f226db30a2526bb540f5f2387e249bf7 to your computer and use it in GitHub Desktop.
@tf.RegisterGradient("CustomRelu")
def _custom_relu_grad(op, grad):
#return gen_nn_ops._relu_grad(grad, op.outputs[0])
return tf.where(tf.greater(op.outputs[0],0.0),grad,tf.zeros_like(grad))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment