Skip to content

Instantly share code, notes, and snippets.

@hsiaoer
Created March 16, 2018 16:26
Show Gist options
  • Save hsiaoer/ce7c42aa9a0f694ab0b25b704f1a8930 to your computer and use it in GitHub Desktop.
Save hsiaoer/ce7c42aa9a0f694ab0b25b704f1a8930 to your computer and use it in GitHub Desktop.
class Model(tf.keras.Model):
...
def __call__(self, inputs, training):
# Input layer
y = tf.reshape(inputs, self._input_shape)
y = self.conv1(y)
y = self.max_pool2d(y)
y = self.conv2(y)
y = self.max_pool2d(y)
y = tf.layers.flatten(y)
y = self.fc1(y)
y = self.dropout(y, training=training)
# Returns a logit layer
return self.fc2(y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment