mirror of
https://github.com/explosion/spaCy.git
synced 2025-02-04 21:50:35 +03:00
* Use He initialization trick
This commit is contained in:
parent
894cbef8ba
commit
ca30fe1582
|
@ -77,14 +77,12 @@ def relu(x):
|
||||||
|
|
||||||
def _init_weights(n_in, n_out):
|
def _init_weights(n_in, n_out):
|
||||||
rng = numpy.random.RandomState(1234)
|
rng = numpy.random.RandomState(1234)
|
||||||
|
|
||||||
weights = numpy.asarray(
|
weights = numpy.asarray(
|
||||||
numpy.random.normal(
|
rng.standard_normal(size=(n_in, n_out)) * numpy.sqrt(2.0 / n_in),
|
||||||
loc=0.0,
|
|
||||||
scale=0.0001,
|
|
||||||
size=(n_in, n_out)),
|
|
||||||
dtype=theano.config.floatX
|
dtype=theano.config.floatX
|
||||||
)
|
)
|
||||||
bias = 0.2 * numpy.ones((n_out,), dtype=theano.config.floatX)
|
bias = numpy.zeros((n_out,), dtype=theano.config.floatX)
|
||||||
return [AvgParam(weights, name='W'), AvgParam(bias, name='b')]
|
return [AvgParam(weights, name='W'), AvgParam(bias, name='b')]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user