
    ^j،                     6   d dl 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dee   dz  d	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	 	 	 ddee   dedee   dz  d	ed
ee   f
dZy)    N)Sequence   )MACOS_VERSION)DecorateInfoOpInfoopsdevice_typexfail_exclusionsparsereturnc                     |g }h 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t         j                  gdt         j                  gdt         j                  gdd dd dd dt         j                  t         j                  t         j
                  t         j                  t         j                  gdt         j                  gdd dt         j                  gdt         j                  t         j                  t         j                  t         j                  t         j
                  gdd d t         j                  t         j
                  t         j                  t         j                  t         j                  gd!t         j                  t         j
                  t         j                  t         j                  t         j                  gd"t         j                  t         j
                  t         j                  t         j                  gd#t         j                  t         j                  t         j                  t         j                  t         j
                  gd$d i d%d d&t         j
                  t         j                  t         j                  t         j                  t         j                  gd't         j                  t         j                  t         j                  t         j                  t         j
                  gd(d d)t         j                  t         j
                  t         j                  t         j                  t         j                  t         j                  gd*t         j                  t         j
                  t         j                  t         j                  t         j                  t         j                  gd+d d,d d-t         j                  gd.d d/t         j                  t         j                  t         j
                  t         j                  t         j                  gd0t         j                  t         j
                  t         j                  t         j                  t         j                  gd1t         j                  t         j                  t         j                  t         j                  t         j
                  t         j                  gd2t         j                  gd3t         j                  gd4t         j                  t         j
                  t         j                  t         j                  t         j                  t         j                  gd5t         j                  t         j
                  t         j                  t         j                  t         j                  t         j                  gi d6t         j                  t         j
                  t         j                  t         j                  t         j                  t         j                  gd7t         j                  t         j
                  t         j                  t         j                  t         j                  t         j                  gd8t         j                  t         j
                  t         j                  t         j                  t         j                  t         j                  gd9t         j                  t         j
                  t         j                  t         j                  t         j                  t         j                  gd:t         j
                  t         j                  t         j                  t         j                  t         j                  gd;d d<t         j                  t         j                  t         j
                  t         j                  t         j                  gd=t         j                  t         j                  t         j
                  t         j                  gd>t         j                  t         j
                  t         j                  t         j                  t         j                  t         j                  gd?t         j                  gd@d dAt         j                  gdBd dCt         j                  t         j
                  t         j                  t         j                  gdDt         j
                  t         j                  t         j                  t         j                  t         j                  gdEd dFd i dGt         j                  t         j                  t         j                  t         j
                  t         j                  gdHt         j                  gdId dJd dKd dLd dMd dNd dOd dPd dQd dRd dSd dTd dUd dVd dWd i dXd dYt         j                  t         j                  gdZd d[d d\d d]d d^d d_t         j                  gd`t         j                  gdad dbd dct         j                  t         j                  t         j
                  t         j                  t         j                  t         j                  gddd ded dfd dgd dhd t         j                  gt         j                  gt         j                  gt         j                  gt         j                  t         j                  g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di	}d d d d d dj}|r|j                  |       t         j                  gt         j                  gt         j                  gt         j                  g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                  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dk}d 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dl}	d d d d d d dm}
d t         j                  t         j                  gdn}dot        dpt        dqd ffdr}| D ]  }|j                  |j                  z   } ||t        t         j"                  t         j$                  t         j&                  gs             |r6 ||t        t!        j(                  dt      t         j*                  gs             ||
v r* ||t        t!        j(                  du      |
|   s             ||v r* ||t        t!        j(                  dv      ||   s             |||	fD ]1  }||v s||vs ||t        t         j"                  ||   s             3 ||v r2||vr.t,        dwk  r% ||t        t         j"                  ||   s             ||vsf ||t        t         j"                  t         j.                  t         j                  gs              | S )xN>7  fft.fftfft.fft2fft.fftnfft.hfftfft.ifft	fft.hfftn	fft.ifft2	fft.ifftn	fft.irfft
fft.irfft2
fft.irfftn
linalg.svd
masked.std
masked.sum
masked.varlinalg.pinvmasked.meanmasked.prodfft.fftshiftlinalg.crossspecial.entrfft.ifftshiftlinalg.vanderlinalg.vecdotmasked.cumsummasked.cumprodlinalg.diagonalspecial.xlog1pylinalg.multi_dotmasked.logsumexpmasked.normalizelinalg.vector_normnn.functional.unfoldnn.functional.l1_lossnn.functional.rms_normnn.functional.softsignnn.functional.normalizenn.functional.padreflectnn.functional.tanhshrinknn.functional.padcircularnn.functional.padconstantnn.functional.padreplicatenn.functional.pixel_shufflespecial.spherical_bessel_j0nn.functional.pixel_unshufflenn.functional.softminwith_dtype!nn.functional.triplet_margin_loss/nn.functional.triplet_margin_with_distance_loss0nn.functional.feature_alpha_dropoutwithout_trainHTteqmHmTmmmvneabsaddallanybmmcatcoscovdivdotexpeyeintlogmulnegsgnsinsubsumsvdtanacosasinatanboolbytecharconjcoshdiagdiffdistexp2fillflipfullhalfimagitemkronlerplog2longmeannormonesprodrealrollrsubsincsinhsqrtstfttanhtiletriltriuvdotviewacoshaddmvangleasinhatanhchalfchunkclonecrossemptyequalexpm1floatinnerisinfisnanistftldexplog10log1pouterrandnravelrot90rsqrtshortslicesplitstacktracetrapzwherezero_zerosaddbmmcfloatcumsumdsplitdstackeinsumexpandfliplrflipudgatherhsplithstackisrealmatmulnarrowrepeatselectsquaret_copyunbindunfoldvsplitvstackaddcdivaddcmulbaddbmmcumprodflattenisclosemovedimnonzeronormfronorminfpermutereshapescattersigmoidsqueezeuniformview_as__radd____rdiv____rmul____rsub__allcloseargwherebfloat16corrcoefdiagflatdiagonalgradientisfinitelinspacenew_fullnew_onespinversepositive	expand_as	full_like	index_add	index_put	logaddexp	logsumexp	new_zeros	ones_like	rand_like	tensordot	transpose	trapezoid	unflatten	unsqueeze	view_copy
_chunk_cat
alias_copy
as_strided
atleast_1d
atleast_2d
atleast_3d
block_diag
contiguous
diag_embed
index_copy
index_fill
logaddexp2
logical_or
randn_like
reciprocal
reshape_as
zeros_like__getitem____rmatmul__expand_copylogical_andlogical_notlogical_xormasked_fillnarrow_copyresolve_negscatter_addsum_to_sizetrue_divideunbind_copyunfold_copybroadcast_tocolumn_stackcombinationsindex_selectlogcumsumexppermute_copyresolve_conjsqueeze_copytensor_splitunsafe_chunkunsafe_splitview_as_realconj_physicalcount_nonzerodiagonal_copyempty_stridedmasked_selectscalar_tensorcartesian_prodempty_permutedmasked_scatternonzero_staticnormalin_placesplitlist_argstake_along_dimtranspose_copyunsqueeze_copyaddmmdecomposedas_strided_copyconstant_pad_ndsqueezemultiplediagonal_scattersplit_with_sizesbroadcast_tensorsrepeat_interleavesoftmaxwith_dtypeas_strided_scatterdivno_rounding_mode_unsafe_masked_indexcumulative_trapezoidsplit_with_sizes_copylinspacetensor_overloadmeshgridlist_of_tensorsmeshgridvariadic_tensors#_unsafe_masked_index_put_accumulate	fft.hfft2special.zetann.functional.conv1dnn.functional.conv2dnn.functional.linearlinalg.householder_productnn.functional.conv_transpose1dnn.functional.conv_transpose2dnn.functional.conv_transpose3dnn.functional.pairwise_distancer;  logspacelogspacetensor_overload
linalg.eiglinalg.eigvalsputfrexpgeqrfhash_tensor	heavisidezlinalg.condzlinalg.eighzlinalg.eigvalshzlinalg.ldl_factorzlinalg.ldl_factor_exzlinalg.ldl_solvezlinalg.lstsqzlinalg.lstsqgrad_orientedzlinalg.matrix_normzlinalg.normzlinalg.normsubgradients_at_zerozlinalg.svdvalszmasked.median
matrix_exp max_pool2d_with_indices_backwardmedianmode	nanmediannative_batch_normnormnucznn.functional.avg_pool1dznn.functional.avg_pool2dznn.functional.avg_pool3dznn.functional.batch_normz#nn.functional.fractional_max_pool2dz#nn.functional.fractional_max_pool3dznn.functional.gluznn.functional.huber_lossz!nn.functional.adaptive_avg_pool3dz!nn.functional.adaptive_max_pool1dz!nn.functional.adaptive_max_pool2dz!nn.functional.adaptive_max_pool3dznn.functional.interpolateareaz nn.functional.interpolatebicubicznn.functional.ctc_lossz!nn.functional.local_response_normznn.functional.logsigmoidznn.functional.max_pool1dznn.functional.max_pool2dznn.functional.max_pool3dznn.functional.max_unpool1dznn.functional.max_unpool1dgradznn.functional.max_unpool2dznn.functional.max_unpool2dgradznn.functional.max_unpool3dznn.functional.max_unpool3dgradznn.functional.mishznn.functional.multi_margin_lossz$nn.functional.multilabel_margin_lossz)nn.functional.multilabel_soft_margin_lossznn.functional.nll_lossz#nn.functional.padreplicate_negativeznn.functional.pdistznn.functional.reluznn.functional.rreluznn.functional.siluznn.functional.softplusznn.functional.normormqrrounddecimals_0scatter_reduceprod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.laguerre_polynomial_lzspecial.legendre_polynomial_pzspecial.log_ndtrzspecial.ndtrir~   svd_lowranksymeigtaketosegment_reduce__upsample_bilinear2d_aa_upsample_bicubic2d_aacdoubledoublelog_softmaxwith_dtypefloat_powerzlinalg.matrix_rankhermitianzlinalg.pinvhermitianz!nn.functional.adaptive_avg_pool1dz!nn.functional.adaptive_avg_pool2d)	r=  r>  nn.functional.conv3drA  rB  rC  r?  matbincount)rE  rF  rG  rH  rI  )pca_lowrankr  randintrandint_likenn.functional.dropoutz*nn.functional.multi_head_attention_forward__rpow__resize_
resize_as_addras_stridedpartial_viewsz*nn.functional.scaled_dot_product_attention)linalg.matrix_rankarangeargsortsort)	new_emptynew_empty_stridedr  r   
empty_liker!  )rj  znn.functional.grid_sampleopdr   c                 B    |_         | j                  |fz   | _        y N)r	   
decorators)r}  r~  r	   s     m/var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/torch/testing/_internal/common_mps.pyaddDecoratorz&mps_ops_modifier.<locals>.addDecorator  s"    & +MMQD0BM    dtypesz4Skipped due to MPS not supporting complex128 tensorszSkipping empty ops.zSkipped!g,@)torch	complex64float32int8int16int32int64uint8ra   float16r   updater   r   namevariant_test_nameunittestexpectedFailurerg  rf  skip
complex128r   	complex32)r   r	   r
   r   SUPPORTED_COMPLEX_OPSMACOS_BEFORE_14_4_XFAILLISTUNIMPLEMENTED_XFAILLISTUNIMPLEMENTED_XFAILLIST_SPARSEUNDEFINED_XFAILLISTON_MPS_XFAILLISTEMPTY_OPS_SKIPLISTSKIPLISTr  r}  key	xfaillists    `              r  mps_ops_modifierr     s    " Oz!
|	 %//*'
#u;
u;
 &tu;
 $	u;

 du;
 4u;
 Tu;
 Tu;
 4u;
 u;
 4u;
 4u;
 tu;
  u;
  #D!u;
" #u;
$ D%u;
& ('u;
( !5==/)u;
* EMM?+u;
, .-u;
. d/u;
0 T1u;
2 $3u;
4 /

15u;
B uzzlCu;
D DEu;
F %**Gu;
H  



"Iu;
V tWu;
X '



)Yu;
f '



)gu;
t '

	)uu;
@ '



)Au;
N 24Ou;
P 24Qu;
R  



"Su;
` '



)au;
n 0ou;
p 0



2qu;
@ 0



2Au;
P 0Qu;
R ,TSu;
T /Uu;
V %dWu;
X 0



2Yu;
f '



)gu;
t '



)uu;
D 'Eu;
F 'Gu;
H )



+Iu;
X -



/Yu;
h )



+iu;
x -



/yu;
H )



+Iu;
X -



/Yu;
h !



#iu;
v .twu;
x 3

5yu;
F 8

	:Gu;
R %



'Su;
b 2EJJ<cu;
d "4eu;
f !5::,gu;
h "4iu;
j !

	#ku;
v %



'wu;
D !$Eu;
F TGu;
H 

 Iu;
^ !5;;-_u;
` dau;
b tcu;
d deu;
f %dgu;
h &tiu;
j &tku;
l %dmu;
n %dou;
p qu;
r #Dsu;
t tuu;
v twu;
x ,Tyu;
z ,T{u;
| }u;
~ Tu;
@ U]]ENN3Au;
B 4Cu;
D dEu;
F DGu;
H $Iu;
J tKu;
L &}Mu;
N %u{{mOu;
P tQu;
R dSu;
T $

&Uu;
d 4eu;
f *4gu;
h #Diu;
l 0mu;
n 0ou;
r &+[[M%*[[M%*[[M/4{{m/4{{ENN.K/ 

% KKekk5;;

S 

]	u;
n	 '+"B
& #**+IJ "MM? #__- 

|"ZZL ',oo%6 ; U[[%++u{{Ku}}ennE ==%--H 



 (, ;i97
| #'{{m 



 



3 4
L !%! "
$ %) +0--)H
	1V 	1 	1 	1  F	B''B000C,,	    R ",, 	
 ((  &;<1#6 hX]]:%>xPS}U (#  		
 )#?(B $X%=%=iPSnU	 22."T)  00:3? //  00 %AAF	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d dt         j                  t         j                  gdt         j                  t         j                  gd	t         j                  t         j                  gd
d dd dt         j                  gd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i dt         j                  t         j                  gdt         j                  t         j                  gdt         j                  g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                  gdt         j                  gd 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                  t         j                  gd d 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d$}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 ss ||t	        t        j                  ||   *              | S )+N_segment_reducer   rd  re  r^  r@  unique_consecutiver  zmasked.scatterigammaigammacz
special.i1zspecial.i1emsortrp  znn.functional.dropout2dznn.functional.dropout3dznn.functional.alpha_dropoutz-nn.functional.feature_alpha_dropoutwith_trainrm  r<  floor_dividehistogramdd	histogramr   r   ro   r   zsignal.windows.bartlettzsignal.windows.blackmanzsignal.windows.cosinezsignal.windows.exponentialzsignal.windows.gaussianzsignal.windows.general_cosine)zsignal.windows.general_hammingzsignal.windows.hammingzsignal.windows.hannzsignal.windows.kaiserzsignal.windows.nuttallrS   	to_sparseunique)topkrD  r=  r>  rj  rA  rB  rC  )rv  rj  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   XFAILLIST_GRADSKIPLIST_GRADr  r  r}  r  s          r  mps_ops_grad_modifierr  _  s}   I
u}}=I
 5==%--8I
 &t	I

 %dI
 I
 )$I
 !5==%--"@I
 emmU]];I
 u}}emm<I
 dI
 tI
 5==/I
 EMM?I
( emm_)I
: $emmU]]%C;I
< &u}}'E=I
> &u}}'E?I
@ *EMM5==+IAI
B <>CI
P EMM?QI
V DWI
Z U]]EMM:[I
^ EMM5==9_I
b %--7cI
f 6gI
h emmU]]3iI
l U]]EMM2mI
p emmU]]3qI
r &sI
t &uI
v $emm_wI
x )5==/yI
z &{I
| ,emm_}I
~ 05}}o',}}o$)MM?&+mm_',}}oMM5==1QI
^ ]]O05%*]]O%*]]O%*]]O/4}}o/4}}o/4}}o
$ #'%*]]O
	1V 	1 	1 	1  	B''B000Cn$ !9!9.QTBUV
 m#RhmmMRUDV!WX&&  009I#9N	& 
r  c                     h d}dt         dt        dd fd}| D ]@  }|j                  |j                  z   }||v s! ||t        t        j
                               B | S )N>	   amaxaminaminmax__rmod__rq  r   	clamp_max	clamp_minr"  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  c                     | S r   )r   r	   r
   r   s       r  r  r    s	     
r  )mpsNF)r  collections.abcr   r  common_utilsr   opinfo.corer   r   backendsr  is_availablestrlistra   r  r  r  r  r  r  <module>r     s    $  ' - 	>>""$ !,0	QfQQ cT)Q 	Q
 
&	Qfy8F#3 y8H yv8F+; @P : !,0	f cT) 	
 
&	r  