class_docstr: The configuration structure for an encoder block
class_docstr_tok: ["The","configuration","structure","for","an","encoder","block"]
code: def __init__(
      self,
      dim_model: int,
      feedforward_config: Dict[str, Any],
      multi_head_config: Dict[str, Any],
      position_encoding_config: Optional[Dict[str, Any]] = None,
      residual_norm_style: str = "post",
      normalization: NormalizationType = NormalizationType.LayerNorm,
      use_triton: bool = True,
      simplicial_embeddings: Optional[Dict[str, Any]] = None,
      patch_embedding_config: Optional[Dict[str, Any]] = None,
      **kwargs,
  ):
      # Convenience, fill in duplicated fields
      try:
          if "dim_model" not in multi_head_config.keys():
              multi_head_config["dim_model"] = dim_model
  
          if "dim_model" not in feedforward_config.keys():
              feedforward_config["dim_model"] = dim_model
  
          if (
              position_encoding_config is not None
              and "dim_model" not in position_encoding_config.keys()
          ):
              position_encoding_config["dim_model"] = dim_model
  
          if (
              patch_embedding_config is not None
              and "out_channels" not in patch_embedding_config.keys()
          ):
              patch_embedding_config["out_channels"] = dim_model
  
      except AttributeError:
          # A config instance was passed in, this is fine
          pass
      if "block_type" in kwargs:
          assert kwargs["block_type"] == "encoder"
      kwargs["block_type"] = BlockType("encoder")
      super().__init__(
          dim_model=dim_model,
          feedforward_config=feedforward_config,
          position_encoding_config=position_encoding_config,
          residual_norm_style=ResidualNormStyle(residual_norm_style),
          normalization=NormalizationType(normalization),
          **kwargs,
      )
  
      self.multi_head_config = multi_head_config
      self.use_triton = use_triton
      self.simplicial_embeddings = simplicial_embeddings
      self.patch_embedding_config = patch_embedding_config
  
imports: from dataclasses import dataclass
  from enum import Enum
  from typing import Any, Dict, Optional
  from xformers.components import NormalizationType, ResidualNormStyle
  from xformers.components.feedforward import FEEDFORWARD_REGISTRY, FeedforwardConfig
  from xformers.components.positional_embedding import POSITION_EMBEDDING_REGISTRY, PositionEmbeddingConfig
  from xformers.utils import generate_matching_config
label_desc: Use image node_id 1 to create a new xFormerEncoderConfig object from inherited base classes: xFormerBlockConfig with example: obj = xFormerEncoderConfig(dim_model, feedforward_config, multi_head_config, position_encoding_config, residual_norm_style, normalization, use_triton, simplicial_embeddings, patch_embedding_config)