MCPcopy Create free account
hub / github.com/alinlab/SelfPatch / forward

Method forward

selfpatch_vision_transformer.py:235–241  ·  view source on GitHub ↗
(self, x, return_attention=False)

Source from the content-addressed store, hash-verified

233 self.mlp = Mlp(in_features=dim, hidden_features=mlp_hidden_dim, act_layer=act_layer, drop=drop)
234
235 def forward(self, x, return_attention=False):
236 y, attn = self.attn(self.norm1(x))
237 if return_attention:
238 return attn
239 x = x + self.drop_path(y)
240 x = x + self.drop_path(self.mlp(self.norm2(x)))
241 return x
242
243
244class PatchEmbed(nn.Module):

Callers

nothing calls this directly

Calls 2

norm1Method · 0.45
norm2Method · 0.45

Tested by

no test coverage detected