return self.core(x)
+ def named_parameters(self, memo=None, prefix=''):
+ assert self.core is not None, 'Parameters not yet defined'
+ return super(LazyLinear, self).named_parameters(memo, prefix)
+
######################################################################
-model = nn.Sequential(nn.Conv2d(1, 8, kernel_size = 5),
- nn.ReLU(inplace = True),
- LazyLinear(128),
- nn.ReLU(inplace = True),
- nn.Linear(128, 10))
+if __name__ == "__main__":
+ model = nn.Sequential(nn.Conv2d(3, 8, kernel_size = 5),
+ nn.ReLU(inplace = True),
+ LazyLinear(128),
+ nn.ReLU(inplace = True),
+ nn.Linear(128, 10))
+
+ # model.eval()
+
+ input = Tensor(100, 3, 32, 32).normal_()
-# model.eval()
+ output = model(input)
-input = Tensor(100, 1, 32, 32).normal_()
+ for n, x in model.named_parameters():
+ print(n, x.size())
-output = model(input)