
    rh               
          d dl Z d dlmZ d dlmZ d dlZddlmZ ddlm	Z	m
Z
 ej                  j                  j                         r;	 	 ddee
   dee   d	eee      d
ee
   fdZdee
   d
ee
   fdZdee
   d
ee
   fdZyy)    N)Sequence)Optional   )MACOS_VERSION)DecorateInfoOpInfoopsdevice_typexfail_exclusionreturnc                    |g }h d}h d}t         j                  gt         j                  t         j                  t         j                  t         j
                  t         j                  t         j                  gt         j                  t         j                  t         j                  t         j                  gt         j                  t         j                  t         j                  t         j                  gt         j
                  gt         j
                  gt         j
                  gt         j
                  gt         j
                  gt         j
                  gt         j                  t         j                  gt         j                  t         j                  gt         j                  t         j                  gd}dt         j                  t         j                  t         j                  gi}t         j                  t         j                  t         j                  t         j                  t         j                  gt         j                  t         j                  t         j                  t         j                  t         j                  gd}dt         j                  gi}i dd dd d	d d
d dd dd dd dd dd dd dd dd dd dd dd dd dd i dd dd dd dd dd dd dd dd d d d!d d"d d#d d$d d%d d&d d'd d(t         j                  gi d)t         j                  gd*t         j                  gd+d d,d d-d d.d d/d d0d d1d d2d d3d d4d d5d d6d d7d d8d d9d i d:t         j                  gd;d d<d d=d d>d d?d d@d dAd dBd dCd dDd dEd dFd dGd dHd dId dJd i dKd dLd dMt        dNk  r t         j                  t         j
                  gnt         j
                  gdOt        dNk  r t         j                  t         j
                  gnt         j
                  gdPd dQd dRd dSd dTd dUd dVd dWd dXd dYd dZd d[d d\d i d]d d^d d_d d`d dad dbd dcd ddd ded dfd dgd dht         j                  gdit         j                  gdjd dkd dld dmd i dnd dod dpd dqd drd dsd dtd dud dvd dwd dxd dyt         j
                  gdzt         j
                  gd{t         j
                  gd|t         j
                  gd}t         j
                  t         j                  gd~t         j
                  t         j                  t         j                  gt        dk  rt         j
                  gng t         j                  t         j                  gt         j
                  gt         j                  t         j                  t         j
                  t         j                  t         j                  gt         j                  t         j                  t         j
                  t         j                  t         j                  gt         j                  t         j                  t         j
                  t         j                  t         j                  gt         j                  t         j                  t         j
                  t         j                  t         j                  gt         j                  t         j                  t         j
                  t         j                  t         j                  gt         j                  t         j                  t         j
                  t         j                  t         j                  gt        dk  rt         j
                  gng t        dk  rt         j
                  gng t         j                  t         j                  t         j
                  t         j                  t         j                  gt         j                  t         j                  gt         j                  gt         j                  t         j                  t         j                  t         j
                  gd}	t        dk  r|	j                  i dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd dd d d d t         j
                  t         j                  t         j                  t         j                  t         j                  gt         j                  gd       t        dNk  r|	j                  d d d       i dt         j                  t         j                  t         j
                  t         j                  t         j                  gdt         j                  t         j                  t         j                  gdt         j                  t         j                  t         j                  gdt         j                  t         j                  t         j                  gdd dd dd dd dt         j                  t         j                  t         j                  gdt         j                  t         j                  t         j                  gdt         j                  t         j                  t         j                  gdt         j                  t         j                  t         j                  gdt         j                  t         j                  t         j                  gdt         j                  t         j                  t         j                  gdt         j                  t         j                  t         j                  gdt         j                  t         j                  t         j                  gdt         j                  t         j                  t         j                  gt         j                  t         j                  t         j                  gt         j                  t         j                  t         j                  gt         j                  t         j                  t         j                  t         j
                  gt         j                  t         j                  t         j                  t         j
                  gt         j                  t         j                  t         j                  gt         j                  t         j                  t         j                  gt         j                  t         j                  t         j                  t         j
                  t         j                  t         j                  gd t         j                  t         j                  t         j                  gd	}
d t         j                  gd}d d d d d d d}d{d i}dt        dt        dd ffd}| D ]&  }|j                  |j                   z   }||v r* ||t        t#        j$                  d      ||                ||v r* ||t        t#        j$                  d      ||                |	|
|fD ]1  }||v s||vs ||t        t"        j&                  ||                3 ||v r2||vr.t        dk  r% ||t        t"        j&                  ||                ||v rZ||vrVt         j(                  j*                  j-                         r.t        dk  r% ||t        t"        j&                  ||                ||v rR||vrNt         j(                  j*                  j-                  d      r% ||t        t"        j&                  ||                ||v r2||vr.t        dk\  r% ||t        t"        j&                  ||                ||vs||vst        dk  s ||t        t"        j&                  t         j.                  t         j                  g             ) | S )N>   
linalg.svdspecial.entrlinalg.diagonalspecial.xlog1pynn.functional.unfoldnn.functional.softsignnn.functional.tanhshrinknn.functional.padcircularspecial.spherical_bessel_j00nn.functional.feature_alpha_dropoutwithout_trainHTtmHmTabsaddcosexplogmulnegsgnsinsubsvdtanacosasinatanconjcoshdiagexp2fillfullimagitemkronlog2onesrealrsubsincsinhsqrttanhtriltriuviewchalfchunkcloneemptyexpm1isinflog10log1pouterrandnravelrsqrtslicesplitzero_zeroscfloatdsplitexpandhsplitisrealnarrowselectt_copyunbindunfoldvsplitflattenmovedimnonzeropermutereshapesigmoidsqueezeview_as__radd____rmul____rsub__argwherediagflatdiagonalisfinitenew_fullnew_onespositive	expand_as	full_like	new_zeros	ones_like	transpose	unflatten	unsqueeze	view_copy
alias_copy
as_strided
atleast_1d
atleast_2d
atleast_3d
contiguous
diag_embed
index_copy
reshape_as
zeros_like__getitem__expand_copymasked_fillnarrow_copyresolve_negtrue_divideunbind_copyunfold_copybroadcast_toindex_selectpermute_copyresolve_conjsqueeze_copytensor_splitunsafe_chunkunsafe_splitview_as_realconj_physicaldiagonal_copyempty_stridedmasked_selectscalar_tensorempty_permutedmasked_scattersplitlist_argstranspose_copyunsqueeze_copyas_strided_copysqueezemultiplediagonal_scattersplit_with_sizesbroadcast_tensorsrepeat_interleaveas_strided_scatterdivno_rounding_mode_unsafe_masked_indexsplit_with_sizes_copymeshgridlist_of_tensorsmeshgridvariadic_tensorsspecial.zetann.functional.conv1dnn.functional.conv2dnn.functional.conv_transpose1dnn.functional.conv_transpose2dnn.functional.conv_transpose3d>k   
masked.std
masked.sum
masked.varlinalg.pinvmasked.meanmasked.prodfft.fftshiftfft.ifftshiftlinalg.multi_dotmasked.logsumexpnn.functional.rms_normnn.functional.padreflectnn.functional.padconstantnn.functional.padreplicatenn.functional.pixel_shufflenn.functional.pixel_unshuffleeqmmmvneallanybmmcatcovdivdoteyeintsumboolbytechardifffliphalflerplongmeanprodrollr:   r;   stftacoshaddmvangleatanhequalfloatinnerisnanldexprot90shortstacktracetrapzwheredstackeinsumfliplrflipudhstackmatmulsquarevstackaddcdivaddcmulisclose__rdiv__allclosebfloat16corrcoefgradientlinspacepinverse	logsumexp	tensordot	trapezoid
_chunk_cat
logical_or
reciprocal__rmatmul__logical_andlogical_notlogical_xorsum_to_sizecolumn_stackcombinationscount_nonzerocartesian_prodaddmmdecomposedconstant_pad_ndlinspacetensor_overloadfft.fftfft.fft2fft.fftnfft.hfftfft.ifft	fft.hfft2	fft.hfftn	fft.ifft2	fft.ifftn	fft.irfft
fft.irfft2
fft.irfftn)cdistatan2argsortsortcumsumcumprodcumulative_trapezoidzmasked.cumsumzmasked.cumprodzlinalg.vandermasked.softminmasked.softmaxmasked.log_softmaxgrid_sampler_2d)r  r  r  logspacelogspacetensor_overloadz
linalg.eigzlinalg.eigvalsputcauchy_cauchycholesky_inversecholesky_solvefrexpgcdgeqrfznn.functional.grid_sample	heavisideigammaigammacindex_reduceprodindex_reducemeanindex_reduceamaxindex_reduceaminkthvaluelcmzlinalg.condzlinalg.eighzlinalg.eigvalshzlinalg.householder_productzlinalg.ldl_factorzlinalg.ldl_factor_exzlinalg.ldl_solvezlinalg.lstsqzlinalg.lstsqgrad_orientedz	linalg.luzlinalg.lu_solvezlinalg.matrix_normzlinalg.normzlinalg.normsubgradients_at_zeroz	linalg.qrzlinalg.svdvalszlinalg.vecdotlogcumsumexplu_solvezmasked.median
matrix_expmodenative_dropout_backwardnormnucz#nn.functional.fractional_max_pool2dz#nn.functional.fractional_max_pool3dz!nn.functional.adaptive_avg_pool3dz!nn.functional.adaptive_max_pool3dznn.functional.interpolateareaz nn.functional.interpolatebicubicznn.functional.max_unpool1dgradznn.functional.max_unpool2dgradznn.functional.max_unpool3dgradznn.functional.avg_pool3dznn.functional.ctc_lossznn.functional.embedding_bagznn.functional.max_pool3dznn.functional.max_unpool1dznn.functional.max_unpool2dznn.functional.max_unpool3dznn.functional.multi_margin_lossz$nn.functional.multilabel_margin_lossznn.functional.pdistznn.functional.rreluznn.functional.normormqrpca_lowrankqrscatter_reduceamaxg      .@scatter_reduceaminsegment_reducez_segment.reducezsegment.reducesegment_reduce_offsets_segment_reduce_offsets_segment_reduce_lengths_segment_reducelengths_segment_reduceoffsetsz	sparse.mmzsparse.sampled_addmmsparse.mmreducezspecial.airy_aizspecial.erfcxzspecial.laguerre_polynomial_lzspecial.log_ndtrzspecial.ndtrisvd_lowranksymeigtaketo	to_sparseuniquevdotsegment_reduce__upsample_bilinear2d_aa_upsample_bicubic2d_aa	geometric
geometric_log_normal_
log_normalcdoubledoubleznn.functional.softminwith_dtypelog_softmaxwith_dtypesoftmaxwith_dtypefloat_powerzlinalg.matrix_rankhermitianzlinalg.pinvhermitiannonzero_staticz!nn.functional.adaptive_avg_pool1dz!nn.functional.adaptive_avg_pool2dr   r   nn.functional.conv3dr   r   r   g      ,@)r   histc	index_addznn.functional.linearr  addbmmaddmmbaddbmmmatr   r   bincountroundrounddecimals_0#_unsafe_masked_index_put_accumulater   r	  r
  r  r  r  r  r  r  z	fft.ihfftz
fft.ihfft2z
fft.ihfftnr  r  r  zfft.rfft)z	fft.rfft2z	fft.rfftnr   isinznn.functional.max_pool2d)quantilenanquantiletopkmultinomialuniform	rand_likerandintrandint_likerI   
randn_like	bernoulliexponentialz-nn.functional.feature_alpha_dropoutwith_trainnormalnormalin_placenormalnumber_meanznn.functional.alpha_dropoutznn.functional.dropoutznn.functional.dropout2d)	znn.functional.dropout3dz*nn.functional.multi_head_attention_forward	index_put__rpow__resize_
resize_as_addras_stridedpartial_viewsz*nn.functional.scaled_dot_product_attention)linalg.matrix_rankarange)	new_emptynew_empty_stridedr   rC   
empty_liker   opdr   c                 B    |_         | j                  |fz   | _        y N)r
   
decorators)r~  r  r
   s     u/var/www/html/ai-insurance-compliance-backend/venv/lib/python3.12/site-packages/torch/testing/_internal/common_mps.pyaddDecoratorz&mps_ops_modifier.<locals>.addDecorator  s"    & +MMQD0BM    zSkipping empty ops.dtypeszSkipped!g,@皙*@   )torchfloat32r   int16int32int64uint8int8float16r   	complex64r   updater   r   namevariant_test_nameunittestskipexpectedFailurebackendsmpsis_macos13_or_newer	complex32)r	   r
   r   SUPPORTED_COMPLEX_OPS&AFTER_MACOS_14_0_SUPPORTED_COMPLEX_OPSMACOS_BEFORE_13_3_XFAILLISTMACOS_AFTER_13_1_XFAILLISTMACOS_13_3_XFAILLISTMACOS_BEFORE_14_4_XFAILLISTUNIMPLEMENTED_XFAILLISTUNDEFINED_XFAILLISTON_MPS_XFAILLISTEMPTY_OPS_SKIPLISTSKIPLISTr  r~  key	xfaillists    `                r  mps_ops_modifierr     s   
 " O_!
Bl2
.` mm_ 



 uzz5;;

K ZZejj%--H{{m}%*[[M#kk]${{m#kk]  %}}emm<$}}emm<#(==%--"@M''
#V  &
"( 



 



) 
> %//*'
#n#
n#
 &tn#
 $	n#

 dn#
 4n#
 tn#
 dn#
 n#
 dn#
 Tn#
 4n#
 Tn#
 (n#
 n#
  d!n#
" t#n#
$ %n#
& 'n#
( )n#
* +n#
, -n#
. 4/n#
0 41n#
2 43n#
4 t5n#
6 )$7n#
8  9n#
: #D;n#
< =n#
> D?n#
@ (An#
B Cn#
D tEn#
F !5==/Gn#
H EMM?In#
J .Kn#
L Mn#
N dOn#
P TQn#
R DSn#
T Un#
V TWn#
X $Yn#
Z D[n#
\ &t]n#
^ t_n#
` 24an#
b 24cn#
d 0en#
f 0gn#
h ,Tin#
j /kn#
l -dmn#
n -don#
p -dqn#
r 'sn#
t %dun#
v *4wn#
x 'yn#
z )${n#
| )$}n#
~ )$n#
@ .tAn#
B 3DCn#
D "4En#
F "4Gn#
H !$In#
J TKn#
L 4Mn#
N $On#
P !t# $);;"<++Un#
V !t# $);;"<++[n#
\ d]n#
^ t_n#
` dan#
b %dcn#
d &ten#
f &tgn#
h %din#
j %dkn#
l mn#
n #Don#
p tqn#
r tsn#
t Tun#
v ,Twn#
x yn#
z T{n#
| 4}n#
~ dn#
@ DAn#
B $Cn#
D En#
F dGn#
H DIn#
J tKn#
L &}Mn#
N %u{{mOn#
P Qn#
R $Sn#
T 4Un#
V $Wn#
X tYn#
Z d[n#
\ .t]n#
^ $T_n#
`  an#
b 4cn#
d *4en#
f #Dgn#
h din#
l 0mn#
n 0on#
r #U[[Msn#
t #U[[Mun#
v #U[[Mwn#
x -u{{myn#
z -u{{ENN.K{n#
| -/}n#
H %2D$8EKK=bmmU^^4++ 

% 

  {{EKKekk5::Vkk5;;U[[%**UU[[%++u{{EJJWKKekk5;;

S'4t';u{{m,9D,@EKK=b 

 mmU^^4 %/ 

	4Qn#
` 4#**t  	
             !$ !$   !$  !$!" #$ "&!%  

 27=!F 4#** $#'Q
 

Q
 Q
" u}}ennE#Q
$ %--G%Q
& t'Q
( D)Q
* T+Q
, $-Q
. %--G/Q
0 EMM5==%..I1Q
2 <>3Q
< u}}emmU^^D=Q
> u}}emmU^^L?Q
@  %--!OAQ
B *,CQ
L $emmU]]ENN%SMQ
N &u}}enn'UOQ
P ).u}}enn'U ; 

	 U[[%++u{{Ku}}ennE ==%--H 



 (, ;YQ
l #'{{m
 !%! "
$ #D
	1V 	1 	1 	1  V	B''B000C((  &;<1#6 hX]]:%>xPS}U (#  		
 )#?(B $X%=%=iPSnU	 22."T)  00:3? 22.^^'';;=-RVBV  00:3? 11.NN&&::1=  009STW9X ++."d*  009Mc9R //AA 4'  00 %AaV	p 
r  c                    i dt         j                  t         j                  gdt         j                  t         j                  gdd dd dt         j                  gdt         j                  t         j                  gdt         j                  t         j                  gdt         j                  gd	t         j                  t         j                  gd
t         j                  t         j                  gdt         j                  t         j                  gdt         j                  t         j                  gdt         j                  t         j                  gdt         j                  t         j                  gdt         j                  t         j                  gdt         j                  t         j                  gdt         j                  t         j                  gi dt         j                  gdt         j                  gdt         j                  gdt         j                  t         j                  gdd dd dt         j                  t         j                  gdt         j                  t         j                  gdt         j                  t         j                  gdt         j                  t         j                  gdt         j                  t         j                  gdt         j                  t         j                  gdt         j                  t         j                  gdt         j                  gd t         j                  t         j                  gd!t         j                  gd"t         j                  gt         j                  gt         j                  gt         j                  gt         j                  gt         j                  gt         j                  gt         j                  gt         j                  gt         j                  gt         j                  t         j                  gt         j                  gt         j                  gd#}t         j                  t         j                  gt         j                  t         j                  gt         j                  t         j                  gt         j                  gt         j                  gt         j                  t         j                  t         j                  gt         j                  gd$}t         j                  gt         j                  gt         j                  gt         j                  gt         j                  gt         j                  gt         j                  gd%}d&t         j                  gi}d t         j                  gd'}d(t        d)t
        d*d fd+}| D ]&  }|j                  |j                  z   }||v r% ||t        t        j                  ||   ,             ||v r% ||t        t        j                  ||   ,             ||v r% ||t        t        j                  ||   ,             ||v rVt         j                  j                  j                         r.t        d-k  r% ||t        t        j                  ||   ,             ||v st        d-k\  s ||t        t        j                  ||   ,             ) | S ).N_segment_reducer   rM  rN  rD  unique_consecutiver   r  zmasked.scatter
index_fillzlinalg.solvezlinalg.solve_exzlinalg.tensorsolvez
linalg.detzlinalg.slogdetlogdetaminmaxz
special.i1zspecial.i1er   ro  r   	nextafterfloor_divider   histogramdd	histogramr   r   r3   znn.functional.smooth_l1_lossrI   zsignal.windows.bartlettzsignal.windows.blackman)zsignal.windows.cosinezsignal.windows.exponentialzsignal.windows.gaussianzsignal.windows.general_cosinezsignal.windows.general_hammingzsignal.windows.hammingzsignal.windows.hannzsignal.windows.kaiserzsignal.windows.nuttallr   ra  rg  )r  r  r  r   triangular_solver  msort)znn.functional.pairwise_distancer   r   rY  r   r   r   r  )ry  rY  r~  r  r   c                 .    | j                   |fz   | _         y r  r  r~  r  s     r  r  z+mps_ops_grad_modifier.<locals>.addDecorator      MMQD0BMr  r  r  )r  r  r  r   r   r   r  r  r  r  r  r  r  r  r   )	r	   XFAILLIST_GRAD MACOS_BEFORE_13_3_XFAILLIST_GRADSKIPLIST_GRADMACOS_13_3_XFAILLIST_GRADr  r  r~  r  s	            r  mps_ops_grad_modifierr  '  s   H
u}}=H
 5==%--8H
 &t	H

 %dH
 H
 !5==%--"@H
 emmU]];H
 emm_H
 u}}emm<H
 5==%--8H
 U]]EMM:H
  H
" !##H
* 5==%--8+H
, -H
4 u}}emm45H
6 u}}57H
8 5==/9H
: EMM?;H
> emm_?H
B EMM5==9CH
H DIH
L MH
P U]]EMM:QH
T EMM5==9UH
X EMM5==9YH
\ %--7]H
` 6aH
b emmU]]3cH
f U]]EMM2gH
j +U]]OkH
n emmU]]3oH
p &qH
r &sH
t ',mm_+0==/(-.3mm_/4}}o',}}o$)MM?&+mm_',}}oMM5==1mm_]]OOH
X  %}}emm<$}}emm<#(==%--"@mm_!& %u}}ennM
 mm_,
(" 16%*]]O%*]]O%*]]O/4}}o/4}}o/4}}o	
  emm_%
! #'%*]]O
	1V 	1 	1 	1  $	B''B000Cn$ !9!9.QTBUV
 m#RhmmMRUDV!WX&&  009I#9N 66""668]T=Q  00?D //]d5J  009RSV9W?$	J 
r  c                     h d}dt         dt        dd fd}| D ]@  }|j                  |j                  z   }||v s! ||t        t        j
                               B | S )N>   r   amaxamingatherr  complexscatter__rmod__rt  re   rn  	clamp_max	clamp_minrh  scatter_addr   r3  r   r   r   rY  r~  r  r   c                 .    | j                   |fz   | _         y r  r  r  s     r  r  z3mps_ops_error_inputs_modifier.<locals>.addDecorator  r  r  )r   r   r  r  r  r  )r	   	XFAILLISTr  r~  r  s        r  mps_ops_error_inputs_modifierr    sn    
	:	1V 	1 	1 	1  	IB''B000CiRh.F.F!GH	I
 
r  )NN)r  collections.abcr   typingr   r  common_utilsr   opinfo.corer   r   r  r  is_availablestrlistr  r  r   r  r  <module>r     s     $   ' - 	>>""$ &*/3XfXc]X "$s),X 
&		Xt^8F#3 ^8H ^@'8F+; '@P 'y %r  