code: def __init__(self, n_r, d_in, d_middle=None, d_out=None):
      super(WeightAggregate, self).__init__()
      if not d_middle:
          d_middle = d_in
      if not d_out:
          d_out = d_in
  
      self.n_r = n_r
      self.d_out = d_out
      self.act = nn.Swish()
  
      self.conv_n = nn.Sequential(
          ("conv1", nn.Conv2D(d_in, d_in, 3, 1, 1, bias_attr=False)),
          ("bn1", nn.BatchNorm(d_in)),
          ("act1", self.act),
          ("conv2", nn.Conv2D(d_in, n_r, 1, bias_attr=False)),
          ("bn2", nn.BatchNorm(n_r)),
          ("act2", nn.Sigmoid()),
      )
      self.conv_d = nn.Sequential(
          (
              "conv1",
              nn.Conv2D(d_in, d_middle, 3, 1, 1, bias_attr=False),
          ),
          ("bn1", nn.BatchNorm(d_middle)),
          ("act1", self.act),
          ("conv2", nn.Conv2D(d_middle, d_out, 1, bias_attr=False)),
          ("bn2", nn.BatchNorm(d_out)),
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import paddle
  from paddle import nn
  import paddle.nn.functional
label_desc: Use image node_id 1 to create a new WeightAggregate object from inherited base classes: nn with example: obj = WeightAggregate(n_r, d_in, d_middle, d_out)