我有张量流图,我是 reusing parts of the graph multiple times . 原始图表没有在这些重用子网中共享参数,现在我希望它们共享参数 . 因此,我 renamed the variable scope 到共享名称 detector 而不是 stage_1stage_2 等 . 另外,在定义子网的循环的第一次迭代之后,我设置了tf.variable_scope(shared_name,reuse = True)` .

令我困惑的是 tensorboard graph . 我可以在所有子网中看到 weights are reused 但是 the variable scopes have different names that seem to be autogenerated 由tensorflow . 而不是 detector ,只有第一个是 detector ,后跟 detector_1 等,这在代码中没有定义 . 权重在 detector 初始化,并从那里流到 detector_1 等 .

是否期望这种行为,或者我在定义子网时犯了错误?

与此问题类似:How to simplify Tensorboard graph with shared variables?

在github上有一个问题:https://github.com/tensorflow/tensorflow/issues/9545