(self, x1, x2, x3, x4, sizes: List[Tuple[int, int]])
| 290 | return out |
| 291 | |
| 292 | def forward(self, x1, x2, x3, x4, sizes: List[Tuple[int, int]]): |
| 293 | _, S2, S3, S4 = sizes |
| 294 | cur2 = self.norm12(x2) |
| 295 | cur3 = self.norm13(x3) |
| 296 | cur4 = self.norm14(x4) |
| 297 | cur2 = self.factoratt_crpe2(cur2, size=S2) |
| 298 | cur3 = self.factoratt_crpe3(cur3, size=S3) |
| 299 | cur4 = self.factoratt_crpe4(cur4, size=S4) |
| 300 | upsample3_2 = self.upsample(cur3, factor=2., size=S3) |
| 301 | upsample4_3 = self.upsample(cur4, factor=2., size=S4) |
| 302 | upsample4_2 = self.upsample(cur4, factor=4., size=S4) |
| 303 | downsample2_3 = self.downsample(cur2, factor=2., size=S2) |
| 304 | downsample3_4 = self.downsample(cur3, factor=2., size=S3) |
| 305 | downsample2_4 = self.downsample(cur2, factor=4., size=S2) |
| 306 | cur2 = cur2 + upsample3_2 + upsample4_2 |
| 307 | cur3 = cur3 + upsample4_3 + downsample2_3 |
| 308 | cur4 = cur4 + downsample3_4 + downsample2_4 |
| 309 | x2 = x2 + self.drop_path(cur2) |
| 310 | x3 = x3 + self.drop_path(cur3) |
| 311 | x4 = x4 + self.drop_path(cur4) |
| 312 | |
| 313 | # MLP. |
| 314 | cur2 = self.norm22(x2) |
| 315 | cur3 = self.norm23(x3) |
| 316 | cur4 = self.norm24(x4) |
| 317 | cur2 = self.mlp2(cur2) |
| 318 | cur3 = self.mlp3(cur3) |
| 319 | cur4 = self.mlp4(cur4) |
| 320 | x2 = x2 + self.drop_path(cur2) |
| 321 | x3 = x3 + self.drop_path(cur3) |
| 322 | x4 = x4 + self.drop_path(cur4) |
| 323 | |
| 324 | return x1, x2, x3, x4 |
| 325 | |
| 326 | |
| 327 | class CoaT(nn.Module): |
nothing calls this directly
no test coverage detected