o
    "Õj	  ã                   @   s"   d dl mZmZ G dd„ dƒZdS )é   )Údefault_candidatesÚgbs_default_candidatesc                   @   s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	Ú	AutoTunerzá
    The AutoTuner can automatically provide running task based on user-defined settings
    and the task will be launched for execution.

    Args:
        tuner_cfg (dict): The configuration of auto tuner user defined.
    c                 C   sÜ   d| _ | dd¡| _| dddi¡d }|dkr*ddlm} t|ƒ|d< ||ƒ| _n?|d	kr@dd
lm} t|ƒ|d< ||ƒ| _n)|dkrVddlm} t	|ƒ|d< ||ƒ| _n|dkrfddlm
} ||ƒ| _ntƒ ‚g | _d S )Nr   Ú
task_limitéd   Úsearch_algoÚnameÚgrid)Ú
GridSearchÚ
candidatesZdp_estimation)ÚDpEstimationSearchZgbs)Ú	GBSSearchZ	customize)ÚCustomizeSearch)Úcur_task_idÚgetr   Úsearchr
   r   Úalgor   r   r   r   ÚNotImplementedErrorÚhistory_cfgs)ÚselfZ	tuner_cfgr   r
   r   r   r   © r   úd/var/www/html/Deteccion_Ine/venv/lib/python3.10/site-packages/paddle/distributed/auto_tuner/tuner.pyÚ__init__   s(   
zAutoTuner.__init__c                 C   s0   | j | jkrdS | j | j¡}|  j d7  _ |S )zReturn a new task config.Nr   )r   r   r   Úsearch_oncer   )r   Znew_cfgr   r   r   r   :   s
   zAutoTuner.search_oncec                 C   s   | j  |¡ dS )zAdd cfg into history cfgsN)r   Úappend)r   Úcfgr   r   r   Úadd_cfgC   s   zAutoTuner.add_cfgN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r   r      s
    	r   N)Úutilsr   r   r   r   r   r   r   Ú<module>   s   