On this page
tf.data.experimental.rejection_resample
A transformation that resamples a dataset to achieve a target distribution.
tf.data.experimental.rejection_resample(
    class_func, target_dist, initial_dist=None, seed=None
)
Note: Resampling is performed via rejection sampling; some fraction of the input values will be dropped.
| Args | |
|---|---|
| class_func | A function mapping an element of the input dataset to a scalar tf.int32tensor. 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. | 
| Returns | |
|---|---|
| A Datasettransformation function, which can be passed totf.data.Dataset.apply. | 
© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
 https://www.tensorflow.org/versions/r2.4/api_docs/python/tf/data/experimental/rejection_resample