1# As it's written in Tensorflow documentatoin:
2
3import tensorflow as tf
4print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU')))
1# For tensorflow 2:
2print("Num GPUs Available: ", len(tf.config.list_physical_devices('GPU')))
3
4# For tensorflow 1:
5sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))