In[]:=
experiment=CloudImport[CloudObject[
https://www.wolframcloud.com/obj/c93ffcf9-cdd5-4409-9200-df18d07342aa
]];In[]:=
Plot[{experiment[x],piecewise[x]},{x,-3,3},Frame->True,FrameTicks->None,FrameLabel->{x,f[x]},RotateLabel->False,PlotStyle->{Automatic,Directive[Gray,Dotted]},Exclusions->None,PlotRange->{{-3,3},{-0.4,1.4}},ImageSize->160]
Out[]=
In[]:=
QuantizeNN[net_,delta_]:=NetReplacePart[net,Normal[NumericArray[Round[Normal[#],delta],"Real32"]&/@Information[net,"Arrays"]]]
In[]:=
QuantizeNN[experiment,.01]
Out[]=
NetChain
In[]:=
NetChain[%66,TargetDevice->"GPU"]
Out[]=
$Failed
In[]:=
With[{exp=QuantizeNN[experiment,.01]},Plot[{exp[x],piecewise[x]},{x,-3,3},Frame->True,FrameTicks->None,FrameLabel->{x,f[x]},RotateLabel->False,PlotStyle->{Automatic,Directive[Gray,Dotted]},Exclusions->None,PlotRange->{{-3,3},{-0.4,1.4}},ImageSize->200]]
Out[]=
In[]:=
GraphicsGrid[Partition[Table[With[{exp=QuantizeNN[experiment,d]},Plot[{exp[x],piecewise[x]},{x,-3,3},Frame->True,FrameTicks->None,FrameLabel->{Text[d]},PlotStyle->{Automatic,Directive[Gray,Dotted]},Exclusions->None,PlotRange->{{-3,3},{-0.4,1.7}},ImageSize->150]],{d,Take[Sort[Join[PowerRange[.0001,1,10],5PowerRange[.0001,1,10]]],{2,-2}]}],4]]
Out[]=
In[]:=
Log2[.001]
Out[]=
-9.96578
In[]:=
Plot3D[QuantizeNN[experiment,10^n][x],{x,-3,3},{n,-4,1}]
Out[]=
In[]:=
data=ParallelTable[With[{exp=QuantizeNN[experiment,10^n]},Table[exp[x],{x,-3,3,.01}]],{n,-4,.5,.1}]
Out[]=
$Aborted
In[]:=
data=Monitor[Table[With[{exp=QuantizeNN[experiment,10^n]},Table[exp[x,TargetDevice->"GPU"],{x,-3,3,.1}]],{n,-4,.5,.1}],n];
In[]:=
ListPlot3D[%,MeshFunctions->{#3&}]
Out[]=
In[]:=
data=Monitor[Table[With[{exp=QuantizeNN[experiment,10^n]},Table[exp[x,TargetDevice->"GPU"],{x,-3,3,.1}]],{n,-3,-.4,.1}],n];
In[]:=
ListPlot3D[%75,MeshFunctions->{#3&},PlotRange->{-.2,1.8}]
Out[]=
data=Monitor[Table[With[{exp=QuantizeNN[experiment,10^n]},Table[exp[x,TargetDevice->"GPU"],{x,-3,3,.05}]],{n,-3,-.4,.05}],n];
In[]:=
ListPlot3D[data,MeshFunctions->{#2&},PlotStyle->Opacity[.4],MeshStyle->Directive[Black,Thick],Mesh->40,PlotRange->{-.2,1.8},ViewPoint{0.8612117905796306`,-2.788127321930032`,1.713085020795501`},DataRange->{{-3,3},{-3,-.4}},BoxRatios->{1,3,.6}]
Out[]=
Mesh Nets
Mesh Nets