Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. def test_execute_plan_module_remotely(hook, start_proc):
  2. """Test plan execution remotely."""
  3. hook.local_worker.is_client_worker = False
  4.  
  5. class Net(nn.Module):
  6. def __init__(self):
  7. super(Net, self).__init__()
  8. self.fc1 = nn.Linear(2, 3)
  9. self.fc2 = nn.Linear(3, 2)
  10.  
  11. @sy.method2plan
  12. def forward(self, x):
  13. x = F.relu(self.fc1(x))
  14. x = self.fc2(x)
  15. return F.log_softmax(x, dim=0)
  16.  
  17. net = Net()
  18. x = th.tensor([-1, 2.0])
  19.  
  20. local_res = net(x)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement