我尝试了 tensorflow 螺旋数据集的示例代码并构建了神经网络。我想可视化网络的图形结构。 PFB 我尝试过的代码。
with tf.Graph().as_default():
net = tflearn.input_data([None, 2])
net = tflearn.fully_connected(net,6,
activation='tanh',weights_init='normal')
print(net)
最佳答案
要可视化图表,您应该使用 TensorBoard。这是tutorial了解如何使用它。
您可以在代码末尾添加一个摘要编写器,它将向给定位置写入一个事件文件(包含图形的可视化)。
graph = tf.Graph()
with graph.as_default():
net = tflearn.input_data([None, 2])
net = tflearn.fully_connected(net,6,
activation='tanh',weights_init='normal')
sess = tf.Session(graph=graph)
writer = tf.train.SummaryWriter('tmp/tensorboard_log', sess.graph)
然后您只需运行 tensorboard --logdir tmp/tensorboard_log
并在浏览器中进入 localhost:6006/#graphs
。
关于python - 如何绘制 tensorflow 神经网络对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37718934/