(self, x: torch.Tensor, control_camera_latents_input: Optional[torch.Tensor] = None)
| 357 | self.control_adapter = None |
| 358 | |
| 359 | def patchify(self, x: torch.Tensor, control_camera_latents_input: Optional[torch.Tensor] = None): |
| 360 | x = self.patch_embedding(x) |
| 361 | if self.control_adapter is not None and control_camera_latents_input is not None: |
| 362 | y_camera = self.control_adapter(control_camera_latents_input) |
| 363 | x = [u + v for u, v in zip(x, y_camera)] |
| 364 | x = x[0].unsqueeze(0) |
| 365 | grid_size = x.shape[2:] |
| 366 | x = rearrange(x, 'b c f h w -> b (f h w) c').contiguous() |
| 367 | return x, grid_size # x, grid_size: (f, h, w) |
| 368 | |
| 369 | def unpatchify(self, x: torch.Tensor, grid_size: torch.Tensor): |
| 370 | return rearrange( |
no outgoing calls
no test coverage detected