TF 2.0 is out! Get hands-on practice at TF World, Oct 28-31. Use code TF20 for 20% off select passes. Register now

View source on GitHub

A transformation that resamples a dataset to achieve a target distribution. (deprecated)

NOTE Resampling is performed via rejection sampling; some fraction of the input values will be dropped.


  • class_func: A function mapping an element of the input dataset to a scalar tf.int32 tensor. Values should be in [0, num_classes).
  • target_dist: A floating point type tensor, shaped [num_classes].
  • initial_dist: (Optional.) A floating point type tensor, shaped [num_classes]. If not provided, the true class distribution is estimated live in a streaming fashion.
  • seed: (Optional.) Python integer seed for the resampler.


A Dataset transformation function, which can be passed to