Solved by ptrblck in post #2 
              
              
                All nn.Parameters, nn.Modules and buffers will be transferred to the specified device. 
To push self.m to the device, you should register it as a buffer via: 
self.register_buffer('m', torch.tensor(m))