/block21.py Secret
Created
September 23, 2018 16:15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyModule(nn.Module): | |
def __init__(self, sizes): | |
super().__init__() | |
self.layers = nn.ModuleList([nn.Linear(in_f, out_f) for in_f, out_f in zip(sizes, sizes[1:])]) | |
self.trace = [] | |
def forward(self,x): | |
for layer in self.layers: | |
x = layer(x) | |
self.trace.append(x) | |
return x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment