当我尝试为程序生成的多层网络写出直方图摘要时,我收到重复标记错误。我认为问题可能与命名有关。想象一下如下代码:
<!doctype html>
<head>
<meta charset="utf-8">
<!---- >
<base href="https://polygit.org/components/">
<!---- >
Toggle below/above as backup when server is down
<!---->
<base href="https://polygit2.appspot.com/components/">
<!---->
<script src="webcomponentsjs/webcomponents-lite.min.js"></script>
<link href="polymer/polymer.html" rel="import">
<link href="paper-card/paper-card.html" rel="import">
<link href="iron-collapse/iron-collapse.html" rel="import">
</head>
<body>
<dom-module id="x-element">
<template>
<style></style>
<paper-card heading="Click Me to Open" on-tap="_toggleCollapse">
<iron-collapse id="collapse">
<div class="card-content">
I want to do stuff inside this content area. Some of it will involve clicking things. But when I click things, I want this paper card to remain open and not close. So I can still see this text and the other things I need to click on. But, unfortunately, with this setup, when you click on this text, the card closes and no one can read the text anymore. I'm looking for a solution that let's me open and close the card by clicking on the header "Click Me to Open" only. See what I mean by clicking on this paragraph right now. Watch it close. And not remain open like I want it.
</div>
</iron-collapse>
</paper-card>
</template>
<script>
(function(){
Polymer({
is: "x-element",
_toggleCollapse: function() {
this.$.collapse.toggle();
},
});
})();
</script>
</dom-module>
<x-element></x-element>
</body>
我天真地认为&#39;权重&#39;将范围限定为some_unique_name但我怀疑它不是。摘要名称是否与name_scope无关?
答案 0 :(得分:3)
作为Dave points out,,tag
的{{1}}参数确实独立于当前名称范围。部分原因是tf.histogram_summary(tag, ...)
可能是字符串tag
(即由图的一部分计算),而名称范围是纯客户端构造(即仅限Python),所以没有什么好方法可以使两种使用模式的范围保持一致。
但是,如果您从源代码使用TensorFlow构建(并且应该在下一版本中可用,0.8.0),则可以使用以下方法来标记您的标记(使用Graph.unique_name(..., mark_as_used=False)
):
Tensor
或者,您可以在当前版本中执行以下操作:
with tf.name_scope(some_unique_name):
# ...
tf.histogram_summary(
tf.get_default_graph().unique_name('weights', mark_as_used=False),
kernel_weights)
答案 1 :(得分:1)
他们是。
我和你在一起认为这是一个错误,但我还没有超越操作的设计者。继续在GitHub上为它打开一个问题!
(我也遇到过这种情况,发现它非常烦人 - 它会阻止模型的重复使用,而不会故意参数化摘要操作调用。)