Forward function.
(self, x)
| 185 | return nn.ModuleList(fuse_layers) |
| 186 | |
| 187 | def forward(self, x): |
| 188 | """Forward function.""" |
| 189 | if self.num_branches == 1: |
| 190 | return [self.branches[0](x[0])] |
| 191 | |
| 192 | for i in range(self.num_branches): |
| 193 | x[i] = self.branches[i](x[i]) |
| 194 | |
| 195 | x_fuse = [] |
| 196 | for i in range(len(self.fuse_layers)): |
| 197 | y = 0 |
| 198 | for j in range(self.num_branches): |
| 199 | if i == j: |
| 200 | y += x[j] |
| 201 | elif j > i: |
| 202 | y = y + resize( |
| 203 | self.fuse_layers[i][j](x[j]), size=x[i].shape[2:], mode="bilinear", align_corners=False |
| 204 | ) |
| 205 | else: |
| 206 | y += self.fuse_layers[i][j](x[j]) |
| 207 | x_fuse.append(self.relu(y)) |
| 208 | return x_fuse |
| 209 | |
| 210 | |
| 211 | @BACKBONES.register_module() |