MCPcopy Create free account
hub / github.com/cvg/NoPoSplat / __init__

Method __init__

src/model/encoder/backbone/croco/blocks.py:173–184  ·  view source on GitHub ↗
(self, dim, num_heads, mlp_ratio=4., qkv_bias=False, drop=0., attn_drop=0.,
                 drop_path=0., act_layer=nn.GELU, norm_layer=nn.LayerNorm, norm_mem=True, rope=None)

Source from the content-addressed store, hash-verified

171class DecoderBlock(nn.Module):
172
173 def __init__(self, dim, num_heads, mlp_ratio=4., qkv_bias=False, drop=0., attn_drop=0.,
174 drop_path=0., act_layer=nn.GELU, norm_layer=nn.LayerNorm, norm_mem=True, rope=None):
175 super().__init__()
176 self.norm1 = norm_layer(dim)
177 self.attn = Attention(dim, rope=rope, num_heads=num_heads, qkv_bias=qkv_bias, attn_drop=attn_drop, proj_drop=drop)
178 self.cross_attn = CrossAttention(dim, rope=rope, num_heads=num_heads, qkv_bias=qkv_bias, attn_drop=attn_drop, proj_drop=drop)
179 self.drop_path = DropPath(drop_path) if drop_path > 0. else nn.Identity()
180 self.norm2 = norm_layer(dim)
181 self.norm3 = norm_layer(dim)
182 mlp_hidden_dim = int(dim * mlp_ratio)
183 self.mlp = Mlp(in_features=dim, hidden_features=mlp_hidden_dim, act_layer=act_layer, drop=drop)
184 self.norm_y = norm_layer(dim) if norm_mem else nn.Identity()
185
186 def forward(self, x, y, xpos, ypos):
187 x = x + self.drop_path(self.attn(self.norm1(x), xpos))

Callers

nothing calls this directly

Calls 5

CrossAttentionClass · 0.85
DropPathClass · 0.85
MlpClass · 0.85
AttentionClass · 0.70
__init__Method · 0.45

Tested by

no test coverage detected