code: def gumbel_sample(shape):
    
    uniform_samples = tf.random_uniform(shape, minval=0.00001, maxval=0.99998)
    return -tf.log(-tf.log(uniform_samples))
docs: Sample from the Gumbel distribution, protect from overflows.
  
    Args:
      shape: Shape of Gumbel samples.
  
    Returns:
      Noise drawn from Gumbel distribution.