Skip to content
fn

bernoulli_mask_storage_shape

→Storage
int bernoulli_mask_storage_shape(double keep_prob, const int & shape, Dtype dt, Device device, Generator & gen)

Generate a Bernoulli dropout mask matching an explicit N-D shape.

Same semantics as bernoulli_mask_storage but the returned storage carries shape directly instead of a flat 1-D shape.

Parameters

keep_probdouble
Probability of keeping each element.
shapeconst Shape&
Target shape.
dtDtype
Output dtype; F32 or F64 only.
deviceDevice
Target device.
Random-number generator.

Returns

Storage

New storage of shape shape holding the mask.