(batch: Batch, shape: tuple[int, int])
| 17 | |
| 18 | |
| 19 | def resize_batch(batch: Batch, shape: tuple[int, int]) -> Batch: |
| 20 | b, f, _, _, _ = batch.videos.shape |
| 21 | h, w = shape |
| 22 | |
| 23 | videos = rearrange(batch.videos, "b f c h w -> (b f) c h w") |
| 24 | videos = F.interpolate(videos, (h, w), mode="bilinear", align_corners=False) |
| 25 | videos = rearrange(videos, "(b f) c h w -> b f c h w", b=b, f=f) |
| 26 | |
| 27 | return replace(batch, videos=videos) |
| 28 | |
| 29 | |
| 30 | def compute_patch_cropped_shape( |
no outgoing calls
no test coverage detected