Function
resize_to_resolution
(
image: Float[Tensor, "3 height width"],
resolution: int,
)
Source from the content-addressed store, hash-verified
| 81 | |
| 82 | |
| 83 | def resize_to_resolution( |
| 84 | image: Float[Tensor, "3 height width"], |
| 85 | resolution: int, |
| 86 | ) -> Float[Tensor, "3 resized_height resized_width"]: |
| 87 | _, h, w = image.shape |
| 88 | |
| 89 | scale = (resolution / (h * w)) ** 0.5 |
| 90 | return F.interpolate( |
| 91 | image[None], |
| 92 | scale_factor=scale, |
| 93 | mode="bilinear", |
| 94 | align_corners=False, |
| 95 | )[0] |
| 96 | |
| 97 | |
| 98 | def subsample_frames( |
Tested by
no test coverage detected