Unnamed
1
Is inversing gradients already implemented in tensorflow 2.7?
It is mentioned in the paper:
1511.04143.pdf (arxiv.org)
And if not how would you implement it? I tried to implement it myself but somehow i can’t modify gradients directly because of eager execution…
Hi @Unnamed, you can find the inverse of gradients creating a custom function decorated with tf.custom_gradient. For example
@tf.custom_gradient
def gradients(x):
y = tf.identity(x)
def grad(dy):
return -dy
return y, grad
Thank You.
1 Like