o
    2h                     @   s   d Z ddlZddlmZ ddlmZ ddlmZ ddlmZ g dZ	ddd	Z
d
d ZG dd dejZG dd dejZejjd Zejejee e f dZejZejZejZdS )zHThis module customizes `test_combinations` for `tf.keras` related tests.    N)tf2)combinations)test_combinations)testing_utils)
functionalsubclass
sequentialc                 C   sp   | du rt  rdgnddg} |du rddg}g }d| v r'|tjdg|d7 }d| v r6|tjdgdgd7 }|S )a  Returns the default test combinations for tf.keras tests.

  Note that if tf2 is enabled, then v1 session test will be skipped.

  Args:
    mode: List of modes to run the tests. The valid options are 'graph' and
      'eager'. Default to ['graph', 'eager'] if not specified. If a empty list
      is provide, then the test will run under the context based on tf's
      version, eg graph for v1 and eager for v2.
    run_eagerly: List of `run_eagerly` value to be run with the tests.
      Default to [True, False] if not specified. Note that for `graph` mode,
      run_eagerly value will only be False.

  Returns:
    A list contains all the combinations to be used to generate test cases.
  NeagergraphTF)moderun_eagerly)r   enabledr   combine)r   r   result r   _/var/www/html/chatgem/venv/lib/python3.10/site-packages/tensorflow/python/keras/combinations.pykeras_mode_combinations   s   r   c                   C   s   t jtdS )N)
model_type)r   r   KERAS_MODEL_TYPESr   r   r   r   keras_model_type_combinations8      r   c                   @       e Zd ZdZdd Zdd ZdS )KerasModeCombinationzfCombination for Keras test mode.

  It by default includes v1_session, v2_eager and v2_tf_function.
  c                 C   s$   | dd }|d urt|gS g S Nr   )popr   run_eagerly_scope)selfkwargsr   r   r   r   context_managersB   s   z%KerasModeCombination.context_managersc                 C      t dgS r   r   OptionalParameterr   r   r   r   parameter_modifiersJ   r   z(KerasModeCombination.parameter_modifiersN__name__
__module____qualname____doc__r   r#   r   r   r   r   r   <   s    r   c                   @   r   )KerasModelTypeCombinationaK  Combination for Keras model types when doing model test.

  It by default includes 'functional', 'subclass', 'sequential'.

  Various methods in `testing_utils` to get models will auto-generate a model
  of the currently active Keras model type. This allows unittests to confirm
  the equivalence between different Keras models.
  c                 C   s$   | dd }|tv rt|gS g S Nr   )r   r   r   model_type_scope)r   r   r   r   r   r   r   X   s   z*KerasModelTypeCombination.context_managersc                 C   r   r*   r    r"   r   r   r   r#   _   r   z-KerasModelTypeCombination.parameter_modifiersNr$   r   r   r   r   r)   N   s    	r)   r   )NN)r(   	functoolstensorflow.pythonr   tensorflow.python.frameworkr   r   tensorflow.python.kerasr   r   r   r   TestCombinationr   r)   generatekeywords	_defaultspartialr   timesNamedObjectr   r   r   r   <module>   s*   


