MCPcopy Create free account
hub / github.com/OpenDriveLab/ReSim / forward

Method forward

SwissArmyTransformer/examples/yolos/models/backbone.py:69–78  ·  view source on GitHub ↗
(self, x, return_attention=False)

Source from the content-addressed store, hash-verified

67 self.mlp = Mlp(in_features=dim, hidden_features=mlp_hidden_dim, act_layer=act_layer, drop=drop)
68
69 def forward(self, x, return_attention=False):
70 if return_attention:
71 y, attn = self.attn(self.norm1(x), return_attention=return_attention)
72 x = x + self.drop_path(y)
73 x = x + self.drop_path(self.mlp(self.norm2(x)))
74 return x, attn
75 else:
76 x = x + self.drop_path(self.attn(self.norm1(x)))
77 x = x + self.drop_path(self.mlp(self.norm2(x)))
78 return x
79
80
81class PatchEmbed(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected