SHARE
TWEET

Untitled

a guest Jun 24th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top