tf.get_variable通常使用的两种情况
1. 设置了范围,创建新的变量
with tf.variable_scope("foo"): v = tf.get_variable("v", [1]) assert v.name == "foo/v:0"
2. 范围设置中有重新的使用的变量
从以下链接翻译 understanding tf.get_variable
with tf.variable_scope("foo"): v = tf.get_variable("v", [1]) with tf.variable_scope("foo", reuse=True): v1 = tf.get_variable("v", [1]) assert v1 is v
#tensorflow学习笔记#理解tf.get_variable
最新推荐文章于 2022-03-28 19:47:54 发布