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


View source on GitHub

Create a random variable for Zipf.

    *args, **kwargs

See Zipf for more details.



Original Docstring for Distribution

Initialize a batch of Zipf distributions.


  • power: Float like Tensor representing the power parameter. Must be strictly greater than 1.
  • dtype: The dtype of Tensor returned by sample. Default value: tf.int32.
  • interpolate_nondiscrete: Python bool. When False, log_prob returns -inf (and prob returns 0) for non-integer inputs. When True, log_prob evaluates the continuous function -power log(k) - log(zeta(power)) , which matches the Zipf pmf at integer arguments k (note that this function is not itself a normalized probability log-density). Default value: True.
  • sample_maximum_iterations: Maximum number of iterations of allowable iterations in sample. When validate_args=True, samples which fail to reach convergence (subject to this cap) are masked out with self.dtype.min or nan depending on self.dtype.is_integer. Default value: 100.
  • validate_args: Python bool, default False. When True distribution parameters are checked for validity despite possibly degrading runtime performance. When False invalid inputs may silently render incorrect outputs. Default value: False.
  • allow_nan_stats: Python bool, default True. When True, statistics (e.g., mean, mode, variance) use the value "NaN" to indicate the result is undefined. When False, an exception is raised if one or more of the statistic's batch members are undefined. Default value: False.
  • name: Python str name prefixed to Ops created by this class. Default value: 'Zipf'.


  • TypeError: if power is not float like.