MCPcopy Create free account
hub / github.com/AIRMEC/HECTOR / collate

Function collate

utils.py:21–31  ·  view source on GitHub ↗
(batch)

Source from the content-addressed store, hash-verified

19 random.seed(worker_seed)
20
21def collate(batch):
22 # Keep a numpy array on items that don't need to be a tensor for training.
23 img = torch.cat([item[0] for item in batch], dim=0)
24 img2 = torch.cat([item[1] for item in batch], dim=0)
25 label = torch.LongTensor([item[2] for item in batch])
26 event_time = np.array([item[3] for item in batch])
27 censorship = torch.FloatTensor([item[4] for item in batch])
28 stage = torch.LongTensor([item[5] for item in batch])
29 slide_id = [item[6] for item in batch]
30
31 return [img, img2, label, event_time, censorship, stage, slide_id]
32
33
34class FeatureBagsDataset(Dataset):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected