如何绘制张量流神经网络对象

how to plot the tensorflow neural network object

我尝试了张量流螺旋数据集的示例代码并构建了神经网络。我想可视化网络的图形结构。 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