Python 无法使用GPU来拟合使用Keras的模型

Python 无法使用GPU来拟合使用Keras的模型,python,tensorflow,keras,Python,Tensorflow,Keras,我有一个Windows10操作系统,我在Jupyter笔记本上使用Tensorflow gpu版本 康达4.9.2 python 3.7 tf“2.3.1” cudatoolkit 11.0.221 tf.config.experimental.list_physical_devices() 返回: [PhysicalDevice(name='/physical_device:CPU:0', device_type='CPU'), PhysicalDevice(name='/physical_

我有一个Windows10操作系统,我在Jupyter笔记本上使用Tensorflow gpu版本

康达4.9.2

python 3.7

tf“2.3.1”

cudatoolkit 11.0.221

tf.config.experimental.list_physical_devices()
返回:

[PhysicalDevice(name='/physical_device:CPU:0', device_type='CPU'),
PhysicalDevice(name='/physical_device:XLA_CPU:0', device_type='XLA_CPU'),
PhysicalDevice(name='/physical_device:XLA_GPU:0', device_type='XLA_GPU')]
[name: "/device:CPU:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}
incarnation: 10428669251348137268
, name: "/device:XLA_CPU:0"
device_type: "XLA_CPU"
memory_limit: 17179869184
locality {
}
incarnation: 2248949917928228630
physical_device_desc: "device: XLA_CPU device"
, name: "/device:XLA_GPU:0"
device_type: "XLA_GPU"
memory_limit: 17179869184
locality {
}
incarnation: 17815507612308274706
physical_device_desc: "device: XLA_GPU device"
]
以及

返回:

[PhysicalDevice(name='/physical_device:CPU:0', device_type='CPU'),
PhysicalDevice(name='/physical_device:XLA_CPU:0', device_type='XLA_CPU'),
PhysicalDevice(name='/physical_device:XLA_GPU:0', device_type='XLA_GPU')]
[name: "/device:CPU:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}
incarnation: 10428669251348137268
, name: "/device:XLA_CPU:0"
device_type: "XLA_CPU"
memory_limit: 17179869184
locality {
}
incarnation: 2248949917928228630
physical_device_desc: "device: XLA_CPU device"
, name: "/device:XLA_GPU:0"
device_type: "XLA_GPU"
memory_limit: 17179869184
locality {
}
incarnation: 17815507612308274706
physical_device_desc: "device: XLA_GPU device"
]
然而,当我想适应这个模型时,它开始使用我100%的CPU而不是GPU


以前有人遇到过这个问题吗?

最简单的方法是卸载tensorflow。如果安装了anaconda,则会显示
使用conda安装tensflow。它将安装tensorflow 2.1.1、cudatoolkit 10.1.243和cudnn 7.65。这些与tensorflow 2.31兼容。然后使用pip安装tensorflow 2.3.1。Conda for windows只能安装tensorflow至2.1版。

您需要cudatoolkit 10.1.243和cudnn 7.6.5