
    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 ddl	m
Z
  G d d	ej                        Z G d
 dej                        Z ej                  ej                   e        e       f      Zej                   Zej"                  Zej$                  Z  e
dg       e       y)zThis module customizes `test_combinations` for Tensorflow.

Additionally it provides `generate()`, `combine()` and `times()` with Tensorflow
customizations as a default.
    N)tf2)context)ops)test_combinations)	tf_exportc                       e Zd ZdZd Zd Zy)EagerGraphCombinationzRun the test in Graph or Eager mode.

  The optional `mode` parameter controls the test's execution mode.  Its
  accepted values are "graph" or "eager" literals.
  c                     |j                  dd       }|g S |dk(  rt        j                         gS |dk(  r6t        j                         j                         t        j                         gS t        d| d      )Nmodeeagergraphz=Argument 'mode' must be either 'eager' or 'graph'. Received: .)popr   
eager_moder   Graph
as_default
graph_mode
ValueError)selfkwargsr   s      X/home/dcms/DCMS/lib/python3.12/site-packages/tensorflow/python/framework/combinations.pycontext_managersz&EagerGraphCombination.context_managers%   s}    ::fd#D|i	  "##	iik$$&(:(:(<==fA       c                 .    t        j                  d      gS )Nr   r   OptionalParameterr   s    r   parameter_modifiersz)EagerGraphCombination.parameter_modifiers2   s    //788r   N)__name__
__module____qualname____doc__r   r    r   r   r	   r	      s     9r   r	   c                       e Zd ZdZd Zd Zy)TFVersionCombinationa*  Control the execution of the test in TF1.x and TF2.

  If TF2 is enabled then a test with TF1 test is going to be skipped and vice
  versa.

  Test targets continuously run in TF2 thanks to the tensorflow.v2 TAP target.
  A test can be run in TF2 with bazel by passing --test_env=TF2_BEHAVIOR=1.
  c                     |j                  dd       }|dk(  rt        j                         ry|dk(  rt        j                         syy)Ntf_api_version   )Fz*Skipping a TF1.x test when TF2 is enabled.   )Fz,Skipping a TF2 test when TF2 is not enabled.)TN)r   r   enabled)r   r   r'   s      r   should_execute_combinationz/TFVersionCombination.should_execute_combination@   s<    ZZ 0$7Ns{{}B	1	S[[]Dr   c                 .    t        j                  d      gS )Nr'   r   r   s    r   r   z(TFVersionCombination.parameter_modifiersH   s    //0@ABBr   N)r   r    r!   r"   r+   r   r#   r   r   r%   r%   6   s    Cr   r%   z'__internal__.test.combinations.generate)v1)r"   	functoolstensorflow.pythonr   tensorflow.python.eagerr   tensorflow.python.frameworkr   r    tensorflow.python.util.tf_exportr   TestCombinationr	   r%   partialgeneratecombinetimesNamedObjectr#   r   r   <module>r9      s     ! + + 9 69-== 90C,<< C, 9,.0D0FGI 
#
#++ ;	
3 ;H Er   