MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / __init__

Method __init__

diffusers/examples/community/rerender_a_video.py:1179–1186  ·  view source on GitHub ↗
(self, dims, mode="sintel", padding_factor=8)

Source from the content-addressed store, hash-verified

1177 """Pads images such that dimensions are divisible by 8"""
1178
1179 def __init__(self, dims, mode="sintel", padding_factor=8):
1180 self.ht, self.wd = dims[-2:]
1181 pad_ht = (((self.ht // padding_factor) + 1) * padding_factor - self.ht) % padding_factor
1182 pad_wd = (((self.wd // padding_factor) + 1) * padding_factor - self.wd) % padding_factor
1183 if mode == "sintel":
1184 self._pad = [pad_wd // 2, pad_wd - pad_wd // 2, pad_ht // 2, pad_ht - pad_ht // 2]
1185 else:
1186 self._pad = [pad_wd // 2, pad_wd - pad_wd // 2, 0, pad_ht]
1187
1188 def pad(self, *inputs):
1189 return [F.pad(x, self._pad, mode="replicate") for x in inputs]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected