Encrypted Deep Learning in TensorFlow

What is TF Encrypted?

TF Encrypted is a framework for encrypted deep learning in TensorFlow. It looks and feels like TensorFlow, taking advantage of the ease-of-use of the Keras API while enabling training and prediction over encrypted data.

Tesler review Jogar Spaceman review Quantum AI Profit Revolution

State-of-the-Art Cryptography

Under the hood, TF Encrypted integrates state-of-the-art cryptography like secure multi-party computation and homomorphic encryption. Take advantage of prebuilt highly optimized protocols or build and test your own using our pluggable architecture.

Easy to Use

TF Encrypted aims to make privacy-preserving deep learning simple and approachable, without requiring expertise in cryptography, distributed systems, or high-performance computing.

Private Machine Learning in TensorFlow using Secure Computation


TF Encrypted is available as a package on PyPI supporting Python 3.5+ and Tensorflow 1.12.0+ which can be installed using

pip install tf-encrypted

View more ways to install


Enjoy the familiar Keras, but encrypted.

import tensorflow as tf
import tf_encrypted as tfe

def provide_input():
    # normal TensorFlow operations can be run locally
    # as part of defining a private input, in this
    # case on the machine of the input provider
    return tf.ones(shape=(5, 10))

x = provide_input()

model = tfe.keras.Sequential([
    tfe.keras.layers.Dense(512, batch_input_shape=x.shape),

# get prediction input from client
logits = model(x)

with tfe.Session() as sess:
    result = sess.run(logits.reveal())

Tutorials & Examples

Simple Average of Encrypted Values

As a simple starting point, this example illustrates how TF Encrypted can be used to securely compute the…


Perform private predictions using a simple neural network on the MNIST data set. It also shows how to integrate…

Federated Learning

This example shows how TF Encrypted can be used to perform secure aggregation for federated learning, where a model…

Join our growing community

Latest Post

Scroll to Top