(self, input_resolution, dim, out_dim, activation)
| 124 | |
| 125 | class PatchMerging(nn.Module): |
| 126 | def __init__(self, input_resolution, dim, out_dim, activation): |
| 127 | super().__init__() |
| 128 | |
| 129 | self.input_resolution = input_resolution |
| 130 | self.dim = dim |
| 131 | self.out_dim = out_dim |
| 132 | self.act = activation() |
| 133 | self.conv1 = Conv2d_BN(dim, out_dim, 1, 1, 0) |
| 134 | self.conv2 = Conv2d_BN(out_dim, out_dim, 3, 2, 1, groups=out_dim) |
| 135 | self.conv3 = Conv2d_BN(out_dim, out_dim, 1, 1, 0) |
| 136 | |
| 137 | def forward(self, x): |
| 138 | if x.ndim == 3: |