vmtmxmf5 / Pytorch-

pytorch로 머신러닝~딥러닝 구현
3 stars 0 forks source link

__getitem__, __len__은 어디에 사용하는 걸까? #18

Open vmtmxmf5 opened 3 years ago

vmtmxmf5 commented 3 years ago
class BasicDataset(data.Dataset):
    def __init__(self, x_tensor, y_tensor):
        super(BasicDataset, self).__init__()

        self.x = x_tensor
        self.y = y_tensor

    def __getitem__(self, index):
        return self.x[index], self.y[index]

    def __len__(self):
        return len(self.x)

https://hulk89.github.io/pytorch/2019/09/30/pytorch_dataset/ https://sanghyu.tistory.com/90