Missed TensorFlow Dev Summit? Check out the video playlist. Watch recordings

tf.keras.backend.random_bernoulli

View source on GitHub

Returns a tensor with random bernoulli distribution of values.

tf.keras.backend.random_bernoulli(
    shape, p=0.0, dtype=None, seed=None
)

Arguments:

  • shape: A tuple of integers, the shape of tensor to create.
  • p: A float, 0. <= p <= 1, probability of bernoulli distribution.
  • dtype: String, dtype of returned tensor.
  • seed: Integer, random seed.

Returns:

A tensor.