add ReLUs to tutorial model

PiperOrigin-RevId: 232073877
This commit is contained in:
Nicolas Papernot 2019-02-01 18:43:14 -08:00 committed by A. Unique TensorFlower
parent 098c5220b5
commit 8c99088cf1

View file

@ -47,12 +47,16 @@ def cnn_model_fn(features, labels, mode):
input_layer = tf.reshape(features['x'], [-1, 28, 28, 1]) input_layer = tf.reshape(features['x'], [-1, 28, 28, 1])
y = tf.keras.layers.Conv2D(16, 8, y = tf.keras.layers.Conv2D(16, 8,
strides=2, strides=2,
padding='same').apply(input_layer) padding='same',
activation='relu').apply(input_layer)
y = tf.keras.layers.MaxPool2D(2, 1).apply(y) y = tf.keras.layers.MaxPool2D(2, 1).apply(y)
y = tf.keras.layers.Conv2D(32, 4, strides=2, padding='valid').apply(y) y = tf.keras.layers.Conv2D(32, 4,
strides=2,
padding='valid',
activation='relu').apply(y)
y = tf.keras.layers.MaxPool2D(2, 1).apply(y) y = tf.keras.layers.MaxPool2D(2, 1).apply(y)
y = tf.keras.layers.Flatten().apply(y) y = tf.keras.layers.Flatten().apply(y)
y = tf.keras.layers.Dense(32).apply(y) y = tf.keras.layers.Dense(32, activation='relu').apply(y)
logits = tf.keras.layers.Dense(10).apply(y) logits = tf.keras.layers.Dense(10).apply(y)
# Calculate loss as a vector (to support microbatches in DP-SGD). # Calculate loss as a vector (to support microbatches in DP-SGD).