MCPcopy Create free account
hub / github.com/computational-imaging/bacon / __init__

Method __init__

experiments/plot_activation_distributions.py:30–47  ·  view source on GitHub ↗
(
        self, hidden_size, out_size, n_layers, weight_scale, bias=True, output_act=False
    )

Source from the content-addressed store, hash-verified

28 """
29
30 def __init__(
31 self, hidden_size, out_size, n_layers, weight_scale, bias=True, output_act=False
32 ):
33 super().__init__()
34
35 self.linear = nn.ModuleList(
36 [nn.Linear(hidden_size, hidden_size, bias) for _ in range(n_layers)]
37 )
38 self.output_linear = nn.Linear(hidden_size, out_size)
39 self.output_act = output_act
40
41 for lin in self.linear:
42 lin.weight.data.uniform_(
43 -np.sqrt(weight_scale / hidden_size),
44 np.sqrt(weight_scale / hidden_size),
45 )
46
47 return
48
49 def forward(self, x):
50 out = self.filters[0](x)

Callers 2

__init__Method · 0.45
__init__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected