module 'keras.backend' has no attribute 'tensorflow_backend'

4,325 views
Skip to first unread message

Jagadeesh Sparrow

unread,
Jul 5, 2020, 7:54:59 AM7/5/20
to Keras-users
I tried to run the following code, from an old script, after updating keras and tensorflow

print(K.tensorflow_backend._get_available_gpus())

Keras - 2.4.3
Tensorflow - 2.2.0

and I faced the following error : 

AttributeError: module 'keras.backend' has no attribute 'tensorflow_backend'

Is there any depreciation / update with the newer versions?

Paige Bailey

unread,
Jul 5, 2020, 7:12:47 PM7/5/20
to Jagadeesh Sparrow, Keras-users
You should be able to use tf.config.list_physical_devices to get the number of visible GPUs.


--
You received this message because you are subscribed to the Google Groups "Keras-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to keras-users...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/keras-users/5987c9f4-0e2e-49e3-b27d-e3a4cfc8d9cco%40googlegroups.com.


--

Paige Bailey   

Product Manager (TensorFlow)

@DynamicWebPaige

webp...@google.com


 

JB Data31

unread,
Jul 6, 2020, 3:51:38 AM7/6/20
to Paige Bailey, Jagadeesh Sparrow, Keras-users
My env is a classic virtual 3 procs VM.

This snippet
import tensorflow as tf
print(tf.config.list_physical_devices('GPU'))
print(tf.config.list_physical_devices('CPU'))
outputs
[]
[PhysicalDevice(name='/physical_device:CPU:0', device_type='CPU')]

When I execute TF computes all 3 procs warm (see screenshots).
According to my device list there's 1 proc. Is there a config entry that shows such a multi proc env ?

JB

cpux3-0.jpg
cpux3-1.jpg
Reply all
Reply to author
Forward
0 new messages