dub*_*gee 4 python ipython tensorflow
我注意到,在后续运行Tensorflow脚本时,您的图形Ops会获得编号名称,例如:
loss = tf.reduce_mean(tf.nn.l2_loss(y - pred), name="l2_loss")
Run Code Online (Sandbox Code Playgroud)
会得到这些名字:
l2_loss
l2_loss_1
l2_loss_2
...
l2_loss_N
Run Code Online (Sandbox Code Playgroud)
当你继续在同一个IPython会话中进行相同的运行时.这不会太烦人,除了稍后在脚本中要保存摘要时:
x_sample, y_sample = get_sample(X, Y)
feed = {x: x_batch, y: y_batch}
trainer.run(feed_dict=feed)
summary_str = summary_op.eval(feed_dict=feed)
Run Code Online (Sandbox Code Playgroud)
你会得到以下失败:
InvalidArgumentError: You must feed a value for placeholder tensor 'x_input' with dtype float ....
Run Code Online (Sandbox Code Playgroud)
有没有办法(在脚本或其他东西的顶部)取消所有这些旧的,过时的Op定义并使用当前运行并name=...在创建变量,占位符和常量时正确遵守命令?
对于您的后续问题,您可能正在AssertionError重新定义交互式会话.
sess = InteractiveSession()
sess = InteractiveSession()
Exception AssertionError: AssertionError("Nesting violated for default stack of <type 'weakref'> objects") in ...
Run Code Online (Sandbox Code Playgroud)
您可以先关闭会话来避免这种情况sess.close().
| 归档时间: |
|
| 查看次数: |
2099 次 |
| 最近记录: |