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

tfp.experimental.substrates.numpy.math.random_rademacher

View source on GitHub

Generates Tensor consisting of -1 or +1, chosen uniformly at random.

tfp.experimental.substrates.numpy.math.random_rademacher(
    shape, dtype=tf.float32, seed=None, name=None
)

For more details, see Rademacher distribution.

Args:

  • shape: Vector-shaped, int Tensor representing shape of output.
  • dtype: (Optional) TF dtype representing dtype of output.
  • seed: (Optional) Python integer to seed the random number generator.
  • name: Python str name prefixed to Ops created by this function. Default value: None (i.e., 'random_rademacher').

Returns:

  • rademacher: Tensor with specified shape and dtype consisting of -1 or +1 chosen uniformly-at-random.