Solved by ptrblck in post #2 
              
              
                In your code you are setting self.out_fea to size before the actual creation of the new nn.Parameter so that torch.randn will yield an empty tensor (size - self.out_fea will be 0). 
Move the update of self.out_fea after the new parameter assignment and it should work.