(self, x, return_attention=False)
| 105 | self.mlp = Mlp(in_features=dim, hidden_features=mlp_hidden_dim, act_layer=act_layer, drop=drop) |
| 106 | |
| 107 | def forward(self, x, return_attention=False): |
| 108 | y, attn = self.attn(self.norm1(x)) |
| 109 | if return_attention: |
| 110 | return attn |
| 111 | x = x + self.drop_path(y) |
| 112 | x = x + self.drop_path(self.mlp(self.norm2(x))) |
| 113 | return x |
| 114 | |
| 115 | |
| 116 | class PatchEmbed(nn.Module): |