Last active
May 15, 2019 07:13
-
-
Save syaffers/70e8b8f779f341de5ddc813efcd0d90b to your computer and use it in GitHub Desktop.
The first iteration of the numbers dataset
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from torch.utils.data import Dataset | |
class NumbersDataset(Dataset): | |
def __init__(self): | |
self.samples = list(range(1, 1001)) | |
def __len__(self): | |
return len(self.samples) | |
def __getitem__(self, idx): | |
return self.samples[idx] | |
if __name__ == '__main__': | |
dataset = NumbersDataset() | |
print(len(dataset)) | |
print(dataset[100]) | |
print(dataset[122:361]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment