class_docstr: Attention pooling w/ latent query
      
code: def __init__(
      self,
      in_features: int,
      out_features: int = None,
      embed_dim: int = None,
      num_heads: int = 8,
      mlp_ratio: float = 4.0,
      qkv_bias: bool = True,
      qk_norm: bool = False,
      latent_len: int = 1,
      latent_dim: int = None,
      pos_embed: str = "",
      pool_type: str = "token",
      norm_layer: Optional[nn.Module] = None,
      drop: float = 0.0,
  ):
      super().__init__()
      embed_dim = embed_dim or in_features
      out_features = out_features or in_features
      assert embed_dim % num_heads == 0
      self.num_heads = num_heads
      self.head_dim = embed_dim // num_heads
      self.scale = self.head_dim**-0.5
      self.pool = pool_type
      self.fused_attn = use_fused_attn()
  
      if pos_embed == "abs":
          spatial_len = self.feat_size
          self.pos_embed = nn.Parameter(
              torch.zeros(spatial_len, in_features)
          )
      else:
          self.pos_embed = None
  
      self.latent_dim = latent_dim or embed_dim
      self.latent_len = latent_len
      self.latent = nn.Parameter(
          torch.zeros(1, self.latent_len, embed_dim)
      )
  
      self.q = nn.Linear(embed_dim, embed_dim, bias=qkv_bias)
      self.kv = nn.Linear(embed_dim, embed_dim * 2, bias=qkv_bias)
      self.q_norm = (
          norm_layer(self.head_dim) if qk_norm else nn.Identity()
      )
      self.k_norm = (
          norm_layer(self.head_dim) if qk_norm else nn.Identity()
      )
      self.proj = nn.Linear(embed_dim, embed_dim)
      self.proj_drop = nn.Dropout(drop)
  
      self.norm = (
          norm_layer(out_features)
          if norm_layer is not None
          else nn.Identity()
      )
      self.mlp = Mlp(embed_dim, int(embed_dim * mlp_ratio))
  
      self.init_weights()
  
file_path: pytorch-image-models/timm/layers/attention_pool.py
imports: from typing import Optional
  import torch
  import torch.nn
  import torch.nn.functional
  from .config import use_fused_attn
  from .mlp import Mlp
  from .weight_init import trunc_normal_tf_
label_desc: Use image node_id 1 to create a new AttentionPoolLatent object from inherited base classes: nn with example: obj = AttentionPoolLatent(in_features, out_features, embed_dim, num_heads, mlp_ratio, qkv_bias, qk_norm, latent_len, latent_dim, pos_embed, pool_type, norm_layer, drop)