MCPcopy Create free account
hub / github.com/OpenImagingLab/FlashVSR / encode

Method encode

diffsynth/models/stepvideo_vae.py:973–981  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

971
972 @torch.inference_mode()
973 def encode(self, x):
974 # b (nc cf) c h w -> (b nc) cf c h w -> encode -> (b nc) cf c h w -> b (nc cf) c h w
975 chunks = list(x.split(self.frame_len, dim=1))
976 for i in range(len(chunks)):
977 chunks[i] = self.naive_encode(chunks[i], True)
978 z = torch.cat(chunks, dim=1)
979
980 posterior = DiagonalGaussianDistribution(z)
981 return posterior.sample()
982
983 def decode_naive(self, z, is_init=True):
984 z = z.to(next(self.decoder.parameters()).dtype)

Callers

nothing calls this directly

Calls 3

naive_encodeMethod · 0.95
sampleMethod · 0.95

Tested by

no test coverage detected