Solving failed precondition error: attempting to use uninitialized value beta1_ power
Using TensorFlow to implement ctpn, the code is like this
init=tf.global_variables_initializer()
opt=tf.train.AdamOptimizer(learning_rate=learning_rate).minimize(loss)
Error failed precondition error: attempting to use uninitialized value beta1_ power
Traceback (most recent call last):
File "/home/yiverin/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1334, in _do_call
return fn(*args)
File "/home/yiverin/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1319, in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File "/home/yiverin/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1407, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.FailedPreconditionError: Attempting to use uninitialized value beta1_power
[[{{node beta1_power/read}} = Identity[T=DT_FLOAT, _class=["loc:@Adam/Assign_1"], _device="/job:localhost/replica:0/task:0/device:CPU:0"](beta1_power)]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/ctpn/main/train.py", line 159, in <module>
tf.app.run()
File "/home/yiverin/.local/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 125, in run
_sys.exit(main(argv))
File "/tmp/ctpn/main/train.py", line 145, in main
input_im_info:data[2]})
File "/home/yiverin/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 929, in run
run_metadata_ptr)
File "/home/yiverin/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1152, in _run
feed_dict_tensor, options, run_metadata)
File "/home/yiverin/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1328, in _do_run
run_metadata)
File "/home/yiverin/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1348, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.FailedPreconditionError: Attempting to use uninitialized value beta1_power
[[node beta1_power/read (defined at /tmp/ctpn/main/train.py:127) = Identity[T=DT_FLOAT, _class=["loc:@Adam/Assign_1"], _device="/job:localhost/replica:0/task:0/device:CPU:0"](beta1_power)]]
See attaching to use uninitialized value beta1_ The answer to this question is
change the order of these two lines
opt=tf.train.AdamOptimizer(learning_rate=learning_rate).minimize(loss)
init=tf.global_variables_initializer()
Since AdamOptimizer has it’s own variables, you should define the initilizer init after opt, not before.
Done!
Read More:
- ArcGIS Earth 1.7 beta installation method-solve the 0X80070057.DirectX device creation failed problem
- How to solve oserror: [errno 98] address already in use and kill the python3 process
- No power supply specified for net vdda / vssa in power rail configuration
- FTP use get command 550 failed to open file, but use the put command to solve the problem
- How to use matlab to solve equation
- How to use vimdiff to solve conflict?
- numpy.core.umath How to solve the problem of failed to import
- Attempting to fetch value instead of handling error Internal: failed initializing StreamExecutor for
- C#: How to Use Httpclient to upload files with other parameters
- How to solve the failed to start switch root error during centos8.1 startup?
- How to Use Truffle to Deploy contracts on moonbeam
- How to solve the problem of requirements check failed for JDK 8 when Cordova 9.0 is built
- How to solve error: failed to push some refs to ‘[email protected]:……git pull conflict
- How to Solve Error: Failed to execute goal org.codehaus.mojo:……..
- How to Use spatial in MAC
- How to solve problems like curl: (7) failed to connect to raw.githubusercontent.com Port 443: problem with connection used
- The @ Autowired annotation in springboot is invalid in ordinary classes. How to solve and use the null pointer exception java.lang.nullpointerexception
- How to solve SVN authorization failed error
- linux VMware Unable to change virtual machine power state: Internal error
- MacBook Pro battery 0%, connected to the power but showed that the battery is not charging solution