In[]:=
deploy
Mon 20 Dec 2021 10:41:36
In[]:=
(*createproperlyscaledrandommatrix*)randXavier[{rows_,cols_}]:=RandomVariateNormalDistribution0,Sqrt,{rows,cols};(*normalizeeachrowofmatrixtohavenorm1*)rowNormalize[mat_]:=Module[{rowNorms},rowNorms=Norm/@mat;DiagonalMatrix[1/rowNorms].mat];(*takeupppertriangularpartofmatrixasavector*)upperTriangular[mat_]:=Statistics`Library`UpperTriangularMatrixToVector[mat];d=200;(*depth*)w=1024;(*layerdimension*)b=50;(*batchsize*)mat:=randXavier[{w,w}]x=RandomVariate[NormalDistribution[],{b,w}];a=Nest[Tanh[#.mat]&,x,d];a=rowNormalize[a];gram=a.Transpose[a];plot1=Histogram[upperTriangular[gram]]
2
rows+cols
Out[]=