MCPcopy Create free account
hub / github.com/PABannier/sam3.cpp / Mlp

Class Mlp

tests/dump_vit_reference.py:110–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108 from timm.layers import Mlp
109except ImportError:
110 class Mlp(nn.Module):
111 def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.):
112 super().__init__()
113 out_features = out_features or in_features
114 hidden_features = hidden_features or in_features
115 self.fc1 = nn.Linear(in_features, hidden_features)
116 self.act = act_layer()
117 self.fc2 = nn.Linear(hidden_features, out_features)
118 def forward(self, x):
119 return self.fc2(self.act(self.fc1(x)))
120
121
122def save_tensor(path, t):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected