如何在 Colaboratory 中使用 Tensorboard

Mad*_*Try 5 google-colaboratory

是否可以在 Colaboratory 中使用 Tensorboard。在本地运行 tensorboard 会显示有关模型行为的丰富信息,例如损失等。与 Colaboratory(https://colab.research.google.com)一起工作时是否可以获得相同的信息。

pio*_*cki 4

您有两种选择,您可以使用其中一种 python 程序,该程序允许您通过隧道连接到托管 python 应用程序的计算机实例。我测试了这个: https: //github.com/taomanwai/tensorboardcolab

!pip install -U tensorboardcolab
from tensorboardcolab import *
import shutil

#clean out the directory
shutil.rmtree('./Graph', ignore_errors=True)
os.mkdir('./Graph')

tf.reset_default_graph()

#will start the tunneling and will print out a link:
tbc=TensorBoardColab()

#**here you construct your model**

sess = tf.Session()
output = sess.run(....)
sess.close()

train_writer = tbc.get_writer();
train_writer.add_graph(sess.graph)

train_writer.flush();
tbc.close()
Run Code Online (Sandbox Code Playgroud)

另一种解决方案是压缩所有文件并将其下载到您的计算机上。