(batch)
| 19 | random.seed(worker_seed) |
| 20 | |
| 21 | def 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 | |
| 34 | class FeatureBagsDataset(Dataset): |
nothing calls this directly
no outgoing calls
no test coverage detected