class_docstr: Adapted from CLIP: https://github.com/openai/CLIP/blob/main/clip/model.py
class_docstr_tok: ["Adapted","from","CLIP",":","https",":","\/\/github.com\/openai\/CLIP\/blob\/main\/clip\/model.py"]
code: def __init__(
      self,
      spacial_dim: int,
      embed_dim: int,
      num_heads_channels: int,
      output_dim: int = None,
  ):
      super().__init__()
      # self.positional_embedding = nn.Parameter(
      #     th.randn(embed_dim, spacial_dim ** 2 + 1) / embed_dim ** 0.5
      # )
      positional_embedding = self.create_parameter(
          paddle.randn(embed_dim, spacial_dim**2 + 1)
          / embed_dim**0.5
      )
      self.add_parameter("positional_embedding", positional_embedding)
      self.qkv_proj = conv_nd(1, embed_dim, 3 * embed_dim, 1)
      self.c_proj = conv_nd(1, embed_dim, output_dim or embed_dim, 1)
      self.num_heads = embed_dim // num_heads_channels
      self.attention = QKVAttention(self.num_heads)
  
imports: import math
  from abc import abstractmethod
  import numpy
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from .nn import avg_pool_nd
  from .nn import checkpoint
  from .nn import conv_nd
  from .nn import linear
  from .nn import normalization
  from .nn import SiLU
  from .nn import timestep_embedding
  from .nn import zero_module
label_desc: Use image node_id 1 to create a new AttentionPool2d object from inherited base classes: nn with example: obj = AttentionPool2d(spacial_dim, embed_dim, num_heads_channels, output_dim)