class_docstr: Aggregation layer to compute the pixel-region representation.
class_docstr_tok: ["Aggregation","layer","to","compute","the","pixel-region","representation","."]
code: def forward(self, pixels, regions):
      n, c, h, w = pixels.shape
      _, k, _, _ = regions.shape
  
      # pixels: from (n, c, h, w) to (n, h*w, c)
      pixels = paddle.reshape(pixels, (n, c, h * w))
      pixels = paddle.transpose(pixels, (0, 2, 1))
  
      # regions: from (n, k, h, w) to (n, k, h*w)
      regions = paddle.reshape(regions, (n, k, h * w))
      regions = F.softmax(regions, axis=2)
  
      # feats: from (n, k, c) to (n, c, k, 1)
      feats = paddle.bmm(regions, pixels)
      feats = paddle.transpose(feats, (0, 2, 1))
      feats = paddle.unsqueeze(feats, axis=-1)
  
      return feats
  
imports: import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddleseg import utils
  from paddleseg.cvlibs import manager, param_init
  from paddleseg.models import layers
label_desc: Use image node_id 1 for calling the SpatialGatherBlock obj's underlying member method code with example usage: obj.forward(pixels, regions) and returns: feats