(key, mean=np.float32(0.5), shape=None)
return uniform(key, shape) < mean
Sample Bernoulli random values with given shape and mean.

  Args:
    key: the RNG key.
    mean: optional, an array_like broadcastable to `shape` for the mean of the
      random variables (default 0.5).
    shape: optional, a tuple of nonnegative integers representing the shape
      (default to `mean`'s shape).

  Returns:
    A random array with the specified shape and boolean dtype.
Sample Bernoulli random values with given shape and mean.
Sample Bernoulli random values with given shape and mean .
def bernoulli(key, mean=np.float32(0.5), shape=None):
  """Sample Bernoulli random values with given shape and mean.

  Args:
    key: the RNG key.
    mean: optional, an array_like broadcastable to `shape` for the mean of the
      random variables (default 0.5).
    shape: optional, a tuple of nonnegative integers representing the shape
      (default to `mean`'s shape).

  Returns:
    A random array with the specified shape and boolean dtype.
  """
  mean = tf_np.asarray(mean)
  if shape is None:
    shape = mean.shape
  return uniform(key, shape) < mean
def bernoulli ( key , mean = np . float32 ( 0.5 ) , shape = None ) : mean = tf_np . asarray ( mean ) if shape is None : shape = mean . shape return uniform ( key , shape ) < mean