class_docstr: The consistency decoder used with DALL-E 3.
  
  Examples:
      ```py
      >>> import torch
      >>> from diffusers import StableDiffusionPipeline, ConsistencyDecoderVAE
  
      >>> vae = ConsistencyDecoderVAE.from_pretrained("openai/consistency-decoder", torch_dtype=torch.float16)
      >>> pipe = StableDiffusionPipeline.from_pretrained(
      ...     "runwayml/stable-diffusion-v1-5", vae=vae, torch_dtype=torch.float16
      ... ).to("cuda")
  
      >>> pipe("horse", generator=torch.manual_seed(0)).images
      ```
class_docstr_tok: ["The","consistency","decoder","used","with","DALL-E","3",".","Examples",":","``","`","py",">",">",">","import","torch",">",">",">","from","diffusers","import","StableDiffusionPipeline",",","ConsistencyDecoderVAE",">",">",">","vae","=","ConsistencyDecoderVAE.from_pretrained","(","``","openai\/consistency-decoder","''",",","torch_dtype=torch.float16",")",">",">",">","pipe","=","StableDiffusionPipeline.from_pretrained","(","...","``","runwayml\/stable-diffusion-v1-5","''",",","vae=vae",",","torch_dtype=torch.float16","...",")",".to","(","``","cuda","''",")",">",">",">","pipe","(","``","horse","''",",","generator=torch.manual_seed","(","0",")",")",".images","``","`"]
docstr: Encode a batch of images into latents.
  
  Args:
      x (`torch.FloatTensor`): Input batch of images.
      return_dict (`bool`, *optional*, defaults to `True`):
          Whether to return a [`~models.consistecy_decoder_vae.ConsistencyDecoderOoutput`] instead of a plain
          tuple.
  
  Returns:
          The latent representations of the encoded images. If `return_dict` is True, a
          [`~models.consistency_decoder_vae.ConsistencyDecoderVAEOutput`] is returned, otherwise a plain `tuple`
          is returned.
docstr_tok: ["Encode","a","batch","of","images","into","latents",".","Args",":","x","(","`","torch.FloatTensor","`",")",":","Input","batch","of","images",".","return_dict","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","return","a","[","`","~models.consistecy_decoder_vae.ConsistencyDecoderOoutput","`","]","instead","of","a","plain","tuple",".","Returns",":","The","latent","representations","of","the","encoded","images",".","If","`","return_dict","`","is","True",",","a","[","`","~models.consistency_decoder_vae.ConsistencyDecoderVAEOutput","`","]","is","returned",",","otherwise","a","plain","`","tuple","`","is","returned","."]
code: def encode(
      self, x: torch.FloatTensor, return_dict: bool = True
  ) -> Union[
      ConsistencyDecoderVAEOutput, Tuple[DiagonalGaussianDistribution]
  ]:
      """
      Encode a batch of images into latents.
  
      Args:
          x (`torch.FloatTensor`): Input batch of images.
          return_dict (`bool`, *optional*, defaults to `True`):
              Whether to return a [`~models.consistecy_decoder_vae.ConsistencyDecoderOoutput`] instead of a plain
              tuple.
  
      Returns:
              The latent representations of the encoded images. If `return_dict` is True, a
              [`~models.consistency_decoder_vae.ConsistencyDecoderVAEOutput`] is returned, otherwise a plain `tuple`
              is returned.
      """
      if self.use_tiling and (
          x.shape[-1] > self.tile_sample_min_size
          or x.shape[-2] > self.tile_sample_min_size
      ):
          return self.tiled_encode(x, return_dict=return_dict)
  
      if self.use_slicing and x.shape[0] > 1:
          encoded_slices = [
              self.encoder(x_slice) for x_slice in x.split(1)
          ]
          h = torch.cat(encoded_slices)
      else:
          h = self.encoder(x)
  
      moments = self.quant_conv(h)
      posterior = DiagonalGaussianDistribution(moments)
  
      if not return_dict:
          return (posterior,)
  
      return ConsistencyDecoderVAEOutput(latent_dist=posterior)
  
imports: from dataclasses import dataclass
  from typing import Dict, Optional, Tuple, Union
  import torch
  import torch.nn.functional
  from torch import nn
  from ...configuration_utils import ConfigMixin, register_to_config
  from ...schedulers import ConsistencyDecoderScheduler
  from ...utils import BaseOutput
  from ...utils.accelerate_utils import apply_forward_hook
  from ...utils.torch_utils import randn_tensor
  from ..attention_processor import ADDED_KV_ATTENTION_PROCESSORS, CROSS_ATTENTION_PROCESSORS, AttentionProcessor, AttnAddedKVProcessor, AttnProcessor
  from ..modeling_utils import ModelMixin
  from ..unet_2d import UNet2DModel
  from .vae import DecoderOutput, DiagonalGaussianDistribution, Encoder
label_desc: Use image node_id 9 for calling the ConsistencyDecoderVAE obj's underlying member method code with example usage: obj.encode(x, return_dict) and returns: ConsistencyDecoderVAEOutput, self, posterior