o
    i	                     @   s<   d Z ddlmZ ddlmZ edgd			d
dd	ZdS )zBasic loop for training.    )errors)	tf_exportztrain.basic_train_loop)v1N c                 C   s   |du rg }|du ri }d}|rMz,d}|  |}|  s,||g|R i | |  rW d   n1 s6w   Y  W n tjyH   d}Y nw |sdS dS )a(  Basic loop to train a model.

  Calls `train_step_fn` in a loop to train a model.  The function is called as:

  ```python
  train_step_fn(session, *args, **kwargs)
  ```

  It is passed a `tf.compat.v1.Session` in addition to `args` and `kwargs`.  The
  function
  typically runs one training step in the session.

  Args:
    supervisor: `tf.compat.v1.train.Supervisor` to run the training services.
    train_step_fn: Callable to execute one training step.  Called repeatedly as
      `train_step_fn(session, *args **kwargs)`.
    args: Optional positional arguments passed to `train_step_fn`.
    kwargs: Optional keyword arguments passed to `train_step_fn`.
    master: Master to use to create the training session.  Defaults to `""`
      which causes the session to be created in the local process.
  NTF)managed_sessionshould_stopr   AbortedError)
supervisortrain_step_fnargskwargsmastershould_retrysess r   \/mnt/sdb/aimis/docanh/lib/python3.10/site-packages/tensorflow/python/training/basic_loops.pybasic_train_loop   s&   r   )NNr   )__doc__tensorflow.python.frameworkr    tensorflow.python.util.tf_exportr   r   r   r   r   r   <module>   s   
