MCPcopy Create free account
hub / github.com/AMAP-ML/Eevee / patchify

Method patchify

models/dit.py:359–367  ·  view source on GitHub ↗
(self, x: torch.Tensor, control_camera_latents_input: Optional[torch.Tensor] = None)

Source from the content-addressed store, hash-verified

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(

Callers 2

forwardMethod · 0.95
model_fn_wan_videoFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected