o
    ci                     @   s4   d dl Zd dlmZ edddejjfddZdS )    N)	PublicAPIbeta)	stabilitytf_dataset_shardc                 C   s.   t j }t jjjj|j_| |	t jj
S )a  A utility function that overrides default config for Tensorflow Dataset.

    This should be used on a TensorFlow ``Dataset`` created by calling
    ``iter_tf_batches()`` on a ``ray.data.Dataset`` returned by
    ``ray.train.get_dataset_shard()`` since the dataset has already
    been sharded across the workers.

    Args:
        tf_dataset_shard (tf.data.Dataset): A TensorFlow Dataset.

    Returns:
        A TensorFlow Dataset with:
            - autosharding turned off
            - prefetching turned on with autotune enabled
    )tfdataOptionsexperimentalAutoShardPolicyOFFexperimental_distributeauto_shard_policywith_optionsprefetchAUTOTUNE)r   options r   Y/home/ubuntu/.local/lib/python3.10/site-packages/ray/train/tensorflow/train_loop_utils.pyprepare_dataset_shard   s   

r   )
tensorflowr   ray.util.annotationsr   r   Datasetr   r   r   r   r   <module>   s    