我使用 tensorflow 提供的 seq2seq.py 库构建了一个 seq2seq 模型。在训练任何东西之前,我想在 tensorboard 中可视化我未经训练的模型的图形网络,但它不想显示这个。
下面是一个重现我的问题的最小示例。有人知道为什么这不起作用吗?您能否仅在模型经过训练后对其进行可视化?
import tensorflow as tf
import numpy as np
from tensorflow.models.rnn import rnn_cell
from tensorflow.models.rnn import seq2seq
encoder_inputs = []
decoder_inputs = []
for i in xrange(350):
encoder_inputs.append(tf.placeholder(tf.float32, shape=[None,2],
name="encoder{0}".format(i)))
for i in xrange(45):
decoder_inputs.append(tf.placeholder(tf.float32, shape=[None,22],
name="decoder{0}".format(i)))
size = 512 # number of hidden units
num_layers = 2 # Number of LSTMs
single_cell = rnn_cell.BasicLSTMCell(size)
cell = rnn_cell.MultiRNNCell([single_cell] * num_layers)
model = seq2seq.basic_rnn_seq2seq(encoder_inputs, decoder_inputs,cell)
sess = tf.Session()
sess.run(tf.variables.initialize_all_variables())
summary_writer = tf.train.SummaryWriter('/path/to/log', graph_def = sess.graph_def)