MCPcopy Create free account
hub / github.com/apache/singa / compute_fan

Method compute_fan

test/python/test_initializer.py:35–45  ·  view source on GitHub ↗
(self, shape)

Source from the content-addressed store, hash-verified

33 self.t3 = tensor.Tensor((30, 50, 4, 8))
34
35 def compute_fan(self, shape):
36 if len(shape) == 2:
37 fan_in = shape[0]
38 fan_out = shape[1]
39 elif len(shape) in {3, 4, 5}:
40 fan_in = shape[1] * np.prod(shape[2:])
41 fan_out = shape[0] * np.prod(shape[2:])
42 else:
43 fan_in = fan_out = np.sqrt(np.prod(shape))
44
45 return fan_in, fan_out
46
47 def he_uniform(self, dev):
48

Callers 1

initMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected