Last active
December 27, 2018 00:17
-
-
Save travishsu/5e575f9d95fa0199dff4d5f2b21d71ce to your computer and use it in GitHub Desktop.
This file contains 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
class YourDataset(torch.utils.data.Dataset): | |
def __init__(self, ...): | |
... | |
def __len__(self): | |
... | |
return num_all_examples | |
def __getitem__(self, idx): | |
... | |
return one_image, one_caption | |
dataset = YourDataset(...) | |
loader = torch.utils.data.DataLoader(dataset, ...) | |
for batch_images, batch_captions in loader: | |
# Train your network | |
.... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment