(self, x: torch.Tensor, **kwargs)
| 550 | return out_y[:, 0], inv_y[:, 0], wh_y, invwh_y |
| 551 | |
| 552 | def forward(self, x: torch.Tensor, **kwargs): |
| 553 | B, H, W, C = x.shape |
| 554 | |
| 555 | xz = self.in_proj(x) |
| 556 | x, z = xz.chunk(2, dim=-1) # (b, h, w, d) |
| 557 | |
| 558 | x = x.permute(0, 3, 1, 2).contiguous() |
| 559 | x = self.act(self.conv2d(x)) # (b, d, h, w) |
| 560 | |
| 561 | y_return = self.forward_core(x) |
| 562 | |
| 563 | assert y_return[0].dtype == torch.float32 |
| 564 | y = torch.sum(torch.stack(y_return, dim=0), dim=0, keepdim=False) # BxCxL |
| 565 | |
| 566 | # y1, y2, y3, y4 = self.forward_core(x) |
| 567 | # assert y1.dtype == torch.float32 |
| 568 | # y = y1 + y2 + y3 + y4 |
| 569 | |
| 570 | y = torch.transpose(y, dim0=1, dim1=2).contiguous().view(B, H, W, -1) |
| 571 | y = self.out_norm(y) |
| 572 | y = y * F.silu(z) |
| 573 | out = self.out_proj(y) |
| 574 | if self.dropout is not None: |
| 575 | out = self.dropout(out) |
| 576 | |
| 577 | return out |
| 578 | |
| 579 | |
| 580 | class VSSBlock(nn.Module): |
nothing calls this directly
no outgoing calls
no test coverage detected