Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. def makeSomeLayers(in_channels,out_channels,resolutions):
  2. layers = []
  3. for r in resolutions:
  4. layers.append(nn.Conv2d(in_channels=in_channels,out_channels=out_channels,kernel_size=r))
  5. return layers
  6.  
  7.  
  8. class Net(nn.Module):
  9.  
  10. def __init__(self):
  11. super(Net, self).__init__()
  12. # example of adding
  13. in_channels = 3
  14. out_channels = 64
  15. resolutions = [3,5,7,9,11]
  16. self.convs = nn.ModuleList(makeSomeLayers(in_channels,out_channels,resolutions))
  17.  
  18.  
  19. def forward(self,x):
  20. # call the various defined operations on the input...
  21. outs = [op(x) for op in self.convs]
  22.  
  23.  
  24. # do something with output...
  25. x = .....
  26.  
  27. return x
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement