tf-encrypted / tf-encrypted

A Framework for Encrypted Machine Learning in TensorFlow

Home Page:https://tf-encrypted.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ABY3 error:Unsupported share type: 0.

hgyuhaoyang opened this issue · comments

Dear developers:
I tried to use tfe.reshape() function with ABY3 protocol, but the program reports an error:Unsupported share type: 0.
I printed share_type of cipher using pond protocol, but there is no share type of pond protocol cipher.
I wanna know how to use tfe.reshape() function with ABY3 protocol, thanks a lot.

``"""Private training on combined data from several data owners"""

import tensorflow as tf
import tf_encrypted as tfe
from tf_encrypted.protocol.aby3 import ABY3

def maaain(server):
w = tfe.define_private_variable(tf.ones(shape=(10, 10)))
print("w: ",type(w))
x = tfe.define_private_variable(tf.ones(shape=(5, 10)))
print("x: ",type(x))
y = tfe.matmul(x, w)
print("x.share_type = ",x.share_type)
a = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15]]
a = tf.convert_to_tensor(a)
a = tfe.define_private_variable(a)
index_a = tf.Variable([0, 2])
b = tf.Variable([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
index_b = tf.Variable([2, 4, 6, 8])
with tfe.Session() as sess:
sess.run(tfe.global_variables_initializer(),
tag='init')
print(sess.run(tfe.gather(a, index_a,axis=1)))

def start_master(cluster_config_file=None):
print("Starting alice...")
remote_config = tfe.RemoteConfig.load(cluster_config_file)
tfe.set_config(remote_config)
players = remote_config.players
server0 = remote_config.server(players[0].name)
prot = ABY3("alice","bob","carl")
tfe.set_protocol(prot)
maaain(server0)

if name == "main":
TFE_EVENTS = 1
start_master("config.json")