
    i                        % S SK Jr  S SKJrJrJrJrJr  S SKrS SK	J
r
  S SKJr   \\R                  \\\4   r\\S'    \\   r\\S'    \\R                     r\\S'    \\\\4   r\\S	'    " S
 S5      r\ " S S5      5       rg)    )	dataclass)get_argsListOptionalSequenceUnionN)tree_flatten)	TypeAliasConfigValueMethodInputTypeMethodOutputTypeDataContainerc                   R    \ rS rSrSr SS\S\\   SS4S jjrS\	S\
\   4S	 jrS
rg)MethodTestCase1   zTest case with inputs and expected outputs
The expected_outputs are optional and only required if the user wants to verify model outputs after execution.
Ninputsexpected_outputsreturnc                 r    U R                  U5      U l        / U l        Ub  U R                  U5      U l        gg)a  Single test case for verifying specific method

Args:
    inputs: All inputs required by eager_model with specific inference method for one-time execution.

            It is worth mentioning that, although both bundled program and ET runtime apis support setting input
            other than `torch.tensor` type, only the input in `torch.tensor` type will be actually updated in
            the method, and the rest of the inputs will just do a sanity check if they match the default value in method.

    expected_outputs: Expected output of given input for verification. It can be None if user only wants to use the test case for profiling.

Returns:
    self
N)_flatten_and_sanity_checkr   r   )selfr   r   s      i/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/executorch/devtools/bundled_program/config.py__init__MethodTestCase.__init__6   s=    * *.)G)G)O35'$($B$BCS$TD! (    unflatten_datac                    [        U5      u  p#U Hq  n[        U[        [        5      5      (       d    SR	                  U[        U5      5      5       e[        U[        S5      5      (       d  M]   SR	                  U5      5       e   U$ )zFlat the given data and check its legality

Args:
    unflatten_data: Data needs to be flatten.

Returns:
    flatten_data: Flatten data with legal type.
z4The type of input {} with type {} is not supported.
Nz)The input {} should not be in null type.
)r	   
isinstancer   r   formattype)r   r   flatten_data_datas        r   r   (MethodTestCase._flatten_and_sanity_checkQ   s     '~6 D%   GMMd4j  "T
  I <BB4HI  ! r   )r   r   )N)__name__
__module____qualname____firstlineno____doc__r   r   r   r   r   r   r   r   __static_attributes__ r   r   r   r   1   sQ     8<UU ##34U 
	U6+	k	r   r   c                   4    \ rS rSr% Sr\\S'   \\   \S'   Sr	g)MethodTestSuiten   zAll test info related to verify method

Attributes:
    method_name: Name of the method to be verified.
    test_cases: All test cases for verifying the method.
method_name
test_casesr+   N)
r%   r&   r'   r(   r)   str__annotations__r   r   r*   r+   r   r   r-   r-   n   s     ((r   r-   )dataclassesr   typingr   r   r   r   r   torchtorch.utils._pytreer	   typing_extensionsr
   Tensorintboolfloatr   r2   r   r   listtupledictr   r   r-   r+   r   r   <module>r?      s    " < <  , ' 	LL	Y  &k2 2 'u||4 ) 4 !ud!23y 3: :z 	) 	) 	)r   