[null,null,["Last updated 2020-10-01 UTC."],[],[],null,["# tf.data.experimental.rejection_resample\n\n\u003cbr /\u003e\n\n|----------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|\n| [TensorFlow 2 version](/api_docs/python/tf/data/experimental/rejection_resample) | [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/data/experimental/ops/resampling.py#L37-L101) |\n\nA transformation that resamples a dataset to achieve a target distribution.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.data.experimental.rejection_resample`](/api_docs/python/tf/data/experimental/rejection_resample), \\`tf.compat.v2.data.experimental.rejection_resample\\`\n\n\u003cbr /\u003e\n\n tf.data.experimental.rejection_resample(\n class_func, target_dist, initial_dist=None, seed=None\n )\n\n| **Note:** Resampling is performed via rejection sampling; some fraction of the input values will be dropped.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `class_func` | A function mapping an element of the input dataset to a scalar [`tf.int32`](../../../tf#int32) tensor. Values should be in `[0, num_classes)`. |\n| `target_dist` | A floating point type tensor, shaped `[num_classes]`. |\n| `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. |\n| `seed` | (Optional.) Python integer seed for the resampler. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A `Dataset` transformation function, which can be passed to [`tf.data.Dataset.apply`](../../../tf/data/Dataset#apply). ||\n\n\u003cbr /\u003e"]]