Pytorch中数据采样方法Sampler(torch.utils.data)(二) —— WeightedRandomSampler & SubsetRandomSampler
WeightedRandomSampler加权随机采样平衡不平衡数据的抽取torch.utils.data.WeightedRandomSampler(weights,num_samples,replacement=True)其中__iter__为:iter(torch.multinomial(self.weights,self.num_samples,self.replacement).toli