【发布时间】:2023-03-31 01:25:02
【问题描述】:
我注意到,在随后运行 Tensorflow 脚本时,您的图形操作会获得编号名称,例如:
loss = tf.reduce_mean(tf.nn.l2_loss(y - pred), name="l2_loss")
会得到名字:
l2_loss
l2_loss_1
l2_loss_2
...
l2_loss_N
当您继续在同一个 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)
你会得到以下失败:
InvalidArgumentError: You must feed a value for placeholder tensor 'x_input' with dtype float ....
有没有办法(在脚本或其他东西的顶部)取消所有这些旧的、过时的 Op 定义并使用当前运行并在创建变量、占位符时正确遵守 name=... 命令,和常量?
【问题讨论】:
标签: python ipython tensorflow