una-dinosauria/3d-pose-baseline

AttributeError: module 'tensorflow' has no attribute 'app'

andiconda opened this issue ยท 3 comments

Thanks for your interest in our research!

If you have problems running our code, please include

  1. Ubuntu18
  2. Tensorflow 2.0.0
  3. python 3.5
  4. The stack trace of the error that you see
    I meet the problem:
    Traceback (most recent call last):
    File "src/predict_3dpose.py", line 27, in
    tf.app.flags.DEFINE_float("learning_rate", 1e-3, "Learning rate")
    AttributeError: module 'tensorflow' has no attribute 'app'

Hi @andiconda, use this instead

tf.compat.v1.app.run(
    main=None,
    argv=None
)

let it me know if its not working

I have the same question, but what do you mean? @ArashHosseini , shall we add: tf.compat.v1.app.run(
main=None,
argv=None
)
to the front of the error line "tf.app.flags.DEFINE_float("learning_rate", 1e-3, "Learning rate")"?

i am only following the documentation, check docu and Tf 1 to 2 migration docu
To get TF 1.x like behaviour in TF 2.0 one can run

import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()