import{S as xo,i as Ro,s as So,e as o,k as m,w as R,t as n,M as No,c as a,d as i,m as f,a as s,x as S,h as l,b as d,G as t,g as p,y as N,L as Lo,q as L,o as F,B as A,v as Fo}from"../../../chunks/vendor-hf-doc-builder.js";import{I as wt}from"../../../chunks/IconCopyLink-hf-doc-builder.js";import{C as bt}from"../../../chunks/CodeBlock-hf-doc-builder.js";function Ao(Ji){let z,Pe,v,E,ue,M,Et,_e,yt,Xe,_,jt,ge,$t,Tt,P,kt,Ct,De,O,y,ze,X,qt,se,xt,ve,Rt,Ie,g,St,Oe,Nt,Lt,we,Ft,At,Be,ne,D,Mt,be,Pt,Xt,Ge,I,He,B,Ee,Dt,Ue,G,Je,w,j,ye,H,It,je,Bt,Ke,$,Gt,U,Ht,Ut,Qe,J,Ve,T,Jt,K,Kt,Qt,We,Q,Ye,b,k,$e,V,Vt,Te,Wt,Ze,le,Yt,et,h,re,ke,Zt,ei,ti,pe,Ce,ii,oi,ai,me,qe,si,ni,li,fe,xe,ri,pi,tt,C,mi,W,fi,di,it,Y,Re,ci,hi,ot,c,Z,ui,Se,_i,gi,zi,ee,vi,Ne,Oi,wi,bi,te,Ei,Le,yi,ji,$i,ie,Ti,Fe,ki,Ci,qi,oe,xi,Ae,Ri,Si,Ni,ae,Li,Me,Fi,Ai,at,q,Mi,de,Pi,Xi,st;return M=new wt({}),X=new wt({}),I=new bt({props:{code:`from optimum.onnxruntime import ORTOptimizer, ORTModelForSequenceClassification

model = ORTModelForSequenceClassification.from_pretrained("optimum/distilbert-base-uncased-finetuned-sst-2-english")

optimizer = ORTOptimizer.from_pretrained(model)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> optimum.onnxruntime <span class="hljs-keyword">import</span> ORTOptimizer, ORTModelForSequenceClassification

<span class="hljs-comment"># Loading ONNX Model from the Hub</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ORTModelForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;optimum/distilbert-base-uncased-finetuned-sst-2-english&quot;</span>)

<span class="hljs-comment"># Create an optimizer from an ORTModelForXXX</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>optimizer = ORTOptimizer.from_pretrained(model)`}}),G=new bt({props:{code:`from optimum.onnxruntime import ORTOptimizer

optimizer = ORTOptimizer.from_pretrained("path/to/model")`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> optimum.onnxruntime <span class="hljs-keyword">import</span> ORTOptimizer

<span class="hljs-comment"># This assumes a model.onnx exists in path/to/model</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>optimizer = ORTOptimizer.from_pretrained(<span class="hljs-string">&quot;path/to/model&quot;</span>)`}}),H=new wt({}),J=new bt({props:{code:`from optimum.onnxruntime import ORTOptimizer, ORTModelForSequenceClassification
from optimum.onnxruntime.configuration import OptimizationConfig

model_id = "distilbert-base-uncased-finetuned-sst-2-english"
save_dir = "/tmp/outputs"

model = ORTModelForSequenceClassification.from_pretrained(model_id, from_transformers=True)

optimizer = ORTOptimizer.from_pretrained(model)

optimization_config = OptimizationConfig(

optimizer.optimize(save_dir=save_dir, optimization_config=optimization_config)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> optimum.onnxruntime <span class="hljs-keyword">import</span> ORTOptimizer, ORTModelForSequenceClassification
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> optimum.onnxruntime.configuration <span class="hljs-keyword">import</span> OptimizationConfig

<span class="hljs-meta">&gt;&gt;&gt; </span>model_id = <span class="hljs-string">&quot;distilbert-base-uncased-finetuned-sst-2-english&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>save_dir = <span class="hljs-string">&quot;/tmp/outputs&quot;</span>

<span class="hljs-comment"># Load a PyTorch model and export it to the ONNX format</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ORTModelForSequenceClassification.from_pretrained(model_id, from_transformers=<span class="hljs-literal">True</span>)

<span class="hljs-comment"># Create the optimizer</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>optimizer = ORTOptimizer.from_pretrained(model)

<span class="hljs-comment"># Define the optimization strategy by creating the appropriate configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>optimization_config = OptimizationConfig(
    optimization_level=<span class="hljs-number">2</span>,
    fuse_operators=<span class="hljs-literal">True</span>,
    optimize_for_gpu=<span class="hljs-literal">False</span>,
)

<span class="hljs-comment"># Optimize the model</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>optimizer.optimize(save_dir=save_dir, optimization_config=optimization_config)`}}),Q=new bt({props:{code:`from optimum.onnxruntime import ORTOptimizer, ORTModelForSeq2SeqLM
from optimum.onnxruntime.configuration import OptimizationConfig
from transformers import AutoTokenizer

model_id = "sshleifer/distilbart-cnn-12-6"
save_dir = "/tmp/outputs"

model = ORTModelForSeq2SeqLM.from_pretrained(model_id, from_transformers=True)

optimizer = ORTOptimizer.from_pretrained(model)

optimization_config = OptimizationConfig(

optimizer.optimize(save_dir=save_dir, optimization_config=optimization_config)

optimized_model = ORTModelForSeq2SeqLM.from_pretrained(
tokenizer = AutoTokenizer.from_pretrained(model_id)
tokens = tokenizer("This is a sample input", return_tensors="pt")
outputs = optimized_model.generate(**tokens)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> optimum.onnxruntime <span class="hljs-keyword">import</span> ORTOptimizer, ORTModelForSeq2SeqLM
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> optimum.onnxruntime.configuration <span class="hljs-keyword">import</span> OptimizationConfig
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>model_id = <span class="hljs-string">&quot;sshleifer/distilbart-cnn-12-6&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>save_dir = <span class="hljs-string">&quot;/tmp/outputs&quot;</span>

<span class="hljs-comment"># Load a PyTorch model and export it to the ONNX format</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ORTModelForSeq2SeqLM.from_pretrained(model_id, from_transformers=<span class="hljs-literal">True</span>)

<span class="hljs-comment"># Create the optimizer</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>optimizer = ORTOptimizer.from_pretrained(model)

<span class="hljs-comment"># Define the optimization strategy by creating the appropriate configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>optimization_config = OptimizationConfig(
    optimization_level=<span class="hljs-number">2</span>,
    fuse_operators=<span class="hljs-literal">True</span>,
    optimize_for_gpu=<span class="hljs-literal">False</span>,
)

<span class="hljs-comment"># Optimize the model</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>optimizer.optimize(save_dir=save_dir, optimization_config=optimization_config)

<span class="hljs-comment"># Load the resulting optimized model</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>optimized_model = ORTModelForSeq2SeqLM.from_pretrained(
    save_dir,
    encoder_file_name=<span class="hljs-string">&quot;encoder_model_optimized.onnx&quot;</span>,
    decoder_file_name=<span class="hljs-string">&quot;decoder_model_optimized.onnx&quot;</span>,
    decoder_file_with_past_name=<span class="hljs-string">&quot;decoder_with_past_model_optimized.onnx&quot;</span>,
)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(model_id)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokens = tokenizer(<span class="hljs-string">&quot;This is a sample input&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = optimized_model.generate(**tokens)`}}),V=new wt({}),{c(){z=o("meta"),Pe=m(),v=o("h1"),E=o("a"),ue=o("span"),R(M.$$.fragment),Et=m(),_e=o("span"),yt=n("Optimization"),Xe=m(),_=o("p"),jt=n("\u{1F917} Optimum provides an "),ge=o("code"),$t=n("optimum.onnxruntime"),Tt=n(" package that enables you to apply graph optimization on many model hosted on the \u{1F917} hub using the "),P=o("a"),kt=n("ONNX Runtime"),Ct=n(" model optimization tool."),De=m(),O=o("h2"),y=o("a"),ze=o("span"),R(X.$$.fragment),qt=m(),se=o("span"),xt=n("Creating an "),ve=o("code"),Rt=n("ORTOptimizer"),Ie=m(),g=o("p"),St=n("The "),Oe=o("code"),Nt=n("ORTOptimizer"),Lt=n(" class is used to optimize your ONNX model. The class can be initialized using the "),we=o("code"),Ft=n("from_pretrained()"),At=n(" method, which supports different checkpoint formats."),Be=m(),ne=o("ol"),D=o("li"),Mt=n("Using an already initialized "),be=o("code"),Pt=n("ORTModelForXXX"),Xt=n(" class."),Ge=m(),R(I.$$.fragment),He=m(),B=o("ol"),Ee=o("li"),Dt=n("Using a local ONNX model from a directory."),Ue=m(),R(G.$$.fragment),Je=m(),w=o("h2"),j=o("a"),ye=o("span"),R(H.$$.fragment),It=m(),je=o("span"),Bt=n("Optimization examples"),Ke=m(),$=o("p"),Gt=n("Below you will find an easy end-to-end example on how to optimize "),U=o("a"),Ht=n("distilbert-base-uncased-finetuned-sst-2-english"),Ut=n("."),Qe=m(),R(J.$$.fragment),Ve=m(),T=o("p"),Jt=n("Below you will find an easy end-to-end example on how to optimize a Seq2Seq model "),K=o("a"),Kt=n("sshleifer/distilbart-cnn-12-6\u201D"),Qt=n("."),We=m(),R(Q.$$.fragment),Ye=m(),b=o("h2"),k=o("a"),$e=o("span"),R(V.$$.fragment),Vt=m(),Te=o("span"),Wt=n("Optimization Configuration"),Ze=m(),le=o("p"),Yt=n("In the optimization configuration, there are 4 possible optimization levels:"),et=m(),h=o("ul"),re=o("li"),ke=o("code"),Zt=n("optimization_level=0"),ei=n(" to disable all optimizations,"),ti=m(),pe=o("li"),Ce=o("code"),ii=n("optimization_level=1"),oi=n(" to enable basic optimizations such as constant folding or redundant node eliminations,"),ai=m(),me=o("li"),qe=o("code"),si=n("optimization_level=2"),ni=n(" to enable extended graph optimizations such as node fusions,"),li=m(),fe=o("li"),xe=o("code"),ri=n("optimization_level=99"),pi=n(" to enable data layout optimizations."),tt=m(),C=o("p"),mi=n(`Choosing a level enables the optimizations of that level, as well as the optimizations of all preceding levels.
More information `),W=o("a"),fi=n("here"),di=n("."),it=m(),Y=o("p"),Re=o("code"),ci=n("fuse_operators=True"),hi=n(` means that graph fusion is performed in addition to ONNX Runtime optimizations described above.
Here is the list of all the operator fusions you can enable:`),ot=m(),c=o("ul"),Z=o("li"),ui=n("Gelu fusion with "),Se=o("code"),_i=n("disable_gelu_fusion=False"),gi=n(","),zi=m(),ee=o("li"),vi=n("Layer Normalization fusion with "),Ne=o("code"),Oi=n("disable_layer_norm_fusion=False"),wi=n(","),bi=m(),te=o("li"),Ei=n("Attention fusion with "),Le=o("code"),yi=n("disable_attention_fusion=False"),ji=n(","),$i=m(),ie=o("li"),Ti=n("SkipLayerNormalization fusion with "),Fe=o("code"),ki=n("disable_skip_layer_norm_fusion=False"),Ci=n(","),qi=m(),oe=o("li"),xi=n("Add Bias and SkipLayerNormalization fusion with "),Ae=o("code"),Ri=n("disable_bias_skip_layer_norm_fusion=False"),Si=n(","),Ni=m(),ae=o("li"),Li=n("Add Bias and Gelu / FastGelu fusion with "),Me=o("code"),Fi=n("disable_bias_gelu_fusion=False"),Ai=n("."),at=m(),q=o("p"),Mi=n("All other optimization configuration options are detailed in "),de=o("a"),Pi=n("OptimizationConfig"),Xi=n("."),this.h()},l(e){const r=No('[data-svelte="svelte-1phssyn"]',document.head);z=a(r,"META",{name:!0,content:!0}),r.forEach(i),Pe=f(e),v=a(e,"H1",{class:!0});var nt=s(v);E=a(nt,"A",{id:!0,class:!0,href:!0});var Ki=s(E);ue=a(Ki,"SPAN",{});var Qi=s(ue);S(M.$$.fragment,Qi),Qi.forEach(i),Ki.forEach(i),Et=f(nt),_e=a(nt,"SPAN",{});var Vi=s(_e);yt=l(Vi,"Optimization"),Vi.forEach(i),nt.forEach(i),Xe=f(e),_=a(e,"P",{});var ce=s(_);jt=l(ce,"\u{1F917} Optimum provides an "),ge=a(ce,"CODE",{});var Wi=s(ge);$t=l(Wi,"optimum.onnxruntime"),Wi.forEach(i),Tt=l(ce," package that enables you to apply graph optimization on many model hosted on the \u{1F917} hub using the "),P=a(ce,"A",{href:!0,rel:!0});var Yi=s(P);kt=l(Yi,"ONNX Runtime"),Yi.forEach(i),Ct=l(ce," model optimization tool."),ce.forEach(i),De=f(e),O=a(e,"H2",{class:!0});var lt=s(O);y=a(lt,"A",{id:!0,class:!0,href:!0});var Zi=s(y);ze=a(Zi,"SPAN",{});var eo=s(ze);S(X.$$.fragment,eo),eo.forEach(i),Zi.forEach(i),qt=f(lt),se=a(lt,"SPAN",{});var Di=s(se);xt=l(Di,"Creating an "),ve=a(Di,"CODE",{});var to=s(ve);Rt=l(to,"ORTOptimizer"),to.forEach(i),Di.forEach(i),lt.forEach(i),Ie=f(e),g=a(e,"P",{});var he=s(g);St=l(he,"The "),Oe=a(he,"CODE",{});var io=s(Oe);Nt=l(io,"ORTOptimizer"),io.forEach(i),Lt=l(he," class is used to optimize your ONNX model. The class can be initialized using the "),we=a(he,"CODE",{});var oo=s(we);Ft=l(oo,"from_pretrained()"),oo.forEach(i),At=l(he," method, which supports different checkpoint formats."),he.forEach(i),Be=f(e),ne=a(e,"OL",{});var ao=s(ne);D=a(ao,"LI",{});var rt=s(D);Mt=l(rt,"Using an already initialized "),be=a(rt,"CODE",{});var so=s(be);Pt=l(so,"ORTModelForXXX"),so.forEach(i),Xt=l(rt," class."),rt.forEach(i),ao.forEach(i),Ge=f(e),S(I.$$.fragment,e),He=f(e),B=a(e,"OL",{start:!0});var no=s(B);Ee=a(no,"LI",{});var lo=s(Ee);Dt=l(lo,"Using a local ONNX model from a directory."),lo.forEach(i),no.forEach(i),Ue=f(e),S(G.$$.fragment,e),Je=f(e),w=a(e,"H2",{class:!0});var pt=s(w);j=a(pt,"A",{id:!0,class:!0,href:!0});var ro=s(j);ye=a(ro,"SPAN",{});var po=s(ye);S(H.$$.fragment,po),po.forEach(i),ro.forEach(i),It=f(pt),je=a(pt,"SPAN",{});var mo=s(je);Bt=l(mo,"Optimization examples"),mo.forEach(i),pt.forEach(i),Ke=f(e),$=a(e,"P",{});var mt=s($);Gt=l(mt,"Below you will find an easy end-to-end example on how to optimize "),U=a(mt,"A",{href:!0,rel:!0});var fo=s(U);Ht=l(fo,"distilbert-base-uncased-finetuned-sst-2-english"),fo.forEach(i),Ut=l(mt,"."),mt.forEach(i),Qe=f(e),S(J.$$.fragment,e),Ve=f(e),T=a(e,"P",{});var ft=s(T);Jt=l(ft,"Below you will find an easy end-to-end example on how to optimize a Seq2Seq model "),K=a(ft,"A",{href:!0,rel:!0});var co=s(K);Kt=l(co,"sshleifer/distilbart-cnn-12-6\u201D"),co.forEach(i),Qt=l(ft,"."),ft.forEach(i),We=f(e),S(Q.$$.fragment,e),Ye=f(e),b=a(e,"H2",{class:!0});var dt=s(b);k=a(dt,"A",{id:!0,class:!0,href:!0});var ho=s(k);$e=a(ho,"SPAN",{});var uo=s($e);S(V.$$.fragment,uo),uo.forEach(i),ho.forEach(i),Vt=f(dt),Te=a(dt,"SPAN",{});var _o=s(Te);Wt=l(_o,"Optimization Configuration"),_o.forEach(i),dt.forEach(i),Ze=f(e),le=a(e,"P",{});var go=s(le);Yt=l(go,"In the optimization configuration, there are 4 possible optimization levels:"),go.forEach(i),et=f(e),h=a(e,"UL",{});var x=s(h);re=a(x,"LI",{});var Ii=s(re);ke=a(Ii,"CODE",{});var zo=s(ke);Zt=l(zo,"optimization_level=0"),zo.forEach(i),ei=l(Ii," to disable all optimizations,"),Ii.forEach(i),ti=f(x),pe=a(x,"LI",{});var Bi=s(pe);Ce=a(Bi,"CODE",{});var vo=s(Ce);ii=l(vo,"optimization_level=1"),vo.forEach(i),oi=l(Bi," to enable basic optimizations such as constant folding or redundant node eliminations,"),Bi.forEach(i),ai=f(x),me=a(x,"LI",{});var Gi=s(me);qe=a(Gi,"CODE",{});var Oo=s(qe);si=l(Oo,"optimization_level=2"),Oo.forEach(i),ni=l(Gi," to enable extended graph optimizations such as node fusions,"),Gi.forEach(i),li=f(x),fe=a(x,"LI",{});var Hi=s(fe);xe=a(Hi,"CODE",{});var wo=s(xe);ri=l(wo,"optimization_level=99"),wo.forEach(i),pi=l(Hi," to enable data layout optimizations."),Hi.forEach(i),x.forEach(i),tt=f(e),C=a(e,"P",{});var ct=s(C);mi=l(ct,`Choosing a level enables the optimizations of that level, as well as the optimizations of all preceding levels.
More information `),W=a(ct,"A",{href:!0,rel:!0});var bo=s(W);fi=l(bo,"here"),bo.forEach(i),di=l(ct,"."),ct.forEach(i),it=f(e),Y=a(e,"P",{});var Ui=s(Y);Re=a(Ui,"CODE",{});var Eo=s(Re);ci=l(Eo,"fuse_operators=True"),Eo.forEach(i),hi=l(Ui,` means that graph fusion is performed in addition to ONNX Runtime optimizations described above.
Here is the list of all the operator fusions you can enable:`),Ui.forEach(i),ot=f(e),c=a(e,"UL",{});var u=s(c);Z=a(u,"LI",{});var ht=s(Z);ui=l(ht,"Gelu fusion with "),Se=a(ht,"CODE",{});var yo=s(Se);_i=l(yo,"disable_gelu_fusion=False"),yo.forEach(i),gi=l(ht,","),ht.forEach(i),zi=f(u),ee=a(u,"LI",{});var ut=s(ee);vi=l(ut,"Layer Normalization fusion with "),Ne=a(ut,"CODE",{});var jo=s(Ne);Oi=l(jo,"disable_layer_norm_fusion=False"),jo.forEach(i),wi=l(ut,","),ut.forEach(i),bi=f(u),te=a(u,"LI",{});var _t=s(te);Ei=l(_t,"Attention fusion with "),Le=a(_t,"CODE",{});var $o=s(Le);yi=l($o,"disable_attention_fusion=False"),$o.forEach(i),ji=l(_t,","),_t.forEach(i),$i=f(u),ie=a(u,"LI",{});var gt=s(ie);Ti=l(gt,"SkipLayerNormalization fusion with "),Fe=a(gt,"CODE",{});var To=s(Fe);ki=l(To,"disable_skip_layer_norm_fusion=False"),To.forEach(i),Ci=l(gt,","),gt.forEach(i),qi=f(u),oe=a(u,"LI",{});var zt=s(oe);xi=l(zt,"Add Bias and SkipLayerNormalization fusion with "),Ae=a(zt,"CODE",{});var ko=s(Ae);Ri=l(ko,"disable_bias_skip_layer_norm_fusion=False"),ko.forEach(i),Si=l(zt,","),zt.forEach(i),Ni=f(u),ae=a(u,"LI",{});var vt=s(ae);Li=l(vt,"Add Bias and Gelu / FastGelu fusion with "),Me=a(vt,"CODE",{});var Co=s(Me);Fi=l(Co,"disable_bias_gelu_fusion=False"),Co.forEach(i),Ai=l(vt,"."),vt.forEach(i),u.forEach(i),at=f(e),q=a(e,"P",{});var Ot=s(q);Mi=l(Ot,"All other optimization configuration options are detailed in "),de=a(Ot,"A",{href:!0});var qo=s(de);Pi=l(qo,"OptimizationConfig"),qo.forEach(i),Xi=l(Ot,"."),Ot.forEach(i),this.h()},h(){d(z,"name","hf:doc:metadata"),d(z,"content",JSON.stringify(Mo)),d(E,"id","optimization"),d(E,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(E,"href","#optimization"),d(v,"class","relative group"),d(P,"href","https://github.com/microsoft/onnxruntime/tree/master/onnxruntime/python/tools/transformers"),d(P,"rel","nofollow"),d(y,"id","creating-an-ortoptimizer"),d(y,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(y,"href","#creating-an-ortoptimizer"),d(O,"class","relative group"),d(B,"start","2"),d(j,"id","optimization-examples"),d(j,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(j,"href","#optimization-examples"),d(w,"class","relative group"),d(U,"href","https://huggingface.co/distilbert-base-uncased-finetuned-sst-2-english"),d(U,"rel","nofollow"),d(K,"href","https://huggingface.co/sshleifer/distilbart-cnn-12-6"),d(K,"rel","nofollow"),d(k,"id","optimization-configuration"),d(k,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(k,"href","#optimization-configuration"),d(b,"class","relative group"),d(W,"href","https://onnxruntime.ai/docs/performance/graph-optimizations.html"),d(W,"rel","nofollow"),d(de,"href","/docs/optimum/pr_412/en/onnxruntime/package_reference/configuration#optimum.onnxruntime.configuration.OptimizationConfig")},m(e,r){t(document.head,z),p(e,Pe,r),p(e,v,r),t(v,E),t(E,ue),N(M,ue,null),t(v,Et),t(v,_e),t(_e,yt),p(e,Xe,r),p(e,_,r),t(_,jt),t(_,ge),t(ge,$t),t(_,Tt),t(_,P),t(P,kt),t(_,Ct),p(e,De,r),p(e,O,r),t(O,y),t(y,ze),N(X,ze,null),t(O,qt),t(O,se),t(se,xt),t(se,ve),t(ve,Rt),p(e,Ie,r),p(e,g,r),t(g,St),t(g,Oe),t(Oe,Nt),t(g,Lt),t(g,we),t(we,Ft),t(g,At),p(e,Be,r),p(e,ne,r),t(ne,D),t(D,Mt),t(D,be),t(be,Pt),t(D,Xt),p(e,Ge,r),N(I,e,r),p(e,He,r),p(e,B,r),t(B,Ee),t(Ee,Dt),p(e,Ue,r),N(G,e,r),p(e,Je,r),p(e,w,r),t(w,j),t(j,ye),N(H,ye,null),t(w,It),t(w,je),t(je,Bt),p(e,Ke,r),p(e,$,r),t($,Gt),t($,U),t(U,Ht),t($,Ut),p(e,Qe,r),N(J,e,r),p(e,Ve,r),p(e,T,r),t(T,Jt),t(T,K),t(K,Kt),t(T,Qt),p(e,We,r),N(Q,e,r),p(e,Ye,r),p(e,b,r),t(b,k),t(k,$e),N(V,$e,null),t(b,Vt),t(b,Te),t(Te,Wt),p(e,Ze,r),p(e,le,r),t(le,Yt),p(e,et,r),p(e,h,r),t(h,re),t(re,ke),t(ke,Zt),t(re,ei),t(h,ti),t(h,pe),t(pe,Ce),t(Ce,ii),t(pe,oi),t(h,ai),t(h,me),t(me,qe),t(qe,si),t(me,ni),t(h,li),t(h,fe),t(fe,xe),t(xe,ri),t(fe,pi),p(e,tt,r),p(e,C,r),t(C,mi),t(C,W),t(W,fi),t(C,di),p(e,it,r),p(e,Y,r),t(Y,Re),t(Re,ci),t(Y,hi),p(e,ot,r),p(e,c,r),t(c,Z),t(Z,ui),t(Z,Se),t(Se,_i),t(Z,gi),t(c,zi),t(c,ee),t(ee,vi),t(ee,Ne),t(Ne,Oi),t(ee,wi),t(c,bi),t(c,te),t(te,Ei),t(te,Le),t(Le,yi),t(te,ji),t(c,$i),t(c,ie),t(ie,Ti),t(ie,Fe),t(Fe,ki),t(ie,Ci),t(c,qi),t(c,oe),t(oe,xi),t(oe,Ae),t(Ae,Ri),t(oe,Si),t(c,Ni),t(c,ae),t(ae,Li),t(ae,Me),t(Me,Fi),t(ae,Ai),p(e,at,r),p(e,q,r),t(q,Mi),t(q,de),t(de,Pi),t(q,Xi),st=!0},p:Lo,i(e){st||(L(M.$$.fragment,e),L(X.$$.fragment,e),L(I.$$.fragment,e),L(G.$$.fragment,e),L(H.$$.fragment,e),L(J.$$.fragment,e),L(Q.$$.fragment,e),L(V.$$.fragment,e),st=!0)},o(e){F(M.$$.fragment,e),F(X.$$.fragment,e),F(I.$$.fragment,e),F(G.$$.fragment,e),F(H.$$.fragment,e),F(J.$$.fragment,e),F(Q.$$.fragment,e),F(V.$$.fragment,e),st=!1},d(e){i(z),e&&i(Pe),e&&i(v),A(M),e&&i(Xe),e&&i(_),e&&i(De),e&&i(O),A(X),e&&i(Ie),e&&i(g),e&&i(Be),e&&i(ne),e&&i(Ge),A(I,e),e&&i(He),e&&i(B),e&&i(Ue),A(G,e),e&&i(Je),e&&i(w),A(H),e&&i(Ke),e&&i($),e&&i(Qe),A(J,e),e&&i(Ve),e&&i(T),e&&i(We),A(Q,e),e&&i(Ye),e&&i(b),A(V),e&&i(Ze),e&&i(le),e&&i(et),e&&i(h),e&&i(tt),e&&i(C),e&&i(it),e&&i(Y),e&&i(ot),e&&i(c),e&&i(at),e&&i(q)}}}const Mo={local:"optimization",sections:[{local:"creating-an-ortoptimizer",title:"Creating an `ORTOptimizer`"},{local:"optimization-examples",title:"Optimization examples"},{local:"optimization-configuration",title:"Optimization Configuration"}],title:"Optimization"};function Po(Ji){return Fo(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Bo extends xo{constructor(z){super();Ro(this,z,Po,Ao,So,{})}}export{Bo as default,Mo as metadata};
