Function marian::inits::glorotNormal

Function Documentation

Ptr<NodeInitializer> marian::inits::glorotNormal(bool fanIn = false, bool fanOut = false, float scale = 1.f)

Initialize tensor with random numbers from Glorot Normal distribution.

Similar to function glorotUniform(), this function adopts Normal distribution instead of uniform distribution. This function offers three variants (modes). The values of the tensor is sampled from Normal(-x*scale, x*scale):

  • when fanIn=false and fanOut=false (by default): x = sqrt(2 / (in + out))

  • when fanIn=true and fanOut=false (fanIn mode): x = sqrt(1 / in)

  • when fanIn=false and fanOut=false (fanOut mode): x = sqrt(1 / out) where in is the number of input units in the tensor, out is the number of output units. scale is used to change the range of Normal distribution.


    A NodeInitializer