Skip to content

Commit

Permalink
chore(test): add osx test
Browse files Browse the repository at this point in the history
Signed-off-by: weiwee <wbwmat@gmail.com>
  • Loading branch information
sagewe committed Jan 5, 2023
1 parent 4ac4709 commit 46ed589
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 22 deletions.
6 changes: 3 additions & 3 deletions python/test/test_matmul.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def t1(ctx):
@fixture
def t3():
return tensor.tensor(
torch.tensor([[1.0, 2.0, 3.0, 4.0, 5.0, 6.0], [1.0, 2.0, 3.0, 4.0, 5.0, 6.0], [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]]),
torch.tensor([[1.0], [1.0], [1.0]]),
)


Expand All @@ -56,6 +56,6 @@ def t4():


def test_1(t1, t3):
print(t1.to_local())
print(t1)
print(t3)
print(tensor.matmul(t1, t3).to_local())
print(tensor.matmul(t1, t3))
39 changes: 20 additions & 19 deletions python/test/test_osx.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,24 @@
print(t3)
print(f"t1={t1}")
print(f"t2={t2}")
# for method in ["add", "sub", "div", "mul"]:
# out = getattr(tensor, method)(t1, t2)
# print(f"{method}(t1, t2): \n{out}")

# for method in ["exp", "log", "neg", "reciprocal", "square", "abs"]:
# out = getattr(tensor, method)(t1)
# print(f"{method}(t1): \n{out}")

# for method in ["pow", "remainder"]:
# out = getattr(tensor, method)(t1, 3.14)
# print(f"{method}(t1, 3.14): \n{out}")

# encryptor, decryptor = ctx.cipher.phe.keygen()
# t3 = encryptor.encrypt(t1)

# t4 = t3 + t2
# t5 = decryptor.decrypt(t4)
# print(t1)
# print(t2)
# print(t5)
t1 = tensor.distributed_tensor(
ctx,
[
torch.tensor([[1, 2, 3], [4, 5, 6]]),
torch.tensor([[1, 2, 3], [4, 5, 6]]),
torch.tensor([[1, 2, 3], [4, 5, 6]]),
],
)
t2 = tensor.distributed_tensor(
ctx2,
[
torch.tensor([[1, 2, 3], [4, 5, 6]]),
torch.tensor([[1, 2, 3], [4, 5, 6]]),
torch.tensor([[1, 2, 3], [4, 5, 6]]),
],
)
ctx.hosts.put("tensor", t1)
t3 = ctx2.guest.get("tensor")
t3.storage.blocks.mapValues(lambda x: x)
print(t3.storage.collect())

0 comments on commit 46ed589

Please sign in to comment.