Function marian::inits::bernoulli¶
Defined in File node_initializers.cpp
Function Documentation¶
-
Ptr<NodeInitializer>
marian::inits
::
bernoulli
(float p, float scale = 1.f, float shift = 0.f)¶ Initialize tensor with random numbers from Bernoulli Distribution.
The Bernoulli distribution is the discrete probability distribution of a random variable which takes value
1
with probability p, and value0
with probability (1-p). By default this function generates a tensor of 0 and 1 with probability p if bernoulli(p) is called. We offerscale
andshift
parameters which can map {0,1} to {0,1}*scale
+shift
. E.g., bernoulli(tensor, 0.5f, 2.f, -1.f) where p=0.5f, scale=2.f, shift=-1.f. {0,1} is mapped to {0,1}*2+(-1)= {-1,1}. It generates a tensor composed of 50% of 1 and 50% of -1.- Return