I'm a beginner. I'm working with python - TensorFlow '2.2.0' on python IDLE.
run_opts = tf.RunOptions(report_tensor_allocations_upon_oom = True)
I got the following error while running the previous code.:
AttributeError: module 'tensorflow' has no attribute 'RunOptions'"
however, according to example 18 from this link on the official page on Tensorflow, there's no error!
what's wrong in my case? How should I resolve this issue?
This is a compatibility issue between tensorflow 1.x
and tensorflow 2.x
. In other words, the syntax that you wrote works fine with tensorflow 1.x
. But as you mentioned, you're using tensorflow 2.2
which is incompatible.
So, you have can solve this issue by either one of the following two options:
Uninstall tensorflow 2.2
and install tensorflow 1.15
which will save you a lot of the headache knowing that the link that you've posted is using tensorflow 1.13.1
as mentioned in the README file.
Or you can use tf.compat.v1.RunOptions
instead of just tf.RunOptions
.