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')))
1tf.test.is_gpu_available(
2 cuda_only=False, min_cuda_compute_capability=None
3)
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))