class_docstr: Transformer block for image-like data. First, project the input (aka embedding) and reshape to b, t, d. Then apply
  standard transformer action. Finally, reshape to image
class_docstr_tok: ["Transformer","block","for","image-like","data",".","First",",","project","the","input","(","aka","embedding",")","and","reshape","to","b",",","t",",","d.","Then","apply","standard","transformer","action",".","Finally",",","reshape","to","image"]
code: def __init__(
      self,
      in_channels,
      n_heads,
      d_head,
      depth=1,
      dropout=0.0,
      context_dim=None,
  ):
      super().__init__()
      self.n_heads = n_heads
      self.d_head = d_head
      self.in_channels = in_channels
      inner_dim = n_heads * d_head
      self.norm = nn.GroupNorm(
          num_groups=32, num_channels=in_channels, epsilon=1e-6
      )
  
      self.proj_in = nn.Conv2D(
          in_channels, inner_dim, kernel_size=1, stride=1, padding=0
      )
  
      self.transformer_blocks = nn.LayerList(
          [
              BasicTransformerBlock(
                  inner_dim,
                  n_heads,
                  d_head,
                  dropout=dropout,
                  context_dim=context_dim,
              )
              for d in range(depth)
          ]
      )
  
      self.proj_out = nn.Conv2D(
          inner_dim, in_channels, kernel_size=1, stride=1, padding=0
      )
  
imports: import math
  from inspect import isfunction
  import numpy
  import paddle
  import paddle.nn
  import paddle.nn.functional
label_desc: Use image node_id 1 to create a new SpatialTransformer object from inherited base classes: nn with example: obj = SpatialTransformer(in_channels, n_heads, d_head, depth, dropout, context_dim)