python - 变量范围附加一个数字
问题描述
在某些情况下,我会在变量范围内附加一个数字(即使我设置了reuse=True
)
假设我做了类似的事情:
import tensorflow as tf
with tf.Session() as session:
graph = tf.Graph()
with graph.as_default():
with tf.variable_scope("Foo", reuse=True):
tf.placeholder(dtype=tf.float64, name="A")
# Do something else here..
with tf.variable_scope("Foo", reuse=True):
tf.placeholder(dtype=tf.float64, name="B")
writer = tf.summary.FileWriter('/tmp/tf', graph=graph)
writer.flush()
为什么我看到(张量板)两个分组(Foo,Foo_1):
我希望将 A 和 B 放在同一组中,但仍将两个with
语句分开。
我认为与其他现有问题的一个关键区别是我在问:我该怎么做?
解决方案
推荐阅读
- html - 将列用作表中的行
- python - python中datetime模块的isoformat函数返回不正确的偏移量
- javascript - THREE.js 不渲染图像
- r - 带有每个国家/地区值的交互式欧洲地图
- python - Pandas 将 df1 中的一列与 df2 中的多列进行比较
- javascript - 通过方法返回的值不会将文本更改为适当的颜色
- sql - 创建 SQL 表时遇到问题?
- python - 两个数据框之间的 Vlookup 与公共列的重复值
- python - 在 Micro Focus RPA 中使用 python 移动消息的 API PATCH 请求
- logstash - 如何匹配 UUID/GUID 并在 logstash 中替换