OverLordGoldDragon / keras-adamw

Keras/TF implementation of AdamW, SGDW, NadamW, Warm Restarts, and Learning Rate multipliers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AttributeError: module 'tensorflow.python.ops' has no attribute 'control_dependencies'

jurukode opened this issue · comments

Hi @OverLordGoldDragon,

i'm trying to use AdamW in the latest version of your library, however got this error:

AttributeError: module 'tensorflow.python.ops' has no attribute 'control_dependencies'

I'm using Tensorflow 2.3, seems the control_dependencies already moved into different module: tf.control_dependencies

wdyt?

Are you using keras (i.e. os.environ['TF_KERAS'] = '0')? TF 2.3.0 is not compatible with Keras 2.3.1 and earlier, and I'm unsure of later versions. Try setting the environment flag to '1' (before from keras_adamw import ...).

No, i set it to os.environ['TF_KERAS'] = '1'. Already follow your suggestion and still throw similar error due to changes of the location of control_dependencies module into tf.control_dependencies. After trying to change manually the import declaration from ops.control_dependencies to tf.control_dependencies in the utils.py, it works well.

@sakinaljana Right, I actually haven't moved testing to TF2.3.0, so this may indeed be a bug - thanks for reporting, I'll look into it.

Thanks, there should be no change in the optimiser behavior, right?

@sakinaljana None whatsoever.