在我的 TensorFlow 代码中,我已将几个参数连接到图表中的某些逻辑,但相应的 TensorBoard 可视化无法直接建立这些连接,而是仅指示包含范围之间的连接。
具体来说,我有
with tf.name_scope('params_structure'):
is_train = tf.placeholder(tf.bool, [], name='is_train')
keep_prob_later_param = tf.identity(FLAGS.keep_prob_later, name='keep_prob_later')
keep_prob_early_param = tf.identity(FLAGS.keep_prob_early, name='keep_prob_early')
keep_prob_input_param = tf.identity(FLAGS.keep_prob_input, name='keep_prob_input')
with tf.name_scope('structure_logic'):
# Note that the summaries for these variables are the values used in training; not for computing stats
with tf.name_scope('keep_prob_later_decay'):
keep_prob_later_decay = tf.sub(1.0, tf.train.exponential_decay(1 - keep_prob_later_param, global_step,
FLAGS.decay_steps,
FLAGS.dropout_decay_rate, staircase=False))
with tf.name_scope('keep_prob_early_decay'):
keep_prob_early_decay = tf.sub(1.0, tf.train.exponential_decay(1 - keep_prob_early_param, global_step,
FLAGS.decay_steps,
FLAGS.dropout_decay_rate, staircase=False))
with tf.name_scope('keep_prob_input_decay'):
keep_prob_input_decay = tf.sub(1.0, tf.train.exponential_decay(1 - keep_prob_input_param, global_step,
FLAGS.decay_steps,
FLAGS.dropout_decay_rate, staircase=False))
with tf.name_scope('keep_prob_all'):
keep_prob_all = tf.identity(1.0)
keep_prob_later = tf.cond(is_train, lambda: keep_prob_later_decay, lambda: keep_prob_all)
keep_prob_early = tf.cond(is_train, lambda: keep_prob_early_decay, lambda: keep_prob_all)
keep_prob_input = tf.cond(is_train, lambda: keep_prob_input_decay, lambda: keep_prob_all)
在我的 TensorBoard 可视化中,我按预期看到了所有这些元素,但是keep_prob_..._param
s 和相应keep_prob_..._decay
操作之间的连接尚未建立。相反,我只获得包含范围之间的连接作为一个组(例如,从params_structure
下面突出显示的到所有 keep_prob_..._decay
操作):
连接is_train
到条件操作中也是如此:只有整个包含范围(上面突出显示)是连接的。
如何确保我的图形元素之间的连接,而不仅仅是它们的封闭范围,在 TensorBoard 中表示?
请注意,这不仅仅是一个强制完整性的问题:就目前而言,TensorBoard 表示完全无法确定哪些params_structure
元素连接到哪些structure_logic
元素:它可能是任何一个、全部,甚至没有!