Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Keras implementation of “Gated Linear Unit ”

License

NotificationsYou must be signed in to change notification settings

yangperasd/gated_cnn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is Keras implementation of “Gated Linear Unit”.

Requirements

  • Keras 2.1.2
  • Tensorflow 1.0.0
  • Others can be seen in requirements.txt

Usage

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.

Reference

Written withStackEdit.

About

Keras implementation of “Gated Linear Unit ”

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp