From 8c99088cf1b251148ffbe9663691d0cc9d0645b3 Mon Sep 17 00:00:00 2001 From: Nicolas Papernot Date: Fri, 1 Feb 2019 18:43:14 -0800 Subject: [PATCH] add ReLUs to tutorial model PiperOrigin-RevId: 232073877 --- tutorials/mnist_dpsgd_tutorial.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tutorials/mnist_dpsgd_tutorial.py b/tutorials/mnist_dpsgd_tutorial.py index 05f373d..4e00853 100644 --- a/tutorials/mnist_dpsgd_tutorial.py +++ b/tutorials/mnist_dpsgd_tutorial.py @@ -47,12 +47,16 @@ def cnn_model_fn(features, labels, mode): input_layer = tf.reshape(features['x'], [-1, 28, 28, 1]) y = tf.keras.layers.Conv2D(16, 8, 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.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.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) # Calculate loss as a vector (to support microbatches in DP-SGD).