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

Function xavier

python/singa/initializer.py:209–218  ·  view source on GitHub ↗

Initialize the matrix parameter follow a Uniform distribution from [-sqrt(6/(fan_in + fan_out)), sqrt(6/(fan_in + fan_out))]. Args: t (Tensor): the parater tensor

(t)

Source from the content-addressed store, hash-verified

207
208@deprecated(reason="Use glorot_normal")
209def xavier(t):
210 '''Initialize the matrix parameter follow a Uniform distribution from
211 [-sqrt(6/(fan_in + fan_out)), sqrt(6/(fan_in + fan_out))].
212
213 Args:
214 t (Tensor): the parater tensor
215 '''
216
217 scale = math.sqrt(6.0 / (t.shape[0] + t.shape[1]))
218 t.uniform(-scale, scale)
219
220
221@deprecated(reason="Use glorot_uniform")

Callers

nothing calls this directly

Calls 1

uniformMethod · 0.45

Tested by

no test coverage detected