fn
bernoulli_op
→TensorImplPtrint bernoulli_op(const int & shape, double p, Dtype dt, Device device, Generator * gen)Python wrappers
Public Python APIs implemented by this engine symbol.Allocates a tensor of independent Bernoulli samples.
Each element is independently drawn as 1 with probability
and 0 with probability .
Math
\Pr(x_i = 1) = p, \quad \Pr(x_i = 0) = 1 - p$$ **See Also** `lucid.distributions.Bernoulli` — higher-level distribution object built on top of this op.Parameters
shapeconst Shape&Shape of the output tensor.
pdoubleSuccess probability in .
dtDtypeOutput dtype. Both floating-point (
F32/F64 storing 0.0/1.0) and integer (U8/I32 storing 0/1) are accepted.deviceDeviceMemory domain.
Bit-stream state.
Returns
TensorImplPtrNewly allocated leaf tensor (requires_grad = false).