I use TensorFlow to create a new model that includes a dynamic loop. I am using tf.while_loop to implement this instance. One of the issues I am facing is the following:
AttributeError: 'NoneType' object has no attribute 'back_prop'
This issue occurs when running
gradients = tf.gradients(self.loss, params)
Then I try to print all the params , and it turns out that each parameter has a form. I think that if there is a nonetype parameter, its shape should be None , eh? On the other hand, is there any other method that could help me determine which variable is not assigned or how [] ?
Here is the full trackback:
Traceback (most recent call last): File "main.py", line 125, in <module> tf.app.run() File "/usr/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 30, in run sys.exit(main(sys.argv)) File "main.py", line 119, in main train()# if FLAGS.train: File "main.py", line 95, in train model = create_model(sess, False) File "main.py", line 75, in create_model forward_only=False) File "/home/sniu/lab/ai_lab/DMN-tensorflow/models/DMN.py", line 248, in __init__ gradients = tf.gradients(self.loss, params) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/gradients.py", line 481, in gradients in_grads = _AsList(grad_fn(op, *out_grads)) File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_grad.py", line 181, in _EnterGrad if not grad_ctxt.back_prop: AttributeError: 'NoneType' object has no attribute 'back_prop'
source share