Tensorboard and Dropout Layers

不羁的心 提交于 2019-12-06 04:43:13

问题


I have a very basic query. I have made 4 almost identical(Difference being input shapes) CNN and have merged them while connecting to a Feed Forward Network of fully connected layers.

Code for the almost identical CNN(s):

model3 = Sequential()
model3.add(Convolution2D(32, (3, 3), activation='relu', padding='same', 
                                     input_shape=(batch_size[3], seq_len, channels)))
model3.add(MaxPooling2D(pool_size=(2, 2)))
model3.add(Dropout(0.1))
model3.add(Convolution2D(64, (3, 3), activation='relu', padding='same'))
model3.add(MaxPooling2D(pool_size=(2, 2)))
model3.add(Flatten())

But on tensorboard I see all the Dropout layers are interconnected, and Dropout1 is of different color than Dropout2,3,4,etc which all are the same color.


回答1:


I know this is an old question but I had the same issue myself and just now I realized what's going on

Dropout is only applied if we're training the model. This should be deactivated by the time we're evaluating/predicting. For that purpose, keras creates a learning_phase placeholder, set to 1.0 if we're training the model. This placeholder is created inside the first Dropout layer you create and is shared across all of them. So that's what you're seeing there!



来源:https://stackoverflow.com/questions/46259467/tensorboard-and-dropout-layers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!