tf.name_scope()对tf.get_variable_scope().reuse_variables() 不起作用
# tf.get_variable_scope().reuse_variables() 的使用 import tensorflow as tf with tf.variable_scope('a1'): print(tf.get_variable_scope().reuse) # with tf.name_scope('a2'): # tf.get_variable_scope().reuse_variables() # print(tf.get_variable_scope().reuse) with tf.variable_scope('a3'): tf.get_variable_scope().reuse_variables() print(tf.get_variable_scope().reuse) with tf.variable_scope('a4'): print(tf.get_variable_scope().reuse)输出
False True False # tf.get_variable_scope().reuse_variables() 的使用 import tensorflow as tf with tf.variable_scope('a1'): print(tf.get_variable_scope().reuse) with tf.name_scope('a2'): tf.get_variable_scope().reuse_variables() print(tf.get_variable_scope().reuse) with tf.variable_scope('a3'): tf.get_variable_scope().reuse_variables() print(tf.get_variable_scope().reuse) with tf.variable_scope('a4'): print(tf.get_variable_scope().reuse)输出
False True True True
承接Matlab、Python和C++的编程,机器学习、计算机视觉的理论实现及辅导,本科和硕士的均可,咸鱼交易,专业回答请走知乎,详谈请联系QQ号757160542,非诚勿扰。