MCPcopy Create free account
hub / github.com/lingeringlight/START / VSSBlock

Class VSSBlock

models/vmamba.py:580–610  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

578
579
580class 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
613class VSSLayer(nn.Module):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…