Solved by ptrblck in post #2 
              
              
                If you’ve passed all parameters to the optimizer after initializing the model via: 
optimizer = optim.SGD(model.parameters(), lr=1e-3)

the self.mask parameter won’t be included and thus not updated, since it wasn’t initialized yet. 
Could you pass the desired input shape to the initialization of th…