-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Anyone with a problem like this? (AttributeError: 'NoneType' object has no attribute 'op') #6
Comments
Use the code below right before where the if var_list is None:
var_list = (
variables.trainable_variables() +
ops.get_collection(ops.GraphKeys.TRAINABLE_RESOURCE_VARIABLES))
else:
var_list = nest.flatten(var_list) |
It cannot and some new variables are involved causing errors. |
+1,how to solve this problem? |
I got the same issue |
+1, I got the same issue |
who can give an answer?really thanks |
The default value of
|
Anyone with a problem like this? (AttributeError: 'NoneType' object has no attribute 'op')
losses
Out[159]:
[<tf.Tensor 'add_17:0' shape=() dtype=float32>,
<tf.Tensor 'add_17:0' shape=() dtype=float32>]
train_step = optimizer.minimize(losses)
Traceback (most recent call last):
File "", line 1, in
train_step = optimizer.minimize(losses)
File "C:\Users\USER\Anaconda3\envs\tensorflow3\lib\site-packages\tensorflow\python\training\optimizer.py", line 399, in minimize
grad_loss=grad_loss)
File "F:\Pan_cancer\OmiVAE-master\PCGrad_tf.py", line 40, in compute_gradients
if grad is not None], axis=0), loss)
File "C:\Users\USER\Anaconda3\envs\tensorflow3\lib\site-packages\tensorflow\python\ops\functional_ops.py", line 459, in map_fn
maximum_iterations=n)
File "C:\Users\USER\Anaconda3\envs\tensorflow3\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 3209, in while_loop
result = loop_context.BuildLoop(cond, body, loop_vars, shape_invariants)
File "C:\Users\USER\Anaconda3\envs\tensorflow3\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 2941, in BuildLoop
pred, body, original_loop_vars, loop_vars, shape_invariants)
File "C:\Users\USER\Anaconda3\envs\tensorflow3\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 2878, in _BuildLoop
body_result = body(*packed_vars_for_body)
File "C:\Users\USER\Anaconda3\envs\tensorflow3\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 3179, in
body = lambda i, lv: (i + 1, orig_body(*lv))
File "C:\Users\USER\Anaconda3\envs\tensorflow3\lib\site-packages\tensorflow\python\ops\functional_ops.py", line 448, in compute
packed_fn_values = fn(packed_values)
File "F:\Pan_cancer\OmiVAE-master\PCGrad_tf.py", line 39, in
for grad in tf.gradients(x, var_list)
File "C:\Users\USER\Anaconda3\envs\tensorflow3\lib\site-packages\tensorflow\python\ops\gradients_impl.py", line 532, in gradients
gate_gradients, aggregation_method, stop_gradients)
File "C:\Users\USER\Anaconda3\envs\tensorflow3\lib\site-packages\tensorflow\python\ops\gradients_impl.py", line 588, in _GradientsHelper
from_ops = [t.op for t in xs]
File "C:\Users\USER\Anaconda3\envs\tensorflow3\lib\site-packages\tensorflow\python\ops\gradients_impl.py", line 588, in
from_ops = [t.op for t in xs]
AttributeError: 'NoneType' object has no attribute 'op'
The text was updated successfully, but these errors were encountered: