a
    –¥»aåh  ã                   @   sp  d Z ddlmZ ddlmZmZmZmZmZ ddl	Z	ddl
Z
ddlZddlZddlZddlmZ ddlZddlZddlZddlZdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Zej dedejjgdddejjdd�¡ ej deejjgdddejjdd�¡ ej deejjgdddejjdd�¡ ej  eƒ �r4dn
e !dd¡¡ dKdd„Z"ej#dfdd „Z$ej#dd!fd"d#„Z%dd$ej#dd!fd%d&„Z&dd'ej#dfd(d)„Z'd*d+„ Z(dLd,d-„Z)dd$ej#dde(d!fd.d/„Z*dMd0d1„Z+dd$ej#ddd!e(ej,fd2d3„Z-d4d5„ Z.dd$ej#dfd6d7„Z/dd'ej#dfd8d9„Z0e 1¡ Z2ej1ej3d:�Z4ej1ej5d:�Z6ej1ej7d:�Z8ej9�r\e4gng Z:ej;�rne6gng Z<ej=�r€e8gng Z>e2ge: Z?e?e< Z@e2gd;d<„ eAe B¡ ƒD ƒ ZCd=d>„ ZDd?d@„ ZEeFeEƒ eDƒ dA�ZGeFe He2g¡e Ie2g¡dA�ZJeFe He:¡e Ie:¡dA�ZKeFe He>¡e Ie>¡dA�ZLeFe He?¡e Ie?¡dA�ZMe	jNdNdCdD„ƒZOdOdEdF„ZPdPdGdH„ZQG dIdJ„ dJejRƒZSdS )Qaq  
The Hypothesis library uses *property-based testing* to check
invariants about the code under test under a variety of random inputs.

 The key idea here is to express properties of the code under test
(e.g. that it passes a gradient check, that it implements a reference
function, etc), and then generate random instances and verify they
satisfy these properties.

The main functions of interest are exposed on `HypothesisTestCase`.
You can usually just add a short function in this to generate an
arbitrary number of test cases for your operator.

The key functions are:

- `assertDeviceChecks(devices, op, inputs, outputs)`. This asserts that the
  operator computes the same outputs, regardless of which device it is executed
  on.
- `assertGradientChecks(device, op, inputs, output_,
  outputs_with_grads)`. This implements a standard numerical gradient checker
  for the operator in question.
- `assertReferenceChecks(device, op, inputs, reference)`. This runs the
  reference function (effectively calling `reference(*inputs)`, and comparing
  that to the output of output.

`hypothesis_test_util.py` exposes some useful pre-built samplers.

- `hu.gcs` - a gradient checker device (`gc`) and device checker devices (`dc`)

- `hu.gcs_cpu_only` - a CPU-only gradient checker device (`gc`) and
  device checker devices (`dc`). Used for when your operator is only
  implemented on the CPU.
é    )Ú
caffe2_pb2)Ú	workspaceÚdevice_checkerÚgradient_checkerÚ	test_utilÚcoreNc                   C   s   t  d¡dkpt  d¡dkS )NZ
SANDCASTLEÚ1ZTW_JOB_USERÚ
sandcastle)ÚosÚgetenv© r   r   ú\/home/yuhw/wc/pochoir/venv/lib/python3.9/site-packages/caffe2/python/hypothesis_test_util.pyÚis_sandcastle8   s    r   c                   C   s
   dt jv S )NZTRAVIS)r
   Úenvironr   r   r   r   Ú	is_travis<   s    r   c                 C   s   t  dt  dt| ƒ¡¡d S )NÚfr   )ÚstructÚunpackÚpackÚfloat©Úxr   r   r   Ú
to_float32@   s    r   c                  O   s‚   d|v rt jjdkr| d¡ d|v r<t jjdk r<| d¡ d|v rrt jjdkrrd|vrh|d d |d< | d¡ t j| i |¤ŽS )NÚmin_satisfying_examples)é   é8   r   Údeadline)é   é,   r   Útimeoutg     @�@)Ú
hypothesisÚversionÚ__version_info__ÚpopÚsettings)ÚargsÚkwargsr   r   r   r$   F   s    


r$   c                  O   s†   t jjdk}d|v r"|s"| d¡ d|vrv|rvd|d< | dd ¡d urVt|d ƒ|d< | dd ¡d urvt|d ƒ|d< tj| i |¤ŽS )N)r   éC   r   Úwidthé    Ú	min_valueÚ	max_value)r    r!   r"   r#   Úgetr   ÚstÚfloats)r%   r&   Zwidth_supportedr   r   r   r.   V   s    
r.   r	   Té2   é   i'  )ZderandomizeÚsuppress_health_checkÚdatabaseÚmax_examplesr   Ú	verbosityr   Údevé
   )r1   r2   r3   r   r4   r   Údebugiè  iPÃ  ZCAFFE2_HYPOTHESIS_PROFILEé   c                 C   s   t j| |d�S )N©r*   r+   )r-   Úintegersr9   r   r   r   Údims‰   s    r;   c                 C   s¸   d }| t ju rtdddd�}n„| t ju r8tdddd�}nj| t ju rRtdddd�}nP| t ju rltjddd	�}n6| t ju r†tjdd
d	�}n| t j	u ršt 
¡ }ntdƒ‚|d u r®|S | |¡S )Ng      ð¿g      ð?é   )r*   r+   r(   r)   é@   r   iÿÿÿr9   l   ÿÿÿÿ z*Unexpected dtype without elements provided)ÚnpÚfloat16r.   Úfloat32Úfloat64Úint32r-   r:   Úint64ÚboolÚbooleansÚ
ValueErrorÚfilter)ÚdtypeZfilter_Úelemsr   r   r   Úelements_of_type�   s    






rJ   Fc                 C   s&   |d u rt |ƒ}tjjj|| ||d�S )N)ÚelementsÚunique)rJ   r    ÚextraÚnumpyÚarrays)r;   rH   rK   rL   r   r   r   rO       s    ürO   r   c                    s0   t jtf i |¤Ž| |d�}| ‡ ‡‡fdd„¡S )N©Zmin_sizeÚmax_sizec                    s   t | ˆ ˆˆd�S )N)rL   )rO   ©r;   ©rH   rK   rL   r   r   Ú<lambda>³   ó    ztensor.<locals>.<lambda>©r-   Úlistsr;   Úflatmap)Úmin_dimÚmax_dimrH   rK   rL   r&   Údims_r   rS   r   Útensor«   s    ÿr\   r=   c                 C   s   t dd||| |d�S ©Nr0   r9   )r\   )Úmin_lenÚmax_lenrH   rK   r   r   r   Útensor1d¶   s    r`   c                 C   sh   | dkr t  tjdgtjd�¡S |rDt| gtjt  ¡ d� dd„ ¡S t| gtjt jdd|  d�d�S d S )Nr   ©ÚshaperH   ©rH   rK   c                 S   s   t j| t jd�| d  S )N©rH   r   )r>   ZcumsumrB   r   r   r   r   rT   Â   rU   zsegment_ids.<locals>.<lambda>é   r9   )	r-   Újustr>   ÚemptyrB   rO   rE   Úmapr:   )ÚsizeÚ	is_sortedr   r   r   Úsegment_idsº   s    ýüýrk   c                    s®   |d u rd}|d u rˆ }|dks$J ‚||ks0J ‚ˆ dkrX|dkrXt  tjdgtjd�¡S |dkshJ dƒ‚t jt|d dƒ|d d� ‡ fdd„¡ ‡ fdd„¡ t	¡ tj
¡S )	Nr   ra   z(size is not 0, need at least one segmentr0   r9   c                    s    t jjjtj| tjdˆ d�d�S )Nr   r9   )rK   )r    rM   rN   rO   r>   rB   r-   r:   )Znum_borders©ri   r   r   rT   Û   s
    
ÿÿzlengths.<locals>.<lambda>c                    s   t  | t jdˆ gt jd�¡S )Nr   rd   )r>   ÚappendÚarrayrB   r   rl   r   r   rT   â   rU   )r-   rf   r>   rg   rB   r:   ÚmaxrX   rh   ÚsortedÚdiff)ri   Úmin_segmentsÚmax_segmentsr&   r   rl   r   ÚlengthsÊ   s(    ÿ
ý

öõõrt   c           
         s^   |rt  ¡ nt  d¡}t jtf i |¤Ž| |d�}	t  ||	¡ dd„ ¡}	|	 ‡ ‡‡‡fdd„¡S )NFrP   c                 S   s   | d rdgng | d  S )Nr   r0   r   ©Úpairr   r   r   rT   ô   rU   z"segmented_tensor.<locals>.<lambda>c                    s    t  t| ˆ ˆƒˆ| d ˆd�¡S )Nr   ©rj   )r-   ÚtuplesrO   )Z	data_dims©rH   rK   rj   Úsegment_generatorr   r   rT   õ   s   
þ)r-   rE   rf   rW   r;   rx   rh   rX   )
rY   rZ   rH   rj   rK   rz   Úallow_emptyr&   Ú	gen_emptyÚ
data_dims_r   ry   r   Úsegmented_tensoræ   s    
ÿþr~   c                 O   s"   t jt| |d�}t|d|i|¤ŽS )N)rr   rs   rz   )Ú	functoolsÚpartialrt   r~   )rr   rs   r%   r&   Úgenr   r   r   Úlengths_tensorû   s    ÿr‚   c                    s`   |rt  ¡ nt  d¡}	t jtf i |¤Ž| |d�}
t  |	|
¡ dd„ ¡}| ‡ ‡‡‡‡fdd„¡S )NFrP   c                 S   s:   t  t  | d ¡| d s.t jd| d d d�nt  d¡¡S )Nr0   r   r9   )r-   rx   rf   r:   ru   r   r   r   rT     s   ýz)sparse_segmented_tensor.<locals>.<lambda>c              
      sJ   t  t| d ˆ ˆƒt| d ˆt jd| d d d d�d�ˆ| d ˆd�¡S )Nr   r0   r9   rc   rw   )r-   rx   rO   r:   rR   ©rH   rK   rj   Úityperz   r   r   rT     s   ÿü)r-   rE   rf   rW   r;   rx   rX   )rY   rZ   rH   rj   rK   r{   rz   r„   r&   r|   r}   Z	all_dims_r   rƒ   r   Úsparse_segmented_tensor  s    ÿr…   c                  K   s   t f dti| ¤ŽS )Nrz   )r…   rt   )r&   r   r   r   Úsparse_lengths_tensor  s    r†   c                    s0   t jtf i |¤Ž||d�}| ‡ ‡‡fdd„¡S )NrP   c                    s   t jt| ˆ ˆƒˆˆd�S )NrP   )r-   rW   rO   rR   ©rH   rK   Únr   r   rT     s   
ýztensors.<locals>.<lambda>rV   )rˆ   rY   rZ   rH   rK   r&   r[   r   r‡   r   Útensors  s    ÿr‰   c              	   C   s   t | dd||||d�S r]   )r‰   )rˆ   r^   r_   rH   rK   r   r   r   Ú	tensors1d"  s    ÿrŠ   )Údevice_typec                 C   s   g | ]}t jtj|d �‘qS ))r‹   Z	device_id)r   ÚDeviceOptionr   ÚGpuDeviceType)Ú.0Úir   r   r   Ú
<listcomp>5  s   ÿr�   c                   C   s
   t  t¡S ©N)r-   rf   Údevice_optionsr   r   r   r   Údevice_checker_device_options:  s    r“   c                   C   s
   t  t¡S r‘   )r-   Úsampled_fromr’   r   r   r   r   Úgradient_checker_device_option>  s    r•   )ÚgcÚdcó   temp_wsc                 c   s0   t  ¡ }t  | d¡ d V  t  ¡  t  |¡ d S )NT)r   ZCurrentWorkspaceZSwitchWorkspaceZResetWorkspace)ÚnameZold_ws_namer   r   r   Útemp_workspaceM  s
    rš   c           
   	   C   sÄ   t  |¡}|j | ¡ t ¡ }|j |g¡ |jr8|jnd|_t	ƒ �l |pVt
 |¡d }t|j|ƒD ] \}}tj||| || ¡d� qdt |¡ t |jd|d¡}	W d   ƒ n1 s¶0    Y  |	S )NÚtestr   ©Údevice_optionr0   T)ÚcopyÚdeepcopyr�   ÚCopyFromr   ZNetDefÚopÚextendr™   rš   r   ÚInferOpBlobDevicesAsDictÚzipÚinputr   ÚFeedBlobr,   Z	CreateNetZBenchmarkNet)
r�   r¡   ÚinputsÚinput_device_optionsZ
iterationsÚnetÚ_input_device_optionsrˆ   ÚbÚretr   r   r   ÚrunOpBenchmarkV  s$    
ÿ
ý
0r­   c              	   C   sð   t  |¡}|j | ¡ tƒ �À t|jƒt|ƒkrBtd|j|f ƒ‚|pRt 	|¡d }t
|j|ƒD ] \}}tj||| || ¡d� q`t |¡ ttt|jƒƒƒ}g }|D ]"}	|j|	 }
t |
¡}| |¡ q¦|W  d   ƒ S 1 sâ0    Y  d S )Nú7must supply an input for each input on the op: %s vs %sr   rœ   )rž   rŸ   r�   r    rš   Úlenr¥   rF   r   r£   r¤   r   r¦   r,   ÚRunOperatorOnceÚlistÚrangeÚoutputÚ	FetchBlobrm   )r�   r¡   r§   r¨   rª   rˆ   r«   Úoutputs_to_checkÚoutsÚoutput_indexÚoutput_blob_namer³   r   r   r   ÚrunOpOnInputq  s4    
ÿÿÿ
ý


r¹   c                   @   s^   e Zd ZdZddd„Zdd	d
„Zddd„Zddd„Zddd„Zddd„Z	de
fdfdd„ZdS )ÚHypothesisTestCasez‰
    A unittest.TestCase subclass with some helper functions for
    utilizing the `hypothesis` (hypothesis.readthedocs.io) library.
    Nç{®Gáz„?c                 C   s(   t j||d�}|  | ||||¡¡ dS )al  
        Asserts that the operator computes the same outputs, regardless of
        which device it is executed on.

        Useful for checking the consistency of GPU and CPU
        implementations of operators.

        Usage example:

            @given(inputs=hu.tensors(n=2), in_place=st.booleans(), **hu.gcs)
            def test_sum(self, inputs, in_place, gc, dc):
                op = core.CreateOperator("Sum", ["X1", "X2"],
                                                ["Y" if not in_place else "X1"])
                X1, X2 = inputs
                self.assertDeviceChecks(dc, op, [X1, X2], [0])
        )r’   N)r   ZDeviceCheckerÚ
assertTrueÚCheckSimple)Úselfr’   r¡   r§   rµ   r¨   Ú	thresholdr—   r   r   r   ÚassertDeviceChecks—  s    þÿz%HypothesisTestCase.assertDeviceChecksç{®Gázt?çš™™™™™©?Fc              	   C   sd   t j|||t|ƒ|	d�}|j||||||	|
d�\}}}|  |j|j¡ |  |dt|j| ƒ ¡ dS )aj  
        Implements a standard numerical gradient checker for the operator
        in question.

        Useful for checking the consistency of the forward and
        backward implementations of operators.

        Usage example:

            @given(inputs=hu.tensors(n=2), in_place=st.booleans(), **hu.gcs)
            def test_sum(self, inputs, in_place, gc, dc):
                op = core.CreateOperator("Sum", ["X1", "X2"],
                                                ["Y" if not in_place else "X1"])
                X1, X2 = inputs
                self.assertGradientChecks(gc, op, [X1, X2], 0, [0])
        )Ústepsizer¿   r�   Zworkspace_namer¨   )Úgrad_opsr¨   Úensure_outputs_are_inferredz Gradient check failed for input N)r   ZGradientCheckerÚstrr½   ÚassertEqualrb   r¼   r¥   )r¾   r�   r¡   r§   rµ   Zoutputs_with_gradsrÄ   r¿   rÃ   r¨   rÅ   r–   ÚresZgradZgrad_estimatedr   r   r   ÚassertGradientChecks¸  s$    ûüþz'HypothesisTestCase.assertGradientChecksç-Cëâ6?c              	   C   s  |d }t j |g||i¡\}}	t |¡}
||
||ƒ}t |t |¡¡ t |¡ |  t|ƒt|ƒ¡ t	|j
|ƒD ] \}}|	 |¡}|s”|  |¡ qrt|t jƒr®|}d }|}n|\}}|j}t t|ƒ¡}tjj||||d |¡d� |d urrt t|jƒ¡}tjj||ddd� qrd S )NZ_gradz2Gradient {0} (x) is not matching the reference (y)©ÚatolÚrtolÚerr_msgrÊ   )rÌ   rÍ   )r   ZGradientRegistryZGetBackwardPassr   r´   r¦   ZRunOperatorsOncerÇ   r¯   r¤   r¥   r,   ZassertIsNoneÚ
isinstanceZBlobReferenceÚvaluesrÆ   r>   ÚtestingÚassert_allcloseÚformatÚindices)r¾   r¡   r§   Zref_outputsÚoutput_to_gradÚgrad_referencer¿   Zgrad_blob_namerÄ   Zgrad_mapZoutput_gradZgrad_ref_outputsrˆ   ÚrefZ
grad_namesZref_valsZref_indicesZval_nameÚvalsrÔ   r   r   r   Ú_assertGradReferenceChecksè  sD    	
ÿ


ÿû
ÿz-HypothesisTestCase._assertGradReferenceChecksc              
   C   s–  |   | p||v d |¡¡ ||vr(d S t |¡}t|ƒtju r¶|jt d¡krZtj	j
}qÂ|jt d¡krttj	j}qÂ|jt d¡krŽtj	j}qÂ|jt d¡kr¨tj	j}qÂd tj¡}ntt|ƒƒ}z€tjjt || ¡ tj¡t |j¡ tj¡d ||| |j¡d� |tj	jk�rW d S tjj|| |d	 ||| |¡d� W nN t�y� } z4t t|ƒ¡ t d
¡dk�sx|�r||‚W Y d }~n
d }~0 0 d S )NzShape for {0} was not inferredrA   r@   rB   rC   z
unknown {}zShape {} mismatch: {} vs. {})rÎ   zType {} mismatch: {} vs. {}ÚCAFFE2_ASSERT_SHAPEINFERENCEr   )r¼   rÓ   r   r´   Útyper>   ZndarrayrH   r   ZTensorProtoZDOUBLEÚFLOATZINT32ZINT64rÆ   rÑ   Úassert_array_equalrn   ZastyperB   rb   Zassert_equalÚAssertionErrorÚloggingÚwarningr
   r   )r¾   r™   ÚshapesÚtypesr³   Úensure_output_is_inferredZcorrect_typeÚer   r   r   Ú_assertInferTensorChecks  sR    þ




ýý
ÿý
z+HypothesisTestCase._assertInferTensorChecksc                 C   sˆ  t  |¡}|j |¡ tƒ ��T t|jƒt|ƒkrDtd|j|f ƒ‚|pTt 	|¡d }t
|j|ƒD ] \}}tj||| ||¡d� qbt d¡}| ¡ j |g¡ d}zt |g¡\}}d}W nJ t�y } z0t t|ƒ¡ t d¡dksî|rò|‚W Y d	}~n
d	}~0 0 t |¡ ||Ž }t|tƒ�s:t|tƒ�s:td
ƒ‚|
�sh|  t|ƒt|jƒ¡ ttt|jƒƒƒ}
g }t
|
|ƒD ]Š\}}|j| }t  |¡}|j!j"dv �r°t#j$ %||¡ n*|	d	u �r¾|}	t#j$j&|||	|d '|¡d� |�rô| j(|||||d� | )|¡ �qv|d	u�r`|d	u�sJ dƒ‚t *|¡�& | j+||||||d� W d	  ƒ n1 �sV0    Y  |W  d	  ƒ S 1 �sz0    Y  d	S )a  
        This runs the reference Python function implementation
        (effectively calling `reference(*inputs)`, and compares that
        to the output of output, with an absolute/relative tolerance
        given by the `threshold` parameter.

        Useful for checking the implementation matches the Python
        (typically NumPy) implementation of the same functionality.

        Usage example:

            @given(X=hu.tensor(), inplace=st.booleans(), **hu.gcs)
            def test_softsign(self, X, inplace, gc, dc):
                op = core.CreateOperator(
                    "Softsign", ["X"], ["X" if inplace else "Y"])

                def softsign(X):
                    return (X / (1 + np.abs(X)),)

                self.assertReferenceChecks(gc, op, [X], softsign)
        r®   r   rœ   ZopnetFTrÚ   r   NzlYou are providing a wrong reference implementation. A proper one should return a tuple/list of numpy arrays.)ÚSÚOz(Output {0} is not matching the referencerË   )rã   z=If grad_reference is set,output_to_grad has to be set as well)r¿   ),rž   rŸ   r�   r    rš   r¯   r¥   rF   r   r£   r¤   r   r¦   r,   ZNetZProtor¡   r¢   ZInferShapesAndTypesÚRuntimeErrorrß   rà   rÆ   r
   r   Ú
RunNetOncerÏ   Útupler±   rÇ   r³   r²   r´   rH   Úkindr>   rÑ   rÝ   rÒ   rÓ   rå   rm   ZDeviceScoperÙ   )r¾   r�   r¡   r§   Ú	referencer¨   r¿   rÕ   rÖ   rÌ   rµ   rÅ   rª   rˆ   r«   r©   Ztest_shape_inferencerá   râ   rä   Zreference_outputsr¶   r·   r×   r¸   r³   r   r   r   ÚassertReferenceChecksG  sŒ    #

ÿÿÿ
ý

ÿÿ


ÿýþ
ÿý&z(HypothesisTestCase.assertReferenceChecksTc              	   C   s$  |r<t tt|jƒt|jƒ ƒƒt |jƒt |jƒ ks<J dƒ‚t |¡}|j |¡ t	ƒ �¶ |pjt
 |¡d }t|j|ƒD ] \}	}
tj|	|
| |	|¡d� qx|r¨t |¡ t |¡ dd„ |jD ƒ}|rô|f i ttt|jƒt|jƒ || ƒƒ¤Ž n|||d� W d   ƒ n1 �s0    Y  d S )Nz0in-place ops are not supported in as_kwargs moder   rœ   c                 S   s   g | ]}t  |¡‘qS r   )r   r´   )rŽ   rˆ   r   r   r   r�   Ï  rU   z=HypothesisTestCase.assertValidationChecks.<locals>.<listcomp>)r§   Úoutputs)r¯   Úsetr±   r¥   r³   rž   rŸ   r�   r    rš   r   r£   r¤   r   r¦   r,   ré   r°   Údict)r¾   r�   r¡   r§   Z	validatorr¨   Z	as_kwargsZinit_netrª   rˆ   r«   rî   r   r   r   ÚassertValidationChecks²  s6    
ÿþ
ÿ
ý


ÿz)HypothesisTestCase.assertValidationChecksc           
   	   C   s¬   t  |¡}|j |¡ tƒ �| |p.t |¡d }t|j|ƒD ] \}}	t	j
||	| ||¡d� q<|d u rx|  |t	j|¡ n|  ||t	j|¡ W d   ƒ n1 sž0    Y  d S )Nr   rœ   )rž   rŸ   r�   r    rš   r   r£   r¤   r¥   r   r¦   r,   ÚassertRaisesr°   ÚassertRaisesRegex)
r¾   r�   r¡   r§   r¨   Ú	exceptionÚregexprª   rˆ   r«   r   r   r   ÚassertRunOpRaisesÖ  s"    	
ÿ
ý
ÿz$HypothesisTestCase.assertRunOpRaises)Nr»   )NrÁ   rÂ   NF)rÊ   )F)NrÊ   NNNNF)NTN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__rÀ   rÉ   rÙ   rå   rí   rñ   Ú	Exceptionrö   r   r   r   r   rº   ‘  s<     ù
(     õ
7 ù
0 ÿ
6       ô
q   ø
)ùrº   )r0   r8   )NN)NN)r˜   )Nr6   )N)Trú   Zcaffe2.protor   Zcaffe2.pythonr   r   r   r   r   Ú
contextlibrž   r   r    Zhypothesis.extra.numpyZhypothesis.strategiesZ
strategiesr-   rß   rN   r>   r
   r   r   r   r   r$   r.   Zregister_profileZHealthCheckZtoo_slowZ	VerbosityÚverboseZload_profiler   r;   r@   rJ   rO   r\   r`   rk   rt   r~   r‚   rC   r…   r†   r‰   rŠ   rŒ   Zcpu_doZCUDAZcuda_doZHIPZhip_dor�   Zgpu_doZhas_cuda_supportZ_cuda_do_listZhas_hip_supportZ_hip_do_listZhas_gpu_supportZ_gpu_do_listZ_device_options_no_hipr’   r²   ZNumGpuDevicesZexpanded_device_optionsr“   r•   rð   Zgcsr”   rf   Zgcs_cpu_onlyZgcs_cuda_onlyZgcs_gpu_onlyZ
gcs_no_hipÚcontextmanagerrš   r­   r¹   ZTestCaserº   r   r   r   r   Ú<module>   sä   &ùþ
úþ	úþ
ÿÿ
ü

ù

þ
	


þþ  û
 ü
 