查看GPU是否在colab中
import tensorflow as tf
tf.test.gpu_device_name()
如果结果为空,则不能使用GPU,如果结果为/device:GPU:0
使用!/opt/bin/nvidia-smi查看显存情况

查看显卡内存使用上限
from tensorflow.python.client import device_lib
device_lib.list_local_devices()

博客介绍了在Colab中查看GPU的方法,若结果为空则不能使用GPU,结果为/device:GPU:0则可使用。还提到使用!/opt/bin/nvidia - smi查看显存情况以及显卡内存使用上限。
查看GPU是否在colab中
import tensorflow as tf
tf.test.gpu_device_name()
如果结果为空,则不能使用GPU,如果结果为/device:GPU:0
使用!/opt/bin/nvidia-smi查看显存情况

查看显卡内存使用上限
from tensorflow.python.client import device_lib
device_lib.list_local_devices()

3288
1655

被折叠的 条评论
为什么被折叠?