Skip to content

Instantly share code, notes, and snippets.

@hereismari
Created June 13, 2019 14:53
Show Gist options
  • Save hereismari/a30ea03066a9dc5c45c613624595447b to your computer and use it in GitHub Desktop.
Save hereismari/a30ea03066a9dc5c45c613624595447b to your computer and use it in GitHub Desktop.
def test_execute_plan_module_remotely(hook, start_proc):
"""Test plan execution remotely."""
hook.local_worker.is_client_worker = False
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.fc1 = nn.Linear(2, 3)
self.fc2 = nn.Linear(3, 2)
@sy.method2plan
def forward(self, x):
x = F.relu(self.fc1(x))
x = self.fc2(x)
return F.log_softmax(x, dim=0)
net = Net()
x = th.tensor([-1, 2.0])
local_res = net(x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment