python - 无法在 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 做同样的事情时,函数会返回''
.
解决方案
我解决了在 google colab 中的安装问题
!pip install tensorflow-gpu
和
!pip install tf-nightly
所以现在 tf.test.gpu_device_name()
,输出是/device:GPU:0
但是,TensorFlow 自动将其版本升级为2.1.0-dev20191120
推荐阅读
- azure-sql-database - 进行 azure sql 备份时出错
- oracle - PL/SQL 函数返回自定义类型异常
- mongodb - MongoDb 中的多个 $and $or 查找
- python - 使用 OneHotEncoder inverse_transform
- ruby-on-rails - 如何通过设置键元素的优先级来使用字符串键对 ruby 哈希进行排序?
- python - 在 Django 中使用 clean() 方法
- android - Android 翻滚自定义 TextViews onResume
- java - WebDriver 在无头模式下保存问题
- java - 数据库驱动的应用程序意味着什么?
- scala - spark中的哈希函数