MCPcopy Create free account
hub / github.com/pytorch/examples / MyTrainDataset

Class MyTrainDataset

distributed/ddp-tutorial-series/datautils.py:4–13  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2from torch.utils.data import Dataset
3
4class MyTrainDataset(Dataset):
5 def __init__(self, size):
6 self.size = size
7 self.data = [(torch.rand(20), torch.rand(1)) for _ in range(size)]
8
9 def __len__(self):
10 return self.size
11
12 def __getitem__(self, index):
13 return self.data[index]

Callers 4

load_train_objsFunction · 0.90
load_train_objsFunction · 0.90
load_train_objsFunction · 0.90
load_train_objsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected