- Notifications
You must be signed in to change notification settings - Fork8
Keras implementation of “Gated Linear Unit ”
License
NotificationsYou must be signed in to change notification settings
yangperasd/gated_cnn
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is Keras implementation of “Gated Linear Unit”.
- Keras 2.1.2
- Tensorflow 1.0.0
- Others can be seen in requirements.txt
The main Class isGatedConvBlock
inpy/gated_cnn.py
.Because there is a residual connection in Gated Linear Unit (GLU), the padding of conv must besame
.Let's take some example.
from gated_cnn import GatedConvBlockmodel = Sequential()model.add(Convolution2D(nb_filters, kernel_size, padding='valid', input_shape=input_shape))model.add(Activation('relu'))model.add(GatedConvBlock(Convolution2D(nb_filters*2, kernel_size, padding='same')))model.add(Activation('relu'))model.add(MaxPooling2D(pool_size=pool_size))model.add(Dropout(0.25))model.add(Flatten())model.add(Dense(128))model.add(Activation('relu'))model.add(Dropout(0.5))model.add(Dense(nb_classes))model.add(Activation('softmax'))model.compile(loss='categorical_crossentropy', optimizer='adadelta', metrics=['accuracy'])model.fit(X_train, Y_train, batch_size=batch_size, epochs=nb_epoch, verbose=1, validation_data=(X_test, Y_test))
Checkpy/mnist_gated_cnn.py
for more detail.
Written withStackEdit.
About
Keras implementation of “Gated Linear Unit ”
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.