Example #1
0
def test_send_get_log_chain(workers):
    """
    Test sending and getting back a chain including a logtensor
    """

    # Build a long chain tensor Wrapper>LoggingTensor>TorchTensor
    x_tensor = torch.Tensor([1, 2, 3])
    x = LoggingTensor().on(x_tensor)
    x_ptr = x.send(workers["bob"])
    x_back = x_ptr.get()

    assert (x_back.child.child == x_tensor).all()
Example #2
0
def test_remote_method_on_log_chain(workers):
    """
    Test remote method call on a chain including a log tensor
    """

    # Build a long chain tensor Wrapper>LoggingTensor>TorchTensor
    x_tensor = torch.Tensor([1, 2, 3])
    x = LoggingTensor().on(x_tensor)
    x_ptr = x.send(workers["bob"])
    y_ptr = F.relu(x_ptr)
    y = y_ptr.get()

    assert (y.child.child == F.relu(x_tensor)).all()