1、检查电脑可使用设备
先检查自己有没有gpu
from tensorflow
.python
.client
import device_lib
print(device_lib
.list_local_devices
())
以我自己电脑为例,输出如下结果。
2、测试PyTorch GPU
import torch
as t
print(t
.cuda
.is_available
())
3、测试Keras GPU
from keras
import backend
as K
K
.tensorflow_backend
._get_available_gpus
()
4、测试TensorFlow GPU
import tensorflow
as tf
print(tf
.test
.is_built_with_cuda
())
sess
= tf
.Session
(config
=tf
.ConfigProto
(log_device_placement
=True))
5、测试 MXNet GPU
import mxnet
as mx
print(mx
.gpu
())
6、测试paddle GPU
import paddle
.fluid
paddle
.fluid
.install_check
.run_check
()
转载请注明原文地址:https://tech.qufami.com/read-11638.html