MCPcopy Create free account
hub / github.com/CompVis/zigma / resize_scale

Function resize_scale

datasets/video_utils.py:68–77  ·  view source on GitHub ↗
(clip, target_size, interpolation_mode)

Source from the content-addressed store, hash-verified

66
67
68def resize_scale(clip, target_size, interpolation_mode):
69 if len(target_size) != 2:
70 raise ValueError(
71 f"target size should be tuple (height, width), instead got {target_size}"
72 )
73 H, W = clip.size(-2), clip.size(-1)
74 scale_ = target_size[0] / min(H, W)
75 return torch.nn.functional.interpolate(
76 clip, scale_factor=scale_, mode=interpolation_mode, align_corners=False
77 )
78
79
80def resized_crop(clip, i, j, h, w, size, interpolation_mode="bilinear"):

Callers 1

__call__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected