MCPcopy Index your code
hub / github.com/huggingface/diffusers / encode

Method encode

src/diffusers/models/vae_flax.py:888–898  ·  view source on GitHub ↗
(self, sample, deterministic: bool = True, return_dict: bool = True)

Source from the content-addressed store, hash-verified

886 return self.init(rngs, sample)["params"]
887
888 def encode(self, sample, deterministic: bool = True, return_dict: bool = True):
889 sample = jnp.transpose(sample, (0, 2, 3, 1))
890
891 hidden_states = self.encoder(sample, deterministic=deterministic)
892 moments = self.quant_conv(hidden_states)
893 posterior = FlaxDiagonalGaussianDistribution(moments)
894
895 if not return_dict:
896 return (posterior,)
897
898 return FlaxAutoencoderKLOutput(latent_dist=posterior)
899
900 def decode(self, latents, deterministic: bool = True, return_dict: bool = True):
901 if latents.shape[-1] != self.config.latent_channels:

Callers 15

__call__Method · 0.95
_encode_vae_imageMethod · 0.45
_encode_vae_imageMethod · 0.45
prepare_latents_img2imgFunction · 0.45
_encode_vae_imageMethod · 0.45
encode_vae_imageFunction · 0.45
encode_vae_imageFunction · 0.45
encode_vae_imageFunction · 0.45
__call__Method · 0.45
__call__Method · 0.45
__call__Method · 0.45
__call__Method · 0.45

Calls 3

transposeMethod · 0.80

Tested by

no test coverage detected