code: def rademacher(shape, dtype=tf.float32, seed=None, name=None):
      """Generates `Tensor` consisting of `-1` or `+1`, chosen uniformly at random.
  
      For more details, see [Rademacher distribution](
      https://en.wikipedia.org/wiki/Rademacher_distribution).
  
      Args:
        shape: Vector-shaped, `int` `Tensor` representing shape of output.
        dtype: (Optional) TF `dtype` representing `dtype` of output.
        seed: PRNG seed; see `tfp.random.sanitize_seed` for details.
        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.
      """
      with tf.name_scope(name or "rademacher"):
          # Choose the dtype to cause `2 * random_bernoulli - 1` to run in the same
          # memory (host or device) as the downstream cast will want to put it.  The
          # convention on GPU is that int32 are in host memory and int64 are in device
          # memory.
          shape = ps.convert_to_shape_tensor(shape)
          generation_dtype = (
              tf.int64 if tf.as_dtype(dtype) != tf.int32 else tf.int32
          )
          random_bernoulli = samplers.uniform(
              shape,
              minval=0,
              maxval=2,
              dtype=generation_dtype,
              seed=seed,
          )
          return tf.cast(2 * random_bernoulli - 1, dtype)
  
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import samplers
label_desc: Use image node_id 1 for calling a global function with example usage: rademacher(shape, dtype, seed, name) and returns: tf