B
    ٻd8                 @   s>   d Z ddlmZ ddlmZ eddedd	ddZdS )
z#Resampling dataset transformations.    )deprecation)	tf_exportNz.Use `tf.data.Dataset.rejection_resample(...)`.z$data.experimental.rejection_resamplec                s    fdd}|S )a  A transformation that resamples a dataset to achieve a target distribution.

  **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.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.

  Returns:
    A `Dataset` transformation function, which can be passed to
    `tf.data.Dataset.apply`.
  c                s   | j  dS )zEFunction from `Dataset` to `Dataset` that applies the transformation.)
class_functarget_distinitial_distseed)rejection_resample)Zdataset)r   r   r   r    d/var/www/html/venv/lib/python3.7/site-packages/tensorflow/python/data/experimental/ops/resampling.py	_apply_fn)   s
    z%rejection_resample.<locals>._apply_fnr	   )r   r   r   r   r   r	   )r   r   r   r   r
   r      s    	r   )NN)__doc__Ztensorflow.python.utilr   Z tensorflow.python.util.tf_exportr   
deprecatedr   r	   r	   r	   r
   <module>   s
   
