
    BVh                     ~   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Z
d	 Z G d
 dej                        Z G d dej                        Zej                  j                   d   Z ej$                  ej                  e e        e       fz         Zej&                  Zej(                  Zej*                  Zy)zHThis module customizes `test_combinations` for `tf.keras` related tests.    N)tf2)combinations)test_combinations)testing_utils)
functionalsubclass
sequentialc                     | t        j                         rdgnddg} |ddg}g }d| v r|t        j                  dg|      z  }d| v r|t        j                  dgdg      z  }|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.
  eagergraphTF)moderun_eagerly)r   enabledr   combine)r   r   results      T/home/dcms/DCMS/lib/python3.12/site-packages/tensorflow/python/keras/combinations.pykeras_mode_combinationsr      sz    " 
\G9GW+=D-K&_
l""	{KKF_
l""	wGGF	-    c                  6    t        j                  t              S )N)
model_type)r   r   KERAS_MODEL_TYPES r   r   keras_model_type_combinationsr   8   s    			):	;;r   c                       e Zd ZdZd Zd Zy)KerasModeCombinationzfCombination for Keras test mode.

  It by default includes v1_session, v2_eager and v2_tf_function.
  c                 Z    |j                  dd       }|t        j                  |      gS g S Nr   )popr   run_eagerly_scope)selfkwargsr   s      r   context_managersz%KerasModeCombination.context_managersB   s1    **]D1K--k:;;ir   c                 .    t        j                  d      gS r   r   OptionalParameterr    s    r   parameter_modifiersz(KerasModeCombination.parameter_modifiersJ   s    //>??r   N__name__
__module____qualname____doc__r"   r'   r   r   r   r   r   <   s    
@r   r   c                       e Zd ZdZd Zd Zy)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                 f    |j                  dd       }|t        v rt        j                  |      gS g S Nr   )r   r   r   model_type_scope)r    r!   r   s      r   r"   z*KerasModelTypeCombination.context_managersX   s4    L$/J&&,,Z899ir   c                 .    t        j                  d      gS r0   r$   r&   s    r   r'   z-KerasModelTypeCombination.parameter_modifiers_   s    //=>>r   Nr(   r   r   r   r.   r.   N   s    ?r   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   <module>r>      s    O  ! 4 9 1< :<@,<< @$? 1 A A ?* !!**+>?	9689:; 
#
#++r   