View source on GitHub

Create a random variable for Empirical.

    *args, **kwargs

See Empirical for more details.



Original Docstring for Distribution

Initialize Empirical distributions.


  • samples: Numeric Tensor of shape [B1, ..., Bk, S, E1, ..., En],k, n >= 0. Samples or batches of samples on which the distribution is based. The firstkdimensions index into a batch of independent distributions. Length ofSdimension determines number of samples in each multiset. The lastn` dimension represents samples for each distribution. n is specified by argument event_ndims.
  • event_ndims: Python int32, default 0. number of dimensions for each event. When 0 this distribution has scalar samples. When 1 this distribution has vector-like samples.
  • 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.
  • 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.
  • name: Python str name prefixed to Ops created by this class.


  • ValueError: if the rank of samples is statically known and less than event_ndims + 1.