The setting of dropout at './examples/07_convnet_layers.py' looks weird
LorrinWWW opened this issue · 1 comments
at line 66
dropout = tf.layers.dropout(fc, self.keep_prob, training=self.training, name='dropout')
where self.training is a python boolean and it seems that updating self.training won't influence dropout. Thus, since it is initially set as 'False', the dropout layer won't work at all.
Maybe it is better to set self.training as a tensorflow boolean scalar tensor (e.g. a placeholder)? Is there any more elegant way to do the same thing so that I don't need to use placeholder and feed_dict?
I think tf.layers.dropout is designed for tf.estimator. See https://github.com/tensorflow/tensorflow/blob/r1.8/tensorflow/examples/tutorials/layers/cnn_mnist.py for an example. To use low level API, it seems we still need a placeholder.