Created
December 16, 2018 17:07
-
-
Save foowaa/db7617f22103168cea1bac4fc531971e 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
import torch.utils.data as data | |
class MyDataset(data.Dataset): | |
''' | |
Dataset must define __getitem__ and __len__ | |
''' | |
def __init__(self, others): | |
pass | |
def __getitem__(self, index): | |
""" | |
index位置的(x, y), x和y都是tensor | |
Returns one data pair (x and y). | |
""" | |
return x, y | |
def __len__(self): | |
# 0<= index < lens | |
return lens |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment