| 578 | |
| 579 | |
| 580 | class VSSBlock(nn.Module): |
| 581 | def __init__( |
| 582 | self, |
| 583 | hidden_dim: int = 0, |
| 584 | drop_path: float = 0, |
| 585 | norm_layer: Callable[..., torch.nn.Module] = partial(nn.LayerNorm, eps=1e-6), |
| 586 | attn_drop_rate: float = 0, |
| 587 | d_state: int = 16, |
| 588 | spatial_aug_flag: int = 0, |
| 589 | START_flag=1, |
| 590 | START_p=1.0, |
| 591 | START_token_prob=0.75, |
| 592 | START_batch_prob=0.5, |
| 593 | START_attention_mode=0, |
| 594 | **kwargs, |
| 595 | ): |
| 596 | super().__init__() |
| 597 | self.ln_1 = norm_layer(hidden_dim) |
| 598 | self.self_attention = SS2D(d_model=hidden_dim, dropout=attn_drop_rate, d_state=d_state, |
| 599 | spatial_aug_flag=spatial_aug_flag, |
| 600 | START_flag=START_flag, |
| 601 | START_p=START_p, |
| 602 | START_token_prob=START_token_prob, |
| 603 | START_batch_prob=START_batch_prob, |
| 604 | START_attention_mode=START_attention_mode, |
| 605 | **kwargs) |
| 606 | self.drop_path = DropPath(drop_path) |
| 607 | |
| 608 | def forward(self, input: torch.Tensor): |
| 609 | x = input + self.drop_path(self.self_attention(self.ln_1(input))) |
| 610 | return x |
| 611 | |
| 612 | |
| 613 | class VSSLayer(nn.Module): |
no outgoing calls
no test coverage detected
searching dependent graphs…