class_docstr: General self-attention block/non-local block.
  
  The original article refers to refer to https://arxiv.org/abs/1706.03762.
  Args:
      key_in_channels (int): Input channels of key feature.
      query_in_channels (int): Input channels of query feature.
      channels (int): Output channels of key/query transform.
      out_channels (int): Output channels.
      share_key_query (bool): Whether share projection weight between key
          and query projection.
      query_downsample (nn.Module): Query downsample module.
      key_downsample (nn.Module): Key downsample module.
      key_query_num_convs (int): Number of convs for key/query projection.
      value_out_num_convs (int): Number of convs for value projection.
      key_query_norm (bool): Whether to use BN for key/query projection.
      value_out_norm (bool): Whether to use BN for value projection.
      matmul_norm (bool): Whether normalize attention map with sqrt of
          channels
      with_out (bool): Whether use out projection.
class_docstr_tok: ["General","self-attention","block\/non-local","block",".","The","original","article","refers","to","refer","to","https",":","\/\/arxiv.org\/abs\/1706.03762",".","Args",":","key_in_channels","(","int",")",":","Input","channels","of","key","feature",".","query_in_channels","(","int",")",":","Input","channels","of","query","feature",".","channels","(","int",")",":","Output","channels","of","key\/query","transform",".","out_channels","(","int",")",":","Output","channels",".","share_key_query","(","bool",")",":","Whether","share","projection","weight","between","key","and","query","projection",".","query_downsample","(","nn.Module",")",":","Query","downsample","module",".","key_downsample","(","nn.Module",")",":","Key","downsample","module",".","key_query_num_convs","(","int",")",":","Number","of","convs","for","key\/query","projection",".","value_out_num_convs","(","int",")",":","Number","of","convs","for","value","projection",".","key_query_norm","(","bool",")",":","Whether","to","use","BN","for","key\/query","projection",".","value_out_norm","(","bool",")",":","Whether","to","use","BN","for","value","projection",".","matmul_norm","(","bool",")",":","Whether","normalize","attention","map","with","sqrt","of","channels","with_out","(","bool",")",":","Whether","use","out","projection","."]
code: def build_project(
      self, in_channels, channels, num_convs, use_conv_module
  ):
      if use_conv_module:
          convs = [
              layers.ConvBNReLU(
                  in_channels=in_channels,
                  out_channels=channels,
                  kernel_size=1,
                  bias_attr=False,
              )
          ]
          for _ in range(num_convs - 1):
              convs.append(
                  layers.ConvBNReLU(
                      in_channels=channels,
                      out_channels=channels,
                      kernel_size=1,
                      bias_attr=False,
                  )
              )
      else:
          convs = [nn.Conv2D(in_channels, channels, 1)]
          for _ in range(num_convs - 1):
              convs.append(nn.Conv2D(channels, channels, 1))
  
      if len(convs) > 1:
          convs = nn.Sequential(*convs)
      else:
          convs = convs[0]
      return convs
  
imports: import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddleseg.models import layers
label_desc: Use image node_id 2 for calling the AttentionBlock obj's underlying member method code with example usage: obj.build_project(in_channels, channels, num_convs, use_conv_module) and returns: convs