首页 > 解决方案 > 无法在 Google Colab 上将 GPU 用于 tensorflow 2.0

问题描述

我正在尝试使用 Google Colab 上的 GPU 运行我的笔记本,但它没有为我提供 GPU,但是当我使用 tensorflow 1.15.0 运行笔记本时,GPU 可用。

tf.test.gpu_device_name()

给出 '/device:GPU:0' tensorflow 1.15.0的输出

但是当我对 tensorflow 2.0.0 做同样的事情时,函数会返回''.

标签: pythontensorflowgoogle-colaboratorytensorflow2.0

解决方案


我解决了在 google colab 中的安装问题

!pip install tensorflow-gpu 

!pip install tf-nightly 

所以现在 tf.test.gpu_device_name(),输出是/device:GPU:0 但是,TensorFlow 自动将其版本升级为2.1.0-dev20191120


推荐阅读