Skip to content

Instantly share code, notes, and snippets.

View SmileyScientist's full-sized avatar

Anjali Jogeshwar SmileyScientist

View GitHub Profile
@phimachine
phimachine / train_valid_split.py
Last active April 10, 2020 12:29
This is a pytorch generic function that takes a data.Dataset object and splits it to validation and training efficiently.
import np
from torch.utils.data import Dataset
class GenHelper(Dataset):
def __init__(self, mother, length, mapping):
# here is a mapping from this index to the mother ds index
self.mapping=mapping
self.length=length
self.mother=mother