MCPcopy Create free account
hub / github.com/PolymathicAI/AstroCLIP / MLP

Class MLP

downstream_tasks/property_estimation/baselines/modules.py:101–118  ·  view source on GitHub ↗

MLP model

Source from the content-addressed store, hash-verified

99
100
101class MLP(nn.Sequential):
102 """MLP model"""
103
104 def __init__(self, n_in, n_out, n_hidden=(16, 16, 16), act=None, dropout=0):
105 if act is None:
106 act = [
107 nn.LeakyReLU(),
108 ] * (len(n_hidden) + 1)
109 assert len(act) == len(n_hidden) + 1
110
111 layer = []
112 n_ = [n_in, *n_hidden, n_out]
113 for i in range(len(n_) - 2):
114 layer.append(nn.Linear(n_[i], n_[i + 1]))
115 layer.append(act[i])
116 layer.append(nn.Dropout(p=dropout))
117 layer.append(nn.Linear(n_[-2], n_[-1]))
118 super(MLP, self).__init__(*layer)
119
120
121class SpectrumEncoder(nn.Module):

Callers 2

_initialize_modelMethod · 0.70
__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected