【发布时间】:2019-04-20 06:08:08
【问题描述】:
我在 google colab 虚拟笔记本上玩 tensorflow api。我想查看我的 colab 虚拟机的设备映射。
正如 tensorflow 开发人员指南中所述,我可以设置标志 (log_device_placement=True) 以启用日志记录。 https://www.tensorflow.org/guide/using_gpu
下面是我在 colab notebook 上运行的代码 -
import tensorflow as tf
# Creates a graph.
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
c = tf.matmul(a, b)
tf.logging.set_verbosity(tf.logging.INFO)
# Creates a session with log_device_placement set to True.
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
# Runs the op.
print(sess.run(c))
但它似乎不适用于 colab 笔记本。但是它可以与本地 jupyter notebook 终端控制台一起使用。
知道如何在 google colab 平台上启用登录吗?
【问题讨论】:
标签: python tensorflow google-colaboratory