Since mask is not trainable, you should register it as a buffer via:
mask = torch.ones(1, 100)
mask[:, :50] = 0.
self.register_buffer('mask', mask)

This will make sure to push it to the right device as is done with parameters.