MCPcopy Create free account
hub / github.com/OpenMined/SyMPC / test_stack

Function test_stack

tests/sympc/tensor/static_test.py:113–126  ·  view source on GitHub ↗
(get_clients)

Source from the content-addressed store, hash-verified

111
112
113def test_stack(get_clients):
114 clients = get_clients(2)
115
116 x_secret = torch.Tensor([0.0, 1, -2, 3, -4])
117 y_secret = torch.Tensor([-4, 3, -2, 1, 0.0])
118 secret_stacked = torch.stack([x_secret, y_secret])
119
120 session = Session(parties=clients)
121 SessionManager.setup_mpc(session)
122 x = MPCTensor(secret=x_secret, session=session)
123 y = MPCTensor(secret=y_secret, session=session)
124 stacked = stack([x, y])
125
126 assert (secret_stacked == stacked.reconstruct()).all()
127
128
129def test_cat(get_clients):

Callers

nothing calls this directly

Calls 6

SessionClass · 0.90
MPCTensorClass · 0.90
stackFunction · 0.90
setup_mpcMethod · 0.80
get_clientsFunction · 0.50
reconstructMethod · 0.45

Tested by

no test coverage detected