Python 记录openAI基线实施的激活

Python 记录openAI基线实施的激活,python,tensorflow,reinforcement-learning,Python,Tensorflow,Reinforcement Learning,我想记录的变量和激活的。 记录重量和偏差是直截了当的,但我在记录激活时遇到了麻烦。 我用叉子叉起来,记录重量和偏差。A为激活添加摘要操作(此处仅激活输入)。但是,第二次提交会导致错误: InvalidArgumentError (see above for traceback): Shape [-1,84,84,4] has negative dimensions [[Node: deepq/observation = Placeholder[dtype=DT_FLOAT, shape

我想记录的变量和激活的。 记录重量和偏差是直截了当的,但我在记录激活时遇到了麻烦。 我用叉子叉起来,记录重量和偏差。A为激活添加摘要操作(此处仅激活输入)。但是,第二次提交会导致错误:

InvalidArgumentError (see above for traceback): Shape [-1,84,84,4] has negative dimensions
     [[Node: deepq/observation = Placeholder[dtype=DT_FLOAT, shape=[?,84,84,4], _device="/job:localhost/replica:0/task:0/gpu:0"]()]]

非常感谢您的帮助。

您没有给出重新更正错误的方法。我试着做了
python3-m基线。deepq。实验。train_pong
,在你的代码上遇到了同样的问题。下面是我在您的分叉代码上运行的这个命令

您使用的
tf.summary.histogram
似乎很好。问题似乎出现在通过此堆栈跟踪构造的另一个操作中:

File "/usr/local/google/home/iga/tinker/baselines/baselines/deepq/experiments/train_pong.py", line 27, in main
  prioritized_replay=True
File "/usr/local/google/home/iga/tinker/baselines/baselines/deepq/simple.py", line 178, in learn
  grad_norm_clipping=10
File "/usr/local/google/home/iga/tinker/baselines/baselines/deepq/build_graph.py", line 178, in build_train
  act_f = build_act(make_obs_ph, q_func, num_actions, scope=scope, reuse=reuse)
File "/usr/local/google/home/iga/tinker/baselines/baselines/deepq/build_graph.py", line 105, in build_act
  observations_ph = U.ensure_tf_input(make_obs_ph("observation"))
File "/usr/local/google/home/iga/tinker/baselines/baselines/deepq/simple.py", line 170, in make_obs_ph
  return U.BatchInput(env.observation_space.shape, name=name)
File "/usr/local/google/home/iga/tinker/baselines/baselines/common/tf_util.py", line 150, in __init__
  super().__init__(tf.placeholder(dtype, [None] + list(shape), name=name))
deepq代码创建了一个占位符,名称为
deepq/observation

计算此占位符会导致错误,因为在运行期间没有为其提供提要。问题是“为什么添加摘要op会触发此错误”。答案似乎是因为我们希望评估和编写所有摘要(baselines/baselines/deepq/simple.py),包括新添加的摘要。评估新摘要需要评估导致错误的占位符

我在
Session.run()
方法中添加了一些print语句,以验证
deepq/observation
的值是否确实没有在提要中传递。多次运行都会传递它,但在我的计算机上运行约30秒后,会调用Session.run(),其提要不包含此占位符的值。存在时的运行包含deepq/观测、deepq/更新和deepq/随机的提要。该值不存在时的运行包含deepq_1/action、deepq_1/obs_tp1、deepq_1/weight、deepq_1/done等的提要


我不熟悉基线,无法为您提供收集所需摘要的正确方法,但希望此信息能有所帮助。

此问题与相关,但其解决方案不适用于甲烷。对于您的提示,似乎使用run()开关可以解决此问题。我会试试看。。。