In particular, I have a simple fprop, which is the composition of tf operations. I want to override the tensor flow gradient calculation using my own gradient method using RegisterGradient.
What is wrong with this code?
import tensorflow as tf from tensorflow.python.framework import ops @ops.RegisterGradient("MyopGrad") def frop_grad(op, grad): x = op.inputs[0] return 0 * x
I want to see all zeros in print, but instead I get:
[ 0.2236068 0.25000003 0.28867513 0.35355341 0.5 ]
python machine-learning tensorflow
google_addict
source share