chiphuyen / stanford-tensorflow-tutorials

This repository contains code examples for the Stanford's course: TensorFlow for Deep Learning Research.
http://cs20.stanford.edu
MIT License
10.32k stars 4.32k forks source link

How to set training as False in dropout during eval #125

Open qibin-google opened 6 years ago

qibin-google commented 6 years ago

https://github.com/chiphuyen/stanford-tensorflow-tutorials/blob/51e53daaa2a32cfe7a1966f060b28dbbd081791c/examples/07_convnet_layers.py#L146

I don't understand how setting self.training = False turns training off in dropout. self.training is passed as an argument when building dropout layer. After the whole network is built, changing self.training should not change the network.