MCPcopy Create free account
hub / github.com/Francis-Rings/FlashPortrait / decode

Method decode

wan/models/wan_vae_tiny.py:253–262  ·  view source on GitHub ↗
(self, latents, parallel=False)

Source from the content-addressed store, hash-verified

251
252 @torch.no_grad()
253 def decode(self, latents, parallel=False):
254 if latents.ndim == 4:
255 latents = latents.unsqueeze(0)
256
257 if self.need_scaled:
258 latents_mean = torch.tensor(self.latents_mean).view(1, self.z_dim, 1, 1, 1).to(latents.device, latents.dtype)
259 latents_std = 1.0 / torch.tensor(self.latents_std).view(1, self.z_dim, 1, 1, 1).to(latents.device, latents.dtype)
260 latents = latents / latents_std + latents_mean
261
262 return self.taehv.decode_video(latents.transpose(1, 2).to(self.dtype), parallel=parallel, show_progress_bar=False).transpose(1, 2).mul_(2).sub_(1)
263
264 @torch.no_grad()
265 def encode_video(self, vid):

Callers

nothing calls this directly

Calls 1

decode_videoMethod · 0.45

Tested by

no test coverage detected