Skip to content

Instantly share code, notes, and snippets.

Created February 19, 2018 22:35
What would you like to do?
PyTorch Sampler for Intensional Overfitting!
from import Sampler
class MySampler(Sampler):
def __init__(self, main_source, indices):
self.main_source = main_source
self.indices = indices
main_source_len = len(self.main_source)
how_many = int(round(main_source_len / len(self.indices)))
self.to_iter_from = []
for _ in range(how_many):
def __iter__(self):
return iter(self.to_iter_from)
def __len__(self):
return len(self.main_source)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment