I created a trainable variable in a scope. Later, I entered the same scope, set the scope to reuse_variables
, and used get_variable
to retrieve the same variable. However, I cannot set the variable's trainable property to False
. My get_variable
line is like:
weight_var = tf.get_variable('weights', trainable = False)
But the variable 'weights'
is still in the output of tf.trainable_variables
.
Can I set a shared variable's trainable
flag to False
by using get_variable
?
The reason I want to do this is that I'm trying to reuse the low-level filters pre-trained from VGG net in my model, and I want to build the graph like before, retrieve the weights variable, and assign VGG filter values to the weight variable, and then keep them fixed during the following training step.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…