Reputation:
Imported the need packages and models are below,
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Activation, Dense
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.metrics import categorical_crossentropy
In this section I just want to check GPU is perfectly working or not But I find an error to check and the checking code is,
physical_devices = tf.config.experimental.list_physical_devices('GPU')
print("Num GPUs Available: ", len(physical_devices))
tf.config.experimental.set_memory_growth(physical_devices[0], True)
Below the error,
Num GPUs Available: 0
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-14-1fc9c14b9ae0> in <module>()
1 physical_devices = tf.config.experimental.list_physical_devices('GPU')
2 print("Num GPUs Available: ", len(physical_devices))
----> 3 tf.config.experimental.set_memory_growth(physical_devices[0], True)
IndexError: list index out of range
Need the help for sloving this issue or please help to install GPU
in google colab.
Upvotes: 1
Views: 3958
Reputation: 16792
If the intention is to get the details on the GPU:
import tensorflow as tf
if tf.test.gpu_device_name():
print('Default GPU Device Details: {}'.format(tf.test.gpu_device_name()))
else:
print("Please install Tensorflow that supports GPU")
Upvotes: 2