keras: AttributeError: module 'keras.backend' has no attribute 'tf'
This started to appear today in automated tests:
Traceback (most recent call last):
File "./test_script.py", line 14, in <module>
test_rest(scan_object)
File "/home/travis/build/autonomio/talos/test/commands/test_rest.py", line 65, in test_rest
talos.utils.gpu_utils.parallel_gpu_jobs()
File "/home/travis/build/autonomio/talos/talos/utils/gpu_utils.py", line 15, in parallel_gpu_jobs
gpu_options = K.tf.GPUOptions(allow_growth=allow_growth,
AttributeError: module 'keras.backend' has no attribute 'tf'
The command "coverage run --source=talos ./test_script.py" exited with 1.
Full details here.
The same tests run ok on my local machine, so I’m assuming something to do with the latest changes to Keras. The relevant part of the code have not been changed in many months, during which period the tests have run ~100 times locally and on Travis.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15
I also encountered this problem, ‘keras==2.2.5’, but when I change ‘keras==2.2.5 to keras==2.2.4’, this error “AttributeError: module ‘keras.backend’ has no attribute ‘tf’” has fixed.
i also got the same error With Tensorflow==2.1.0 then i used
session = tf.compat.v1.keras.backend.get_session()
it works finesame problem here, keras version: 2.3.1 I was exporting keras model to tf serving:
error raised:
I fixed by this. Thanks!
any news on this? same problem here.