Esempio n. 1
0
server3_kwargs = {
    "id": 'mbp3',
    "host": 'localhost',
    "port": '8003',
    "hook": hook,
    "verbose": True,
}

server3 = WebsocketServerWorker(**server3_kwargs)



tensor = torch.tensor([2.], requires_grad=True)
# target = torch.tensor([[0.], [0.]], requires_grad=True)

server2.load_data(tensor)
print(list(server2._objects.keys())[0])

server2_tensor = server2.get_obj(list(server2._objects.keys())[0])
print("server2 tensor: ", server2_tensor)

x = server2_tensor.share(server1, server2, crypto_provider=server3)

print("shared x: ", x)

print(server1._objects)
print(server2._objects)
print(list(server2._objects))

for key in list(server2._objects):
    print("each: ", server2._objects[key])
Esempio n. 2
0
import syft as sy
from syft.workers.websocket_server import WebsocketServerWorker
import torch

hook = sy.TorchHook(torch)

kwargs = {
    "id": 'mbp2',
    "host": 'localhost',
    "port": '8002',
    "hook": hook,
    "verbose": True,
}

if __name__ == "__main__":
    server2 = WebsocketServerWorker(**kwargs)
    tensor = torch.tensor([2])
    server2.load_data([tensor])
    print(server2._objects)
    server2.start()