Thank you for your help!
I probably define weights in wrong way…
weights=[0.5, 0.5]
weights = torch.DoubleTensor(weights)
As far as I understand I assign equal probability for each class and indeed, it gives approximately equal number of zroes and ones in trainloader.
sampler = torch.utils.data.sampler.WeightedRandomSampler(weights, 300, replacement=True)
Is it incorrect?