tensorflow - 如何在 Google Colab 中将 TensorFlow 2.0 设置为默认版本

标签 tensorflow google-colaboratory tensorflow2.0

在 Google Collab 中,每次我在重新启动计算机后加载它时,我都必须运行以下命令来卸载默认的 1.15.0 版本的 TensorFlow,然后安装 2.0。

如何将 2.0 设置为默认值,这样我就不必继续这样做了?

这是我目前每次都必须加载的代码:

!pip uninstall tensorflow
!pip install tensorflow==2.0.0

非常感谢!

最佳答案

编辑,2020 年 4 月:tensorflow 2.x 现在是 Colab 中的默认设置


原始答案:

参见 https://colab.research.google.com/notebooks/tensorflow_version.ipynb

在笔记本的顶部运行

%tensorflow_version 2.x

这将启用 tensorflow 2.0,无需下载和安装。

关于tensorflow - 如何在 Google Colab 中将 TensorFlow 2.0 设置为默认版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59594452/

相关文章:

tensorflow - 对具有不同图像大小的数据集使用 tensorflow TFRecords

python - 如何从 tensorflow 高级 API 恢复训练好的 LinearClassifier 并进行预测

google-colaboratory - 将 Python 项目转移到 Google Colab

Python Semaphore 似乎在 Google Colab 中不起作用

python - TensorFlow 版本 2 和 BatchNorm 折叠中的量化感知训练

c - tensorflow C API : How to modify the value in tensor

python - 有没有办法让 Colab 在单元格运行完成时发出音频通知

python - 断言在神经网络中做什么?

python - 属性错误 : 'tensorflow.python.framework.ops.EagerTensor' object has no attribute 'decode'

python - Tensorflow 可以混洗多个分片 TFrecord 二进制文件以进行对象检测训练吗?