INNER CODE UNIT · Python
f_atlas
wenhaochai/StableVideo · app.py:303
f_atlas = f_atlas * (1 - mask) + f_atlas_origin * mask
f_atlas = torch.nn.functional.pad(
f_atlas,
pad=(
self.data.foreground_atlas_bbox[1],
self.data.foreground_grid_atlas.shape[-1] - (self.data.foreground_atlas_bbox[1] + self.data.foreground_atlas_bbox[3]),
self.data.foreground_atlas_bbox[0],
self.data.foreground_grid_atlas.shape[-2] - (self.data.foreground_atlas_bbox[0] + self.data.foreground_atlas_bbox[2]),
),
mode="replicate",
)
foreground_edit = F.grid_sample(
f_atlas, self.data.scaled_foreground_uvs, mode="bilinear", align_corners=self.data.config["align_corners"]
).clamp(min=0.0, max=1.0)
foreground_edit = foreground_edit.squeeze().t() # shape (batch, 3)
foreground_edit = (