,一個variable_scope
內的所有繼承reuse
選項是這樣的:當我必須在它說的Tensorflow文件明確使用重用選項tensorflow
with tf.variable_scope("name", reuse=True):
# inherits reuse=True
但我的問題是,當我例如使用這些輔助方法之一:
fc = tf.contrib.layers.fully_connected(input, 512, activation_fn=tf.nn.relu, weights_initializer=tf.contrib.layers.xavier_initializer(uniform=False))
norm = tf.contrib.layers.batch_norm(conv, 0.9, epsilon=1e-5, activation_fn=tf.nn.relu, scope=scope, fused=True)
我必須設置的選項:reuse
和scope
明確如下:
fc = tf.contrib.layers.fully_connected(input, 512, activation_fn=tf.nn.relu, weights_initializer=tf.contrib.layers.xavier_initializer(uniform=False), scope=scope, reuse=True)
norm = tf.contrib.layers.batch_norm(conv, 0.9, epsilon=1e-5, activation_fn=tf.nn.relu, scope=scope, reuse=True, is_training=self.is_training, fused=True)
或這是如何工作的?
這不回答我的問題在所有的賽道!我在問,是否必須明確地設置範圍=範圍,重用=重用或者當我使用tf.variable_scope(name,reuse = True)作爲範圍時,可以保留它:.. – thigi
也許我誤解了你,對不起。然而,你的問題可以通過閱讀範圍來解答。 https://www.tensorflow.org/programmers_guide/variable_scope 通常 - 不,您不需要再次將重用作爲參數。儘管如此,範圍並沒有太大的意義,因爲您編寫的代碼將始終與新的輸入一起工作。正如我所提到的,一旦你真正定義了你想要重用的模型,範圍就很有用。我希望這可以幫助你更多。 – Karaszka