Created
June 28, 2019 08:43
-
-
Save arkajyotiMukherjee/3e1053fe7f747f2c856f2c2758d88fe6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # Make an input tensor | |
| inputs = tf.keras.Input(shape=(28,28,1)) | |
| # A layer instance is callable on a tensor, and returns a tensor. | |
| x = layers.Conv2D(filters=32, kernel_size=(3,3), strides=2, activation='relu')(inputs) | |
| # We have to provide the input for each layer manually | |
| # This is how we can make arbitrary connections | |
| x = layers.Conv2D(filters=64, kernel_size=(3,3),strides= 2, activation='relu')(x) | |
| # Notice how we are using the same variable x, as python performs the operation first then the assignment | |
| x = layers.Conv2D(filters=64, kernel_size=(3,3),strides=2, padding='same', activation='relu')(x) | |
| x = layers.Flatten()(x) | |
| x = layers.Dense(128, activation='relu')(x) | |
| # This is the output tensor | |
| preds = layers.Dense(10, activation='softmax')(x) | |
| # Now we pass the input and output tensors to the tf.keras.Model instance | |
| model = tf.keras.Model(inputs=inputs, outputs=preds) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment