Transformer2D A Transformer model for image-like data from CompVis that is based on the Vision Transformer introduced by Dosovitskiy et al. The Transformer2DModel accepts discrete (classes of vector embeddings) or continuous (actual embeddings) inputs. When the input is continuous: Project the input and reshape it to (batch_size, sequence_length, feature_dimension). Apply the Transformer blocks in the standard way. Reshape to image. When the input is discrete: It is assumed one of the input classes is the masked latent pixel. The predicted classes of the unnoised image don’t contain a prediction for the masked pixel because the unnoised image cannot be masked. Convert input (classes of latent pixels) to embeddings and apply positional embeddings. Apply the Transformer blocks in the standard way. Predict classes of unnoised image.  Transformer2DModel  class diffusers.Transformer2DModel  < source > ( num_attention_heads: int = 16 attention_head_dim: int = 88 in_channels: Optional = None out_channels: Optional = None num_layers: int = 1 dropout: float = 0.0 norm_num_groups: int = 32 cross_attention_dim: Optional = None attention_bias: bool = False sample_size: Optional = None num_vector_embeds: Optional = None patch_size: Optional = None activation_fn: str = 'geglu' num_embeds_ada_norm: Optional = None use_linear_projection: bool = False only_cross_attention: bool = False double_self_attention: bool = False upcast_attention: bool = False norm_type: str = 'layer_norm' norm_elementwise_affine: bool = True norm_eps: float = 1e-05 attention_type: str = 'default' caption_channels: int = None interpolation_scale: float = None  )   Parameters   num_attention_heads (int, optional, defaults to 16) — The number of heads to use for multi-head attention.   attention_head_dim (int, optional, defaults to 88) — The number of channels in each head.   in_channels (int, optional) —