You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, when I implament the idea "Input Gradient Regularization" , I meet a problem that ''NoneType' object has no attribute 'pred'' . I think it is because of double backpropagation. Do you konw how to solve this problem? Thank you very much!
ERROR:
train_op = optimizer.minimize(loss)
File "/share/apps/python/lib/python2.7/site-packages/tensorflow/python/training/optimizer.py", line 315, in minimize
grad_loss=grad_loss)
File "/share/apps/python/lib/python2.7/site-packages/tensorflow/python/training/optimizer.py", line 386, in compute_gradients
colocate_gradients_with_ops=colocate_gradients_with_ops)
File "/share/apps/python/lib/python2.7/site-packages/tensorflow/python/ops/gradients_impl.py", line 551, in gradients
out_grads[i] = control_flow_ops.ZerosLikeOutsideLoop(op, i)
File "/share/apps/python/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 1305, in ZerosLikeOutsideLoop
pred = op_ctxt.pred
AttributeError: 'NoneType' object has no attribute 'pred'
The text was updated successfully, but these errors were encountered:
Hi, when I implament the idea "Input Gradient Regularization" , I meet a problem that ''NoneType' object has no attribute 'pred'' . I think it is because of double backpropagation. Do you konw how to solve this problem? Thank you very much!
my code is simplified as follows:
.......
image_batch = tf.placeholder(tf.float32, (None, IMG_W, IMG_H,IMG_D), name='image_batch')
label_batch = tf.placeholder(tf.int32, (None,), name='label_batch')
y_conv = model(image_batch)
cross = loss(y_conv ,label_batch)
grads = tf.gradients(cross,image_batch )
input_loss = tf.nn.l2_loss(grads[0])
optimizer = tf.train.MomentumOptimizer(learning_rate = learning_rate,momentum=0.9)
train_op = optimizer.minimize(loss)
....
_ = sess.run(train_op,feed_dict={image_batch:train_batch1,label_batch:train_label_batch1})
ERROR:
train_op = optimizer.minimize(loss)
File "/share/apps/python/lib/python2.7/site-packages/tensorflow/python/training/optimizer.py", line 315, in minimize
grad_loss=grad_loss)
File "/share/apps/python/lib/python2.7/site-packages/tensorflow/python/training/optimizer.py", line 386, in compute_gradients
colocate_gradients_with_ops=colocate_gradients_with_ops)
File "/share/apps/python/lib/python2.7/site-packages/tensorflow/python/ops/gradients_impl.py", line 551, in gradients
out_grads[i] = control_flow_ops.ZerosLikeOutsideLoop(op, i)
File "/share/apps/python/lib/python2.7/site-packages/tensorflow/python/ops/control_flow_ops.py", line 1305, in ZerosLikeOutsideLoop
pred = op_ctxt.pred
AttributeError: 'NoneType' object has no attribute 'pred'
The text was updated successfully, but these errors were encountered: