MCPcopy Create free account
hub / github.com/tdrussell/diffusion-pipe / encode

Method encode

tools/cosmos_vae_test.py:49–57  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

47
48
49 def encode(self, x):
50 h = self.encoder(x)
51 z = self.quant_conv(h)
52 latent_ch = z.shape[1]
53 latent_t = z.shape[2]
54 dtype = z.dtype
55 mean = self.latent_mean.view(latent_ch, -1)[:, : latent_t].reshape([1, latent_ch, -1, 1, 1]).to(dtype=dtype, device=z.device)
56 std = self.latent_std.view(latent_ch, -1)[:, : latent_t].reshape([1, latent_ch, -1, 1, 1]).to(dtype=dtype, device=z.device)
57 return ((z - mean) / std) * self.sigma_data
58
59 def decode(self, z):
60 in_dtype = z.dtype

Callers 3

cosmos_vae_test.pyFile · 0.45
vae_encodeFunction · 0.45
vae_encodeFunction · 0.45

Calls 1

toMethod · 0.45

Tested by

no test coverage detected