Last active
May 17, 2019 12:53
-
-
Save mortendahl/f873d27e6c371a3b791c390c7b3dde0b 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
import tensorflow as tf | |
import tf_encrypted as tfe | |
class PredictionClient: | |
@tfe.private_input | |
def provide_input(self): | |
"""Load and preprocess input data.""" | |
@tfe.private_output | |
def receive_output(self, logits): | |
return tf.print(tf.argmax(logits)) | |
model = tfe.models.Sequential([ | |
tfe.keras.layers.Dense(activation='relu'), | |
tfe.keras.layers.Dense(activation='relu'), | |
tfe.keras.layers.Dense(activation=None) | |
]) | |
prediction_client = PredictionClient() | |
x = prediction_client.provide_input() | |
y = model.predict(x) | |
prediction_client.receive_output(y) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment