Правильно ли следующий код?
def fw_net(x, training=True):
with tf.variable_scope('fw_net', reuse=tf.AUTO_REUSE):
with tf.variable_scope('fc1', reuse=tf.AUTO_REUSE):
x = ms.fc(x, 5*5*256, name='fc')
x = ms.bn(x, training=training, name='bn')
x = ms.activation(x, relu=True, name='relu')
x = tf.reshape(x, [-1, 5, 5, 256])
with tf.variable_scope('id_blk1', reuse=tf.AUTO_REUSE):
x = id_blk(x, 256, [3, 3], training)
with tf.variable_scope('id_blk2', reuse=tf.AUTO_REUSE):
x = id_blk(x, 256, [3, 3], training) # [-1, 5, 5, 256]
with tf.variable_scope('t_conv1', reuse=tf.AUTO_REUSE):
x = ms.t_conv2d(x, 128, [2, 2], 2, name='t_c')
x = ms.bn(x, training=training, name='bn')
x = ms.activation(x, relu=True, name='relu')
with tf.variable_scope('id_blk3', reuse=tf.AUTO_REUSE):
x = id_blk(x, 128, [3, 3], training)
with tf.variable_scope('id_blk4', reuse=tf.AUTO_REUSE):
x = id_blk(x, 128, [3, 3], training) # [-1, 10, 10, 128]
with tf.variable_scope('t_conv2', reuse=tf.AUTO_REUSE):
x = ms.t_conv2d(x, 64, [2, 2], 2, 't_c')
x = ms.bn(x, training=training, name='bn')
x = ms.activation(x, relu=True, name='relu')
with tf.variable_scope('id_blk5', reuse=tf.AUTO_REUSE):
x = id_blk(x, 64, [3, 3], training)
with tf.variable_scope('id_blk6', reuse=tf.AUTO_REUSE):
x = id_blk(x, 64, [3, 3], training) # [-1, 20, 20, 64]
with tf.variable_scope('t_conv3', reuse=tf.AUTO_REUSE):
x = ms.t_conv2d(x, 32, [2, 2], 2, name='t_c')
x = ms.bn(x, training=training, name='bn')
x = ms.activation(x, relu=True, name='relu')
with tf.variable_scope('id_blk7', reuse=tf.AUTO_REUSE):
x = id_blk(x, 32, [3, 3], training)
with tf.variable_scope('id_blk8', reuse=tf.AUTO_REUSE):
x = id_blk(x, 32, [3, 3], training) # [-1, 40, 40, 32]
x = tf.reshape(x, [-1, 40*40*32])
with tf.variable_scope('output', reuse=tf.AUTO_REUSE):
x = ms.fc(x, units=603, name='fc')
return x
Я хочу создать область имен, чтобы я мог использовать их для замораживания параметра нескольких слоев и перезаписи последних слоев при переобучении и точной настройке (передачаобучение) это ResNet модель.Существуют одни и те же имена, но в другом объеме, это имеет значение?