Created
April 3, 2018 22:56
-
-
Save zaidalyafeai/60076e246d6f62d647c7468b88f49460 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const model = tf.sequential(); | |
//create the first layer | |
model.add(tf.layers.conv2d({ | |
inputShape: [28, 28, 1], | |
kernelSize: 5, | |
filters: 8, | |
strides: 1, | |
activation: 'relu', | |
kernelInitializer: 'VarianceScaling' | |
})); | |
//create a max pooling layer | |
model.add(tf.layers.maxPooling2d({ | |
poolSize: [2, 2], | |
strides: [2, 2] | |
})); | |
//create the second conv layer | |
model.add(tf.layers.conv2d({ | |
kernelSize: 5, | |
filters: 16, | |
strides: 1, | |
activation: 'relu', | |
kernelInitializer: 'VarianceScaling' | |
})); | |
//create a max pooling layer | |
model.add(tf.layers.maxPooling2d({ | |
poolSize: [2, 2], | |
strides: [2, 2] | |
})); | |
//flatten the layers to use it for the dense layers | |
model.add(tf.layers.flatten()); | |
//dense layer with output 10 units | |
model.add(tf.layers.dense({ | |
units: 10, | |
kernelInitializer: 'VarianceScaling', | |
activation: 'softmax' | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment