class_docstr: An attention block that allows spatial positions to attend to each other.
  
  Originally ported from here, but adapted to the N-d case.
  https://github.com/hojonathanho/diffusion/blob/1e0dceb3b3495bbe19116a5e1b3596cd0706c543/diffusion_tf/models/unet.py#L66.
class_docstr_tok: ["An","attention","block","that","allows","spatial","positions","to","attend","to","each","other",".","Originally","ported","from","here",",","but","adapted","to","the","N-d","case",".","https",":","\/\/github.com\/hojonathanho\/diffusion\/blob\/1e0dceb3b3495bbe19116a5e1b3596cd0706c543\/diffusion_tf\/models\/unet.py","#","L66","."]
code: def _forward(self, x):
      b, c, *spatial = x.shape
      # x = x.reshape(b, c, -1)
      x = paddle.reshape(x, [b, c, -1])
      qkv = self.qkv(self.norm(x))
      h = self.attention(qkv)
      h = self.proj_out(h)
      # return (x + h).reshape(b, c, *spatial)
      return paddle.reshape(x + h, [b, c, *spatial])
  
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 3 for calling the AttentionBlock obj's underlying member method code with example usage: obj._forward(x) and returns: paddle