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

Method encode

models/cosmos.py:66–74  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

64 self.latent_std = nn.Parameter(torch.ones([self.embedding_dim * latent_temporal_chunk], dtype=torch.float32))
65
66 def encode(self, x):
67 h = self.encoder(x)
68 z = self.quant_conv(h)
69 latent_ch = z.shape[1]
70 latent_t = z.shape[2]
71 dtype = z.dtype
72 mean = self.latent_mean.view(latent_ch, -1)[:, : latent_t].reshape([1, latent_ch, -1, 1, 1]).to(dtype=dtype, device=z.device)
73 std = self.latent_std.view(latent_ch, -1)[:, : latent_t].reshape([1, latent_ch, -1, 1, 1]).to(dtype=dtype, device=z.device)
74 return ((z - mean) / std) * self.sigma_data
75
76 def decode(self, z):
77 in_dtype = z.dtype

Callers 1

vae_encodeFunction · 0.45

Calls 1

toMethod · 0.45

Tested by

no test coverage detected