My question is related to this Tensorflow: How to get a tensor by name?
I can give names to operations. But actually they named differently. For example:
In [11]: with tf.variable_scope('test_scope') as scope:
...: a = tf.get_variable('a',[1])
...: b = tf.maximum(1,2, name='b')
...: print a.name
...: print b.name
...:
...:
...:
test_scope/a:0
test_scope_1/b:0
In [12]: with tf.variable_scope('test_scope') as scope:
...: scope.reuse_variables()
...: a = tf.get_variable('a',[1])
...: b = tf.maximum(1,2, name='b')
...: print a.name
...: print b.name
...:
...:
...:
test_scope/a:0
test_scope_2/b:0
tf.get_variable
creates variable with exactly the same name as I ask. Operations add prefixes to scope.
I want to name my operation so that I can get it. In my case I want to get b
with tf.get_variable('b')
in my scope.
How can I do it? I can't do it with tf.Variable
because of this issue https://github.com/tensorflow/tensorflow/issues/1325
May be I need to set addition parameters to variable scope, or to operation, or somehow use tf.get_variable
?