| Conditions | 4 |
| Total Lines | 25 |
| Code Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import torch |
||
| 17 | def try_inference(self, padding_mode): |
||
| 18 | for n in 17, 27: |
||
| 19 | patch_size = 10, 15, n |
||
| 20 | patch_overlap = 4, 6, 8 |
||
| 21 | batch_size = 6 |
||
| 22 | |||
| 23 | grid_sampler = GridSampler( |
||
| 24 | self.sample, |
||
| 25 | patch_size, |
||
| 26 | patch_overlap, |
||
| 27 | padding_mode=padding_mode, |
||
| 28 | ) |
||
| 29 | aggregator = GridAggregator(grid_sampler) |
||
| 30 | patch_loader = DataLoader(grid_sampler, batch_size=batch_size) |
||
| 31 | with torch.no_grad(): |
||
| 32 | for patches_batch in tqdm(patch_loader): |
||
| 33 | input_tensor = patches_batch['t1'][DATA] |
||
| 34 | locations = patches_batch[LOCATION] |
||
| 35 | logits = model(input_tensor) # some model |
||
| 36 | outputs = logits |
||
| 37 | aggregator.add_batch(outputs, locations) |
||
| 38 | |||
| 39 | output = aggregator.get_output_tensor() |
||
| 40 | assert (output == -5).all() |
||
| 41 | assert output.shape == self.sample.t1.shape |
||
| 42 | |||
| 47 |