【发布时间】:2016-04-04 22:22:58
【问题描述】:
我有一个模型:
def __init__(params):
seq2seq() {
outputs, states = rnn.rnn(...)
}
def step()
...
session.run(output_feed, input_feed)
模型被调用:
with tf.Session as sess:
model = create_model(sess) (does __init__, loads checkpoint)
inputs = ...
outputs = model.step(sess, inputs)
如何打印/保存/查看 rnn.rnn() 返回的“状态”是什么?
我已经尝试过 tf.Print(states[-1], [states[-1]]) 它给了我张量的形状。
Tensor("model/seq2seq/Print:0", shape=TensorShape([Dimension(None), Dimension(4096)]), dtype=float32)
我尝试了 states[-1].eval() ,它提供了一系列错误,例如:
Compute status: Invalid argument:
You must feed a value for placeholder tensor 'encoder1' with dtype int32
我也尝试将 var 添加到模型中以返回它,但这不起作用:
def __init__():
...
self.state = state
def step():
output_feed.append(self.state)
result = session.run(output_feed, input_feed)
return result
【问题讨论】:
标签: python machine-learning tensorflow