4220e2c69f73f71e23bcd948df0fa20f37ff5d17,examples/pond.py,,,#,8
Before Change
from tensorflow_encrypted.protocol import Pond, Server
from tensorflow_encrypted.layer import Conv2D
server0 = Server("/job:localhost/replica:0/task:0/device:CPU:0")
server1 = Server("/job:localhost/replica:0/task:0/device:CPU:1")
crypto_producer = Server("/job:localhost/replica:0/task:0/device:CPU:2")
with Pond(server0, server1, crypto_producer) as prot:
a = prot.define_constant(np.array([4, 3, 2, 1]).reshape(2, 2))
b = prot.define_constant(np.array([4, 3, 2, 1]).reshape(2, 2))
After Change
config = tfe.LocalConfig(3)
with Pond(*config.players) as prot:
a = prot.define_constant(np.array([4, 3, 2, 1]).reshape(2, 2))
b = prot.define_constant(np.array([4, 3, 2, 1]).reshape(2, 2))
c = a * b
d = prot.define_private_variable(np.array([1., 2., 3., 4.]).reshape(2, 2))
e = prot.define_private_variable(np.array([1., 2., 3., 4.]).reshape(2, 2))
// f = (d * .5 + e * .5)
f = d * e
// convolutions
conv_input_shape = (32, 1, 28, 28) // NCHW
conv_input = prot.define_private_variable(np.random.normal(size=conv_input_shape))
conv_layer = Conv2D((4, 4, 1, 20), strides=2)
conv_layer.initialize(conv_input_shape)
conv_out = conv_layer.forward(conv_input)
with config.session() as sess:
sess.run(tf.global_variables_initializer())
print("multiplication : ")
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 9
Instances
Project Name: mortendahl/tf-encrypted
Commit Name: 4220e2c69f73f71e23bcd948df0fa20f37ff5d17
Time: 2018-08-14
Author: mortendahlcs@gmail.com
File Name: examples/pond.py
Class Name:
Method Name:
Project Name: mortendahl/tf-encrypted
Commit Name: 4220e2c69f73f71e23bcd948df0fa20f37ff5d17
Time: 2018-08-14
Author: mortendahlcs@gmail.com
File Name: tests/conv2d_test.py
Class Name: TestConv2D
Method Name: test_forward
Project Name: mortendahl/tf-encrypted
Commit Name: 4220e2c69f73f71e23bcd948df0fa20f37ff5d17
Time: 2018-08-14
Author: mortendahlcs@gmail.com
File Name: examples/pond.py
Class Name:
Method Name:
Project Name: mortendahl/tf-encrypted
Commit Name: 4220e2c69f73f71e23bcd948df0fa20f37ff5d17
Time: 2018-08-14
Author: mortendahlcs@gmail.com
File Name: examples/pond-simple.py
Class Name:
Method Name: