MCPcopy Create free account
hub / github.com/Mattdl/ContinualPrototypeEvolution / Xavier

Function Xavier

model/common.py:12–19  ·  view source on GitHub ↗
(m)

Source from the content-addressed store, hash-verified

10
11
12def Xavier(m):
13 if m.__class__.__name__ == 'Linear':
14 fan_in, fan_out = m.weight.data.size(1), m.weight.data.size(0)
15 std = 1.0 * math.sqrt(2.0 / (fan_in + fan_out))
16 a = math.sqrt(3.0) * std
17 m.weight.data.uniform_(-a, a)
18 if m.bias is not None:
19 m.bias.data.fill_(0.0)
20
21
22class MLP(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected