import{S as gi,i as ui,s as _i,e as r,k as c,w as b,t as n,M as vi,c as a,d as t,m as d,a as s,x as y,h as l,b as i,N as bi,G as e,g as p,y as w,q as P,o as T,B as F,v as yi,L as zn}from"../../chunks/vendor-hf-doc-builder.js";import{T as hi}from"../../chunks/Tip-hf-doc-builder.js";import{D as ce}from"../../chunks/Docstring-hf-doc-builder.js";import{C as kn}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as ke}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as xn}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as wi}from"../../chunks/PipelineTag-hf-doc-builder.js";function Pi(j){let h,$,_,g,v;return g=new kn({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFBvb2xGb3JtZXJDb25maWclMkMlMjBQb29sRm9ybWVyTW9kZWwlMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwUG9vbEZvcm1lciUyMHNhaWwlMkZwb29sZm9ybWVyX3MxMiUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBQb29sRm9ybWVyQ29uZmlnKCklMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwbW9kZWwlMjAod2l0aCUyMHJhbmRvbSUyMHdlaWdodHMpJTIwZnJvbSUyMHRoZSUyMHNhaWwlMkZwb29sZm9ybWVyX3MxMiUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsJTIwJTNEJTIwUG9vbEZvcm1lck1vZGVsKGNvbmZpZ3VyYXRpb24pJTBBJTBBJTIzJTIwQWNjZXNzaW5nJTIwdGhlJTIwbW9kZWwlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMG1vZGVsLmNvbmZpZw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> PoolFormerConfig, PoolFormerModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a PoolFormer sail/poolformer_s12 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = PoolFormerConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the sail/poolformer_s12 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = PoolFormerModel(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`}}),{c(){h=r("p"),$=n("Example:"),_=c(),b(g.$$.fragment)},l(m){h=a(m,"P",{});var u=s(h);$=l(u,"Example:"),u.forEach(t),_=d(m),y(g.$$.fragment,m)},m(m,u){p(m,h,u),e(h,$),p(m,_,u),w(g,m,u),v=!0},p:zn,i(m){v||(P(g.$$.fragment,m),v=!0)},o(m){T(g.$$.fragment,m),v=!1},d(m){m&&t(h),m&&t(_),F(g,m)}}}function Ti(j){let h,$,_,g,v;return{c(){h=r("p"),$=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r("code"),g=n("Module"),v=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(m){h=a(m,"P",{});var u=s(h);$=l(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a(u,"CODE",{});var W=s(_);g=l(W,"Module"),W.forEach(t),v=l(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(m,u){p(m,h,u),e(h,$),e(h,_),e(_,g),e(h,v)},d(m){m&&t(h)}}}function Fi(j){let h,$,_,g,v;return g=new kn({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFBvb2xGb3JtZXJNb2RlbCUwQWltcG9ydCUyMHRvcmNoJTBBZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBZGF0YXNldCUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJodWdnaW5nZmFjZSUyRmNhdHMtaW1hZ2UlMjIpJTBBaW1hZ2UlMjAlM0QlMjBkYXRhc2V0JTVCJTIydGVzdCUyMiU1RCU1QiUyMmltYWdlJTIyJTVEJTVCMCU1RCUwQSUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMEF1dG9JbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyc2FpbCUyRnBvb2xmb3JtZXJfczEyJTIyKSUwQW1vZGVsJTIwJTNEJTIwUG9vbEZvcm1lck1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJzYWlsJTJGcG9vbGZvcm1lcl9zMTIlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwaW1hZ2VfcHJvY2Vzc29yKGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQSUwQWxhc3RfaGlkZGVuX3N0YXRlcyUyMCUzRCUyMG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGUlMEFsaXN0KGxhc3RfaGlkZGVuX3N0YXRlcy5zaGFwZSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, PoolFormerModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;huggingface/cats-image&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = dataset[<span class="hljs-string">&quot;test&quot;</span>][<span class="hljs-string">&quot;image&quot;</span>][<span class="hljs-number">0</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;sail/poolformer_s12&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = PoolFormerModel.from_pretrained(<span class="hljs-string">&quot;sail/poolformer_s12&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(last_hidden_states.shape)
[<span class="hljs-number">1</span>, <span class="hljs-number">512</span>, <span class="hljs-number">7</span>, <span class="hljs-number">7</span>]`}}),{c(){h=r("p"),$=n("Example:"),_=c(),b(g.$$.fragment)},l(m){h=a(m,"P",{});var u=s(h);$=l(u,"Example:"),u.forEach(t),_=d(m),y(g.$$.fragment,m)},m(m,u){p(m,h,u),e(h,$),p(m,_,u),w(g,m,u),v=!0},p:zn,i(m){v||(P(g.$$.fragment,m),v=!0)},o(m){T(g.$$.fragment,m),v=!1},d(m){m&&t(h),m&&t(_),F(g,m)}}}function $i(j){let h,$,_,g,v;return{c(){h=r("p"),$=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r("code"),g=n("Module"),v=n(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(m){h=a(m,"P",{});var u=s(h);$=l(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a(u,"CODE",{});var W=s(_);g=l(W,"Module"),W.forEach(t),v=l(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(m,u){p(m,h,u),e(h,$),e(h,_),e(_,g),e(h,v)},d(m){m&&t(h)}}}function Ei(j){let h,$,_,g,v;return g=new kn({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFBvb2xGb3JtZXJGb3JJbWFnZUNsYXNzaWZpY2F0aW9uJTBBaW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGF0YXNldHMlMjBpbXBvcnQlMjBsb2FkX2RhdGFzZXQlMEElMEFkYXRhc2V0JTIwJTNEJTIwbG9hZF9kYXRhc2V0KCUyMmh1Z2dpbmdmYWNlJTJGY2F0cy1pbWFnZSUyMiklMEFpbWFnZSUyMCUzRCUyMGRhdGFzZXQlNUIlMjJ0ZXN0JTIyJTVEJTVCJTIyaW1hZ2UlMjIlNUQlNUIwJTVEJTBBJTBBaW1hZ2VfcHJvY2Vzc29yJTIwJTNEJTIwQXV0b0ltYWdlUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJzYWlsJTJGcG9vbGZvcm1lcl9zMTIlMjIpJTBBbW9kZWwlMjAlM0QlMjBQb29sRm9ybWVyRm9ySW1hZ2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyc2FpbCUyRnBvb2xmb3JtZXJfczEyJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMGltYWdlX3Byb2Nlc3NvcihpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBd2l0aCUyMHRvcmNoLm5vX2dyYWQoKSUzQSUwQSUyMCUyMCUyMCUyMGxvZ2l0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKS5sb2dpdHMlMEElMEElMjMlMjBtb2RlbCUyMHByZWRpY3RzJTIwb25lJTIwb2YlMjB0aGUlMjAxMDAwJTIwSW1hZ2VOZXQlMjBjbGFzc2VzJTBBcHJlZGljdGVkX2xhYmVsJTIwJTNEJTIwbG9naXRzLmFyZ21heCgtMSkuaXRlbSgpJTBBcHJpbnQobW9kZWwuY29uZmlnLmlkMmxhYmVsJTVCcHJlZGljdGVkX2xhYmVsJTVEKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, PoolFormerForImageClassification
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

<span class="hljs-meta">&gt;&gt;&gt; </span>dataset = load_dataset(<span class="hljs-string">&quot;huggingface/cats-image&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = dataset[<span class="hljs-string">&quot;test&quot;</span>][<span class="hljs-string">&quot;image&quot;</span>][<span class="hljs-number">0</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;sail/poolformer_s12&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = PoolFormerForImageClassification.from_pretrained(<span class="hljs-string">&quot;sail/poolformer_s12&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    logits = model(**inputs).logits

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># model predicts one of the 1000 ImageNet classes</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_label = logits.argmax(-<span class="hljs-number">1</span>).item()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(model.config.id2label[predicted_label])
tabby, tabby cat`}}),{c(){h=r("p"),$=n("Example:"),_=c(),b(g.$$.fragment)},l(m){h=a(m,"P",{});var u=s(h);$=l(u,"Example:"),u.forEach(t),_=d(m),y(g.$$.fragment,m)},m(m,u){p(m,h,u),e(h,$),p(m,_,u),w(g,m,u),v=!0},p:zn,i(m){v||(P(g.$$.fragment,m),v=!0)},o(m){T(g.$$.fragment,m),v=!1},d(m){m&&t(h),m&&t(_),F(g,m)}}}function Mi(j){let h,$,_,g,v,m,u,W,Jr,St,O,de,ot,Je,Nr,tt,jr,Vt,me,Ur,Ne,Ar,Wr,qt,go,Rr,Lt,uo,rt,Zr,Ht,fe,Br,je,Gr,Dr,Xt,Ue,Jn,Yt,_o,Sr,Ot,B,Ae,Vr,We,qr,Lr,Hr,Re,Xr,vo,Yr,Or,Qr,at,Kr,Qt,pe,st,E,bo,nt,ea,oa,lt,it,ta,ra,ct,dt,aa,sa,yo,mt,na,la,wo,ft,ia,ca,M,I,Po,da,ma,pt,fa,pa,ht,ha,ga,To,ua,_a,Fo,va,ba,C,$o,ya,wa,gt,Pa,Ta,ut,Fa,$a,Eo,Ea,Ma,Mo,Ia,Ca,x,Io,xa,za,_t,ka,Ja,vt,Na,ja,Co,Ua,Aa,xo,Wa,Ra,z,zo,Za,Ba,bt,Ga,Da,yt,Sa,Va,ko,qa,La,Jo,Ha,Xa,k,No,Ya,Oa,wt,Qa,Ka,Pt,es,os,jo,ts,rs,Uo,as,Kt,G,ss,Ze,ns,ls,Be,is,cs,er,Q,he,Tt,Ge,ds,Ft,ms,or,Ao,fs,tr,De,rr,ge,D,Wo,ps,hs,Se,gs,us,Ve,_s,vs,bs,Ro,ys,Zo,ws,ar,Bo,Ps,sr,K,ue,$t,qe,Ts,Et,Fs,nr,J,Le,$s,ee,Es,Go,Ms,Is,He,Cs,xs,zs,oe,ks,Do,Js,Ns,So,js,Us,As,_e,lr,te,ve,Mt,Xe,Ws,It,Rs,ir,re,Ye,Zs,be,Oe,Bs,Ct,Gs,cr,ae,ye,xt,Qe,Ds,zt,Ss,dr,R,Ke,Vs,kt,qs,Ls,we,eo,Hs,Jt,Xs,mr,se,Pe,Nt,oo,Ys,jt,Os,fr,Z,to,Qs,ro,Ks,ao,en,on,tn,U,so,rn,ne,an,Vo,sn,nn,Ut,ln,cn,dn,Te,mn,Fe,pr,le,$e,At,no,fn,Wt,pn,hr,N,lo,hn,Rt,gn,un,io,_n,co,vn,bn,yn,A,mo,wn,ie,Pn,qo,Tn,Fn,Zt,$n,En,Mn,Ee,In,Me,gr;return m=new ke({}),Je=new ke({}),Ge=new ke({}),De=new wi({props:{pipeline:"image-classification"}}),qe=new ke({}),Le=new ce({props:{name:"class transformers.PoolFormerConfig",anchor:"transformers.PoolFormerConfig",parameters:[{name:"num_channels",val:" = 3"},{name:"patch_size",val:" = 16"},{name:"stride",val:" = 16"},{name:"pool_size",val:" = 3"},{name:"mlp_ratio",val:" = 4.0"},{name:"depths",val:" = [2, 2, 6, 2]"},{name:"hidden_sizes",val:" = [64, 128, 320, 512]"},{name:"patch_sizes",val:" = [7, 3, 3, 3]"},{name:"strides",val:" = [4, 2, 2, 2]"},{name:"padding",val:" = [2, 1, 1, 1]"},{name:"num_encoder_blocks",val:" = 4"},{name:"drop_path_rate",val:" = 0.0"},{name:"hidden_act",val:" = 'gelu'"},{name:"use_layer_scale",val:" = True"},{name:"layer_scale_init_value",val:" = 1e-05"},{name:"initializer_range",val:" = 0.02"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.PoolFormerConfig.num_channels",description:`<strong>num_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 3) &#x2014;
The number of channels in the input image.`,name:"num_channels"},{anchor:"transformers.PoolFormerConfig.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
The size of the input patch.`,name:"patch_size"},{anchor:"transformers.PoolFormerConfig.stride",description:`<strong>stride</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
The stride of the input patch.`,name:"stride"},{anchor:"transformers.PoolFormerConfig.pool_size",description:`<strong>pool_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3) &#x2014;
The size of the pooling window.`,name:"pool_size"},{anchor:"transformers.PoolFormerConfig.mlp_ratio",description:`<strong>mlp_ratio</strong> (<code>float</code>, <em>optional</em>, defaults to 4.0) &#x2014;
The ratio of the number of channels in the output of the MLP to the number of channels in the input.`,name:"mlp_ratio"},{anchor:"transformers.PoolFormerConfig.depths",description:`<strong>depths</strong> (<code>list</code>, <em>optional</em>, defaults to <code>[2, 2, 6, 2]</code>) &#x2014;
The depth of each encoder block.`,name:"depths"},{anchor:"transformers.PoolFormerConfig.hidden_sizes",description:`<strong>hidden_sizes</strong> (<code>list</code>, <em>optional</em>, defaults to <code>[64, 128, 320, 512]</code>) &#x2014;
The hidden sizes of each encoder block.`,name:"hidden_sizes"},{anchor:"transformers.PoolFormerConfig.patch_sizes",description:`<strong>patch_sizes</strong> (<code>list</code>, <em>optional</em>, defaults to <code>[7, 3, 3, 3]</code>) &#x2014;
The size of the input patch for each encoder block.`,name:"patch_sizes"},{anchor:"transformers.PoolFormerConfig.strides",description:`<strong>strides</strong> (<code>list</code>, <em>optional</em>, defaults to <code>[4, 2, 2, 2]</code>) &#x2014;
The stride of the input patch for each encoder block.`,name:"strides"},{anchor:"transformers.PoolFormerConfig.padding",description:`<strong>padding</strong> (<code>list</code>, <em>optional</em>, defaults to <code>[2, 1, 1, 1]</code>) &#x2014;
The padding of the input patch for each encoder block.`,name:"padding"},{anchor:"transformers.PoolFormerConfig.num_encoder_blocks",description:`<strong>num_encoder_blocks</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
The number of encoder blocks.`,name:"num_encoder_blocks"},{anchor:"transformers.PoolFormerConfig.drop_path_rate",description:`<strong>drop_path_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout rate for the dropout layers.`,name:"drop_path_rate"},{anchor:"transformers.PoolFormerConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;gelu&quot;</code>) &#x2014;
The activation function for the hidden layers.`,name:"hidden_act"},{anchor:"transformers.PoolFormerConfig.use_layer_scale",description:`<strong>use_layer_scale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to use layer scale.`,name:"use_layer_scale"},{anchor:"transformers.PoolFormerConfig.layer_scale_init_value",description:`<strong>layer_scale_init_value</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-5) &#x2014;
The initial value for the layer scale.`,name:"layer_scale_init_value"},{anchor:"transformers.PoolFormerConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The initializer range for the weights.`,name:"initializer_range"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/poolformer/configuration_poolformer.py#L34"}}),_e=new xn({props:{anchor:"transformers.PoolFormerConfig.example",$$slots:{default:[Pi]},$$scope:{ctx:j}}}),Xe=new ke({}),Ye=new ce({props:{name:"class transformers.PoolFormerFeatureExtractor",anchor:"transformers.PoolFormerFeatureExtractor",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/poolformer/feature_extraction_poolformer.py#L26"}}),Oe=new ce({props:{name:"__call__",anchor:"transformers.PoolFormerFeatureExtractor.__call__",parameters:[{name:"images",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/image_processing_utils.py#L516"}}),Qe=new ke({}),Ke=new ce({props:{name:"class transformers.PoolFormerImageProcessor",anchor:"transformers.PoolFormerImageProcessor",parameters:[{name:"do_resize",val:": bool = True"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"crop_pct",val:": int = 0.9"},{name:"resample",val:": Resampling = <Resampling.BICUBIC: 3>"},{name:"do_center_crop",val:": bool = True"},{name:"crop_size",val:": typing.Dict[str, int] = None"},{name:"rescale_factor",val:": typing.Union[int, float] = 0.00392156862745098"},{name:"do_rescale",val:": bool = True"},{name:"do_normalize",val:": bool = True"},{name:"image_mean",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.PoolFormerImageProcessor.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to resize the image&#x2019;s (height, width) dimensions to the specified <code>size</code>. Can be overridden by
<code>do_resize</code> in the <code>preprocess</code> method.`,name:"do_resize"},{anchor:"transformers.PoolFormerImageProcessor.size",description:`<strong>size</strong> (<code>Dict[str, int]</code> <em>optional</em>, defaults to <code>{&quot;shortest_edge&quot; -- 224}</code>):
Size of the image after resizing. Can be overridden by <code>size</code> in the <code>preprocess</code> method. If crop_pct is
unset:</p>
<ul>
<li>size is <code>{&quot;height&quot;: h, &quot;width&quot;: w}</code>: the image is resized to <code>(h, w)</code>.</li>
<li>size is <code>{&quot;shortest_edge&quot;: s}</code>: the shortest edge of the image is resized to s whilst maintaining the
aspect ratio.</li>
</ul>
<p>If crop_pct is set:</p>
<ul>
<li>size is <code>{&quot;height&quot;: h, &quot;width&quot;: w}</code>: the image is resized to <code>(int(floor(h/crop_pct)), int(floor(w/crop_pct)))</code></li>
<li>size is <code>{&quot;height&quot;: c, &quot;width&quot;: c}</code>: the shortest edge of the image is resized to <code>int(floor(c/crop_pct)</code>
whilst maintaining the aspect ratio.</li>
<li>size is <code>{&quot;shortest_edge&quot;: c}</code>: the shortest edge of the image is resized to <code>int(floor(c/crop_pct)</code>
whilst maintaining the aspect ratio.</li>
</ul>`,name:"size"},{anchor:"transformers.PoolFormerImageProcessor.crop_pct",description:`<strong>crop_pct</strong> (<code>float</code>, <em>optional</em>, defaults to <code>0.9</code>) &#x2014;
Percentage of the image to crop from the center. Can be overridden by <code>crop_pct</code> in the <code>preprocess</code>
method.`,name:"crop_pct"},{anchor:"transformers.PoolFormerImageProcessor.resample",description:`<strong>resample</strong> (<code>PILImageResampling</code>, <em>optional</em>, defaults to <code>PILImageResampling.BICUBIC</code>) &#x2014;
Resampling filter to use if resizing the image. Can be overridden by <code>resample</code> in the <code>preprocess</code> method.`,name:"resample"},{anchor:"transformers.PoolFormerImageProcessor.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to center crop the image. If the input size is smaller than <code>crop_size</code> along any edge, the image
is padded with 0&#x2019;s and then center cropped. Can be overridden by <code>do_center_crop</code> in the <code>preprocess</code>
method.`,name:"do_center_crop"},{anchor:"transformers.PoolFormerImageProcessor.crop_size",description:`<strong>crop_size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>{&quot;height&quot; -- 224, &quot;width&quot;: 224}</code>):
Size of the image after applying center crop. Only has an effect if <code>do_center_crop</code> is set to <code>True</code>. Can
be overridden by the <code>crop_size</code> parameter in the <code>preprocess</code> method.`,name:"crop_size"},{anchor:"transformers.PoolFormerImageProcessor.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to rescale the image by the specified scale <code>rescale_factor</code>. Can be overridden by the <code>do_rescale</code>
parameter in the <code>preprocess</code> method.`,name:"do_rescale"},{anchor:"transformers.PoolFormerImageProcessor.rescale_factor",description:`<strong>rescale_factor</strong> (<code>int</code> or <code>float</code>, <em>optional</em>, defaults to <code>1/255</code>) &#x2014;
Scale factor to use if rescaling the image. Can be overridden by the <code>rescale_factor</code> parameter in the
<code>preprocess</code> method.`,name:"rescale_factor"},{anchor:"transformers.PoolFormerImageProcessor.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Controls whether to normalize the image. Can be overridden by the <code>do_normalize</code> parameter in the
<code>preprocess</code> method.`,name:"do_normalize"},{anchor:"transformers.PoolFormerImageProcessor.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>IMAGENET_STANDARD_MEAN</code>) &#x2014;
Mean to use if normalizing the image. This is a float or list of floats the length of the number of
channels in the image. Can be overridden by the <code>image_mean</code> parameter in the <code>preprocess</code> method.`,name:"image_mean"},{anchor:"transformers.PoolFormerImageProcessor.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>IMAGENET_STANDARD_STD</code>) &#x2014;
Standard deviation to use if normalizing the image. This is a float or list of floats the length of the
number of channels in the image. Can be overridden by the <code>image_std</code> parameter in the <code>preprocess</code> method.`,name:"image_std"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/poolformer/image_processing_poolformer.py#L47"}}),eo=new ce({props:{name:"preprocess",anchor:"transformers.PoolFormerImageProcessor.preprocess",parameters:[{name:"images",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), typing.List[ForwardRef('PIL.Image.Image')], typing.List[numpy.ndarray], typing.List[ForwardRef('torch.Tensor')]]"},{name:"do_resize",val:": bool = None"},{name:"size",val:": typing.Dict[str, int] = None"},{name:"crop_pct",val:": int = None"},{name:"resample",val:": Resampling = None"},{name:"do_center_crop",val:": bool = None"},{name:"crop_size",val:": typing.Dict[str, int] = None"},{name:"do_rescale",val:": bool = None"},{name:"rescale_factor",val:": float = None"},{name:"do_normalize",val:": bool = None"},{name:"image_mean",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"image_std",val:": typing.Union[float, typing.List[float], NoneType] = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"data_format",val:": ChannelDimension = <ChannelDimension.FIRST: 'channels_first'>"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.PoolFormerImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
Image to preprocess.`,name:"images"},{anchor:"transformers.PoolFormerImageProcessor.preprocess.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_resize</code>) &#x2014;
Whether to resize the image.`,name:"do_resize"},{anchor:"transformers.PoolFormerImageProcessor.preprocess.size",description:`<strong>size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.size</code>) &#x2014;
Size of the image after applying resize.`,name:"size"},{anchor:"transformers.PoolFormerImageProcessor.preprocess.crop_pct",description:`<strong>crop_pct</strong> (<code>float</code>, <em>optional</em>, defaults to <code>self.crop_pct</code>) &#x2014;
Percentage of the image to crop. Only has an effect if <code>do_resize</code> is set to <code>True</code>.`,name:"crop_pct"},{anchor:"transformers.PoolFormerImageProcessor.preprocess.resample",description:`<strong>resample</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.resample</code>) &#x2014;
Resampling filter to use if resizing the image. This can be one of the enum <code>PILImageResampling</code>, Only
has an effect if <code>do_resize</code> is set to <code>True</code>.`,name:"resample"},{anchor:"transformers.PoolFormerImageProcessor.preprocess.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_center_crop</code>) &#x2014;
Whether to center crop the image.`,name:"do_center_crop"},{anchor:"transformers.PoolFormerImageProcessor.preprocess.crop_size",description:`<strong>crop_size</strong> (<code>Dict[str, int]</code>, <em>optional</em>, defaults to <code>self.crop_size</code>) &#x2014;
Size of the image after applying center crop.`,name:"crop_size"},{anchor:"transformers.PoolFormerImageProcessor.preprocess.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_rescale</code>) &#x2014;
Whether to rescale the image values between [0 - 1].`,name:"do_rescale"},{anchor:"transformers.PoolFormerImageProcessor.preprocess.rescale_factor",description:`<strong>rescale_factor</strong> (<code>float</code>, <em>optional</em>, defaults to <code>self.rescale_factor</code>) &#x2014;
Rescale factor to rescale the image by if <code>do_rescale</code> is set to <code>True</code>.`,name:"rescale_factor"},{anchor:"transformers.PoolFormerImageProcessor.preprocess.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_normalize</code>) &#x2014;
Whether to normalize the image.`,name:"do_normalize"},{anchor:"transformers.PoolFormerImageProcessor.preprocess.image_mean",description:`<strong>image_mean</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_mean</code>) &#x2014;
Image mean.`,name:"image_mean"},{anchor:"transformers.PoolFormerImageProcessor.preprocess.image_std",description:`<strong>image_std</strong> (<code>float</code> or <code>List[float]</code>, <em>optional</em>, defaults to <code>self.image_std</code>) &#x2014;
Image standard deviation.`,name:"image_std"},{anchor:"transformers.PoolFormerImageProcessor.preprocess.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <code>TensorType</code>, <em>optional</em>) &#x2014;
The type of tensors to return. Can be one of:<ul>
<li>Unset: Return a list of <code>np.ndarray</code>.</li>
<li><code>TensorType.TENSORFLOW</code> or <code>&apos;tf&apos;</code>: Return a batch of type <code>tf.Tensor</code>.</li>
<li><code>TensorType.PYTORCH</code> or <code>&apos;pt&apos;</code>: Return a batch of type <code>torch.Tensor</code>.</li>
<li><code>TensorType.NUMPY</code> or <code>&apos;np&apos;</code>: Return a batch of type <code>np.ndarray</code>.</li>
<li><code>TensorType.JAX</code> or <code>&apos;jax&apos;</code>: Return a batch of type <code>jax.numpy.ndarray</code>.</li>
</ul>`,name:"return_tensors"},{anchor:"transformers.PoolFormerImageProcessor.preprocess.data_format",description:`<strong>data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>ChannelDimension.FIRST</code>) &#x2014;
The channel dimension format for the output image. Can be one of:<ul>
<li><code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
</ul>`,name:"data_format"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/poolformer/image_processing_poolformer.py#L195"}}),oo=new ke({}),to=new ce({props:{name:"class transformers.PoolFormerModel",anchor:"transformers.PoolFormerModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.PoolFormerModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/poolformer#transformers.PoolFormerConfig">PoolFormerConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/poolformer/modeling_poolformer.py#L313"}}),so=new ce({props:{name:"forward",anchor:"transformers.PoolFormerModel.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.PoolFormerModel.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/main/en/model_doc/levit#transformers.LevitFeatureExtractor.__call__">PoolFormerImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/poolformer/modeling_poolformer.py#L326",returnDescription:`
<p>A <code>transformers.modeling_outputs.BaseModelOutputWithNoAttention</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/poolformer#transformers.PoolFormerConfig"
>PoolFormerConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, num_channels, height, width)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
</ul>
`,returnType:`
<p><code>transformers.modeling_outputs.BaseModelOutputWithNoAttention</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Te=new hi({props:{$$slots:{default:[Ti]},$$scope:{ctx:j}}}),Fe=new xn({props:{anchor:"transformers.PoolFormerModel.forward.example",$$slots:{default:[Fi]},$$scope:{ctx:j}}}),no=new ke({}),lo=new ce({props:{name:"class transformers.PoolFormerForImageClassification",anchor:"transformers.PoolFormerForImageClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.PoolFormerForImageClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/poolformer#transformers.PoolFormerConfig">PoolFormerConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/poolformer/modeling_poolformer.py#L380"}}),mo=new ce({props:{name:"forward",anchor:"transformers.PoolFormerForImageClassification.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.PoolFormerForImageClassification.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/main/en/model_doc/levit#transformers.LevitFeatureExtractor.__call__">PoolFormerImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.PoolFormerForImageClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the image classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/poolformer/modeling_poolformer.py#L396",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutputWithNoAttention"
>transformers.modeling_outputs.ImageClassifierOutputWithNoAttention</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/poolformer#transformers.PoolFormerConfig"
>PoolFormerConfig</a>) and inputs.</p>
<ul>
<li><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Classification (or regression if config.num_labels==1) loss.</li>
<li><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) \u2014 Classification (or regression if config.num_labels==1) scores (before SoftMax).</li>
<li><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each stage) of shape <code>(batch_size, num_channels, height, width)</code>. Hidden-states (also
called feature maps) of the model at the output of each stage.</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutputWithNoAttention"
>transformers.modeling_outputs.ImageClassifierOutputWithNoAttention</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ee=new hi({props:{$$slots:{default:[$i]},$$scope:{ctx:j}}}),Me=new xn({props:{anchor:"transformers.PoolFormerForImageClassification.forward.example",$$slots:{default:[Ei]},$$scope:{ctx:j}}}),{c(){h=r("meta"),$=c(),_=r("h1"),g=r("a"),v=r("span"),b(m.$$.fragment),u=c(),W=r("span"),Jr=n("PoolFormer"),St=c(),O=r("h2"),de=r("a"),ot=r("span"),b(Je.$$.fragment),Nr=c(),tt=r("span"),jr=n("Overview"),Vt=c(),me=r("p"),Ur=n("The PoolFormer model was proposed in "),Ne=r("a"),Ar=n("MetaFormer is Actually What You Need for Vision"),Wr=n("  by Sea AI Labs. Instead of designing complicated token mixer to achieve SOTA performance, the target of this work is to demonstrate the competence of transformer models largely stem from the general architecture MetaFormer."),qt=c(),go=r("p"),Rr=n("The abstract from the paper is the following:"),Lt=c(),uo=r("p"),rt=r("em"),Zr=n("Transformers have shown great potential in computer vision tasks. A common belief is their attention-based token mixer module contributes most to their competence. However, recent works show the attention-based module in transformers can be replaced by spatial MLPs and the resulted models still perform quite well. Based on this observation, we hypothesize that the general architecture of the transformers, instead of the specific token mixer module, is more essential to the model\u2019s performance. To verify this, we deliberately replace the attention module in transformers with an embarrassingly simple spatial pooling operator to conduct only the most basic token mixing. Surprisingly, we observe that the derived model, termed as PoolFormer, achieves competitive performance on multiple computer vision tasks. For example, on ImageNet-1K, PoolFormer achieves 82.1% top-1 accuracy, surpassing well-tuned vision transformer/MLP-like baselines DeiT-B/ResMLP-B24 by 0.3%/1.1% accuracy with 35%/52% fewer parameters and 48%/60% fewer MACs. The effectiveness of PoolFormer verifies our hypothesis and urges us to initiate the concept of \u201CMetaFormer\u201D, a general architecture abstracted from transformers without specifying the token mixer. Based on the extensive experiments, we argue that MetaFormer is the key player in achieving superior results for recent transformer and MLP-like models on vision tasks. This work calls for more future research dedicated to improving MetaFormer instead of focusing on the token mixer modules. Additionally, our proposed PoolFormer could serve as a starting baseline for future MetaFormer architecture design."),Ht=c(),fe=r("p"),Br=n("The figure below illustrates the architecture of PoolFormer. Taken from the "),je=r("a"),Gr=n("original paper"),Dr=n("."),Xt=c(),Ue=r("img"),Yt=c(),_o=r("p"),Sr=n("Tips:"),Ot=c(),B=r("ul"),Ae=r("li"),Vr=n("PoolFormer has a hierarchical architecture, where instead of Attention, a simple Average Pooling layer is present. All checkpoints of the model can be found on the "),We=r("a"),qr=n("hub"),Lr=n("."),Hr=c(),Re=r("li"),Xr=n("One can use "),vo=r("a"),Yr=n("PoolFormerImageProcessor"),Or=n(" to prepare images for the model."),Qr=c(),at=r("li"),Kr=n("As most models, PoolFormer comes in different sizes, the details of which can be found in the table below."),Qt=c(),pe=r("table"),st=r("thead"),E=r("tr"),bo=r("th"),nt=r("strong"),ea=n("Model variant"),oa=c(),lt=r("th"),it=r("strong"),ta=n("Depths"),ra=c(),ct=r("th"),dt=r("strong"),aa=n("Hidden sizes"),sa=c(),yo=r("th"),mt=r("strong"),na=n("Params (M)"),la=c(),wo=r("th"),ft=r("strong"),ia=n("ImageNet-1k Top 1"),ca=c(),M=r("tbody"),I=r("tr"),Po=r("td"),da=n("s12"),ma=c(),pt=r("td"),fa=n("[2, 2, 6, 2]"),pa=c(),ht=r("td"),ha=n("[64, 128, 320, 512]"),ga=c(),To=r("td"),ua=n("12"),_a=c(),Fo=r("td"),va=n("77.2"),ba=c(),C=r("tr"),$o=r("td"),ya=n("s24"),wa=c(),gt=r("td"),Pa=n("[4, 4, 12, 4]"),Ta=c(),ut=r("td"),Fa=n("[64, 128, 320, 512]"),$a=c(),Eo=r("td"),Ea=n("21"),Ma=c(),Mo=r("td"),Ia=n("80.3"),Ca=c(),x=r("tr"),Io=r("td"),xa=n("s36"),za=c(),_t=r("td"),ka=n("[6, 6, 18, 6]"),Ja=c(),vt=r("td"),Na=n("[64, 128, 320, 512]"),ja=c(),Co=r("td"),Ua=n("31"),Aa=c(),xo=r("td"),Wa=n("81.4"),Ra=c(),z=r("tr"),zo=r("td"),Za=n("m36"),Ba=c(),bt=r("td"),Ga=n("[6, 6, 18, 6]"),Da=c(),yt=r("td"),Sa=n("[96, 192, 384, 768]"),Va=c(),ko=r("td"),qa=n("56"),La=c(),Jo=r("td"),Ha=n("82.1"),Xa=c(),k=r("tr"),No=r("td"),Ya=n("m48"),Oa=c(),wt=r("td"),Qa=n("[8, 8, 24, 8]"),Ka=c(),Pt=r("td"),es=n("[96, 192, 384, 768]"),os=c(),jo=r("td"),ts=n("73"),rs=c(),Uo=r("td"),as=n("82.5"),Kt=c(),G=r("p"),ss=n("This model was contributed by "),Ze=r("a"),ns=n("heytanay"),ls=n(". The original code can be found "),Be=r("a"),is=n("here"),cs=n("."),er=c(),Q=r("h2"),he=r("a"),Tt=r("span"),b(Ge.$$.fragment),ds=c(),Ft=r("span"),ms=n("Resources"),or=c(),Ao=r("p"),fs=n("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with PoolFormer."),tr=c(),b(De.$$.fragment),rr=c(),ge=r("ul"),D=r("li"),Wo=r("a"),ps=n("PoolFormerForImageClassification"),hs=n(" is supported by this "),Se=r("a"),gs=n("example script"),us=n(" and "),Ve=r("a"),_s=n("notebook"),vs=n("."),bs=c(),Ro=r("li"),ys=n("See also: "),Zo=r("a"),ws=n("Image classification task guide"),ar=c(),Bo=r("p"),Ps=n("If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),sr=c(),K=r("h2"),ue=r("a"),$t=r("span"),b(qe.$$.fragment),Ts=c(),Et=r("span"),Fs=n("PoolFormerConfig"),nr=c(),J=r("div"),b(Le.$$.fragment),$s=c(),ee=r("p"),Es=n("This is the configuration class to store the configuration of "),Go=r("a"),Ms=n("PoolFormerModel"),Is=n(`. It is used to instantiate a
PoolFormer model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yield a similar configuration to that of the PoolFormer
`),He=r("a"),Cs=n("sail/poolformer_s12"),xs=n(" architecture."),zs=c(),oe=r("p"),ks=n("Configuration objects inherit from "),Do=r("a"),Js=n("PretrainedConfig"),Ns=n(` and can be used to control the model outputs. Read the
documentation from `),So=r("a"),js=n("PretrainedConfig"),Us=n(" for more information."),As=c(),b(_e.$$.fragment),lr=c(),te=r("h2"),ve=r("a"),Mt=r("span"),b(Xe.$$.fragment),Ws=c(),It=r("span"),Rs=n("PoolFormerFeatureExtractor"),ir=c(),re=r("div"),b(Ye.$$.fragment),Zs=c(),be=r("div"),b(Oe.$$.fragment),Bs=c(),Ct=r("p"),Gs=n("Preprocess an image or a batch of images."),cr=c(),ae=r("h2"),ye=r("a"),xt=r("span"),b(Qe.$$.fragment),Ds=c(),zt=r("span"),Ss=n("PoolFormerImageProcessor"),dr=c(),R=r("div"),b(Ke.$$.fragment),Vs=c(),kt=r("p"),qs=n("Constructs a PoolFormer image processor."),Ls=c(),we=r("div"),b(eo.$$.fragment),Hs=c(),Jt=r("p"),Xs=n("Preprocess an image or batch of images."),mr=c(),se=r("h2"),Pe=r("a"),Nt=r("span"),b(oo.$$.fragment),Ys=c(),jt=r("span"),Os=n("PoolFormerModel"),fr=c(),Z=r("div"),b(to.$$.fragment),Qs=c(),ro=r("p"),Ks=n(`The bare PoolFormer Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),ao=r("a"),en=n("torch.nn.Module"),on=n(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),tn=c(),U=r("div"),b(so.$$.fragment),rn=c(),ne=r("p"),an=n("The "),Vo=r("a"),sn=n("PoolFormerModel"),nn=n(" forward method, overrides the "),Ut=r("code"),ln=n("__call__"),cn=n(" special method."),dn=c(),b(Te.$$.fragment),mn=c(),b(Fe.$$.fragment),pr=c(),le=r("h2"),$e=r("a"),At=r("span"),b(no.$$.fragment),fn=c(),Wt=r("span"),pn=n("PoolFormerForImageClassification"),hr=c(),N=r("div"),b(lo.$$.fragment),hn=c(),Rt=r("p"),gn=n("PoolFormer Model transformer with an image classification head on top"),un=c(),io=r("p"),_n=n("This model is a PyTorch "),co=r("a"),vn=n("torch.nn.Module"),bn=n(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),yn=c(),A=r("div"),b(mo.$$.fragment),wn=c(),ie=r("p"),Pn=n("The "),qo=r("a"),Tn=n("PoolFormerForImageClassification"),Fn=n(" forward method, overrides the "),Zt=r("code"),$n=n("__call__"),En=n(" special method."),Mn=c(),b(Ee.$$.fragment),In=c(),b(Me.$$.fragment),this.h()},l(o){const f=vi('[data-svelte="svelte-1phssyn"]',document.head);h=a(f,"META",{name:!0,content:!0}),f.forEach(t),$=d(o),_=a(o,"H1",{class:!0});var fo=s(_);g=a(fo,"A",{id:!0,class:!0,href:!0});var Bt=s(g);v=a(Bt,"SPAN",{});var Gt=s(v);y(m.$$.fragment,Gt),Gt.forEach(t),Bt.forEach(t),u=d(fo),W=a(fo,"SPAN",{});var Dt=s(W);Jr=l(Dt,"PoolFormer"),Dt.forEach(t),fo.forEach(t),St=d(o),O=a(o,"H2",{class:!0});var po=s(O);de=a(po,"A",{id:!0,class:!0,href:!0});var Nn=s(de);ot=a(Nn,"SPAN",{});var jn=s(ot);y(Je.$$.fragment,jn),jn.forEach(t),Nn.forEach(t),Nr=d(po),tt=a(po,"SPAN",{});var Un=s(tt);jr=l(Un,"Overview"),Un.forEach(t),po.forEach(t),Vt=d(o),me=a(o,"P",{});var ur=s(me);Ur=l(ur,"The PoolFormer model was proposed in "),Ne=a(ur,"A",{href:!0,rel:!0});var An=s(Ne);Ar=l(An,"MetaFormer is Actually What You Need for Vision"),An.forEach(t),Wr=l(ur,"  by Sea AI Labs. Instead of designing complicated token mixer to achieve SOTA performance, the target of this work is to demonstrate the competence of transformer models largely stem from the general architecture MetaFormer."),ur.forEach(t),qt=d(o),go=a(o,"P",{});var Wn=s(go);Rr=l(Wn,"The abstract from the paper is the following:"),Wn.forEach(t),Lt=d(o),uo=a(o,"P",{});var Rn=s(uo);rt=a(Rn,"EM",{});var Zn=s(rt);Zr=l(Zn,"Transformers have shown great potential in computer vision tasks. A common belief is their attention-based token mixer module contributes most to their competence. However, recent works show the attention-based module in transformers can be replaced by spatial MLPs and the resulted models still perform quite well. Based on this observation, we hypothesize that the general architecture of the transformers, instead of the specific token mixer module, is more essential to the model\u2019s performance. To verify this, we deliberately replace the attention module in transformers with an embarrassingly simple spatial pooling operator to conduct only the most basic token mixing. Surprisingly, we observe that the derived model, termed as PoolFormer, achieves competitive performance on multiple computer vision tasks. For example, on ImageNet-1K, PoolFormer achieves 82.1% top-1 accuracy, surpassing well-tuned vision transformer/MLP-like baselines DeiT-B/ResMLP-B24 by 0.3%/1.1% accuracy with 35%/52% fewer parameters and 48%/60% fewer MACs. The effectiveness of PoolFormer verifies our hypothesis and urges us to initiate the concept of \u201CMetaFormer\u201D, a general architecture abstracted from transformers without specifying the token mixer. Based on the extensive experiments, we argue that MetaFormer is the key player in achieving superior results for recent transformer and MLP-like models on vision tasks. This work calls for more future research dedicated to improving MetaFormer instead of focusing on the token mixer modules. Additionally, our proposed PoolFormer could serve as a starting baseline for future MetaFormer architecture design."),Zn.forEach(t),Rn.forEach(t),Ht=d(o),fe=a(o,"P",{});var _r=s(fe);Br=l(_r,"The figure below illustrates the architecture of PoolFormer. Taken from the "),je=a(_r,"A",{href:!0,rel:!0});var Bn=s(je);Gr=l(Bn,"original paper"),Bn.forEach(t),Dr=l(_r,"."),_r.forEach(t),Xt=d(o),Ue=a(o,"IMG",{width:!0,src:!0}),Yt=d(o),_o=a(o,"P",{});var Gn=s(_o);Sr=l(Gn,"Tips:"),Gn.forEach(t),Ot=d(o),B=a(o,"UL",{});var Lo=s(B);Ae=a(Lo,"LI",{});var vr=s(Ae);Vr=l(vr,"PoolFormer has a hierarchical architecture, where instead of Attention, a simple Average Pooling layer is present. All checkpoints of the model can be found on the "),We=a(vr,"A",{href:!0,rel:!0});var Dn=s(We);qr=l(Dn,"hub"),Dn.forEach(t),Lr=l(vr,"."),vr.forEach(t),Hr=d(Lo),Re=a(Lo,"LI",{});var br=s(Re);Xr=l(br,"One can use "),vo=a(br,"A",{href:!0});var Sn=s(vo);Yr=l(Sn,"PoolFormerImageProcessor"),Sn.forEach(t),Or=l(br," to prepare images for the model."),br.forEach(t),Qr=d(Lo),at=a(Lo,"LI",{});var Vn=s(at);Kr=l(Vn,"As most models, PoolFormer comes in different sizes, the details of which can be found in the table below."),Vn.forEach(t),Lo.forEach(t),Qt=d(o),pe=a(o,"TABLE",{});var yr=s(pe);st=a(yr,"THEAD",{});var qn=s(st);E=a(qn,"TR",{});var S=s(E);bo=a(S,"TH",{align:!0});var Ln=s(bo);nt=a(Ln,"STRONG",{});var Hn=s(nt);ea=l(Hn,"Model variant"),Hn.forEach(t),Ln.forEach(t),oa=d(S),lt=a(S,"TH",{});var Xn=s(lt);it=a(Xn,"STRONG",{});var Yn=s(it);ta=l(Yn,"Depths"),Yn.forEach(t),Xn.forEach(t),ra=d(S),ct=a(S,"TH",{});var On=s(ct);dt=a(On,"STRONG",{});var Qn=s(dt);aa=l(Qn,"Hidden sizes"),Qn.forEach(t),On.forEach(t),sa=d(S),yo=a(S,"TH",{align:!0});var Kn=s(yo);mt=a(Kn,"STRONG",{});var el=s(mt);na=l(el,"Params (M)"),el.forEach(t),Kn.forEach(t),la=d(S),wo=a(S,"TH",{align:!0});var ol=s(wo);ft=a(ol,"STRONG",{});var tl=s(ft);ia=l(tl,"ImageNet-1k Top 1"),tl.forEach(t),ol.forEach(t),S.forEach(t),qn.forEach(t),ca=d(yr),M=a(yr,"TBODY",{});var V=s(M);I=a(V,"TR",{});var q=s(I);Po=a(q,"TD",{align:!0});var rl=s(Po);da=l(rl,"s12"),rl.forEach(t),ma=d(q),pt=a(q,"TD",{});var al=s(pt);fa=l(al,"[2, 2, 6, 2]"),al.forEach(t),pa=d(q),ht=a(q,"TD",{});var sl=s(ht);ha=l(sl,"[64, 128, 320, 512]"),sl.forEach(t),ga=d(q),To=a(q,"TD",{align:!0});var nl=s(To);ua=l(nl,"12"),nl.forEach(t),_a=d(q),Fo=a(q,"TD",{align:!0});var ll=s(Fo);va=l(ll,"77.2"),ll.forEach(t),q.forEach(t),ba=d(V),C=a(V,"TR",{});var L=s(C);$o=a(L,"TD",{align:!0});var il=s($o);ya=l(il,"s24"),il.forEach(t),wa=d(L),gt=a(L,"TD",{});var cl=s(gt);Pa=l(cl,"[4, 4, 12, 4]"),cl.forEach(t),Ta=d(L),ut=a(L,"TD",{});var dl=s(ut);Fa=l(dl,"[64, 128, 320, 512]"),dl.forEach(t),$a=d(L),Eo=a(L,"TD",{align:!0});var ml=s(Eo);Ea=l(ml,"21"),ml.forEach(t),Ma=d(L),Mo=a(L,"TD",{align:!0});var fl=s(Mo);Ia=l(fl,"80.3"),fl.forEach(t),L.forEach(t),Ca=d(V),x=a(V,"TR",{});var H=s(x);Io=a(H,"TD",{align:!0});var pl=s(Io);xa=l(pl,"s36"),pl.forEach(t),za=d(H),_t=a(H,"TD",{});var hl=s(_t);ka=l(hl,"[6, 6, 18, 6]"),hl.forEach(t),Ja=d(H),vt=a(H,"TD",{});var gl=s(vt);Na=l(gl,"[64, 128, 320, 512]"),gl.forEach(t),ja=d(H),Co=a(H,"TD",{align:!0});var ul=s(Co);Ua=l(ul,"31"),ul.forEach(t),Aa=d(H),xo=a(H,"TD",{align:!0});var _l=s(xo);Wa=l(_l,"81.4"),_l.forEach(t),H.forEach(t),Ra=d(V),z=a(V,"TR",{});var X=s(z);zo=a(X,"TD",{align:!0});var vl=s(zo);Za=l(vl,"m36"),vl.forEach(t),Ba=d(X),bt=a(X,"TD",{});var bl=s(bt);Ga=l(bl,"[6, 6, 18, 6]"),bl.forEach(t),Da=d(X),yt=a(X,"TD",{});var yl=s(yt);Sa=l(yl,"[96, 192, 384, 768]"),yl.forEach(t),Va=d(X),ko=a(X,"TD",{align:!0});var wl=s(ko);qa=l(wl,"56"),wl.forEach(t),La=d(X),Jo=a(X,"TD",{align:!0});var Pl=s(Jo);Ha=l(Pl,"82.1"),Pl.forEach(t),X.forEach(t),Xa=d(V),k=a(V,"TR",{});var Y=s(k);No=a(Y,"TD",{align:!0});var Tl=s(No);Ya=l(Tl,"m48"),Tl.forEach(t),Oa=d(Y),wt=a(Y,"TD",{});var Fl=s(wt);Qa=l(Fl,"[8, 8, 24, 8]"),Fl.forEach(t),Ka=d(Y),Pt=a(Y,"TD",{});var $l=s(Pt);es=l($l,"[96, 192, 384, 768]"),$l.forEach(t),os=d(Y),jo=a(Y,"TD",{align:!0});var El=s(jo);ts=l(El,"73"),El.forEach(t),rs=d(Y),Uo=a(Y,"TD",{align:!0});var Ml=s(Uo);as=l(Ml,"82.5"),Ml.forEach(t),Y.forEach(t),V.forEach(t),yr.forEach(t),Kt=d(o),G=a(o,"P",{});var Ho=s(G);ss=l(Ho,"This model was contributed by "),Ze=a(Ho,"A",{href:!0,rel:!0});var Il=s(Ze);ns=l(Il,"heytanay"),Il.forEach(t),ls=l(Ho,". The original code can be found "),Be=a(Ho,"A",{href:!0,rel:!0});var Cl=s(Be);is=l(Cl,"here"),Cl.forEach(t),cs=l(Ho,"."),Ho.forEach(t),er=d(o),Q=a(o,"H2",{class:!0});var wr=s(Q);he=a(wr,"A",{id:!0,class:!0,href:!0});var xl=s(he);Tt=a(xl,"SPAN",{});var zl=s(Tt);y(Ge.$$.fragment,zl),zl.forEach(t),xl.forEach(t),ds=d(wr),Ft=a(wr,"SPAN",{});var kl=s(Ft);ms=l(kl,"Resources"),kl.forEach(t),wr.forEach(t),or=d(o),Ao=a(o,"P",{});var Jl=s(Ao);fs=l(Jl,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with PoolFormer."),Jl.forEach(t),tr=d(o),y(De.$$.fragment,o),rr=d(o),ge=a(o,"UL",{});var Pr=s(ge);D=a(Pr,"LI",{});var ho=s(D);Wo=a(ho,"A",{href:!0});var Nl=s(Wo);ps=l(Nl,"PoolFormerForImageClassification"),Nl.forEach(t),hs=l(ho," is supported by this "),Se=a(ho,"A",{href:!0,rel:!0});var jl=s(Se);gs=l(jl,"example script"),jl.forEach(t),us=l(ho," and "),Ve=a(ho,"A",{href:!0,rel:!0});var Ul=s(Ve);_s=l(Ul,"notebook"),Ul.forEach(t),vs=l(ho,"."),ho.forEach(t),bs=d(Pr),Ro=a(Pr,"LI",{});var Cn=s(Ro);ys=l(Cn,"See also: "),Zo=a(Cn,"A",{href:!0});var Al=s(Zo);ws=l(Al,"Image classification task guide"),Al.forEach(t),Cn.forEach(t),Pr.forEach(t),ar=d(o),Bo=a(o,"P",{});var Wl=s(Bo);Ps=l(Wl,"If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),Wl.forEach(t),sr=d(o),K=a(o,"H2",{class:!0});var Tr=s(K);ue=a(Tr,"A",{id:!0,class:!0,href:!0});var Rl=s(ue);$t=a(Rl,"SPAN",{});var Zl=s($t);y(qe.$$.fragment,Zl),Zl.forEach(t),Rl.forEach(t),Ts=d(Tr),Et=a(Tr,"SPAN",{});var Bl=s(Et);Fs=l(Bl,"PoolFormerConfig"),Bl.forEach(t),Tr.forEach(t),nr=d(o),J=a(o,"DIV",{class:!0});var Ie=s(J);y(Le.$$.fragment,Ie),$s=d(Ie),ee=a(Ie,"P",{});var Xo=s(ee);Es=l(Xo,"This is the configuration class to store the configuration of "),Go=a(Xo,"A",{href:!0});var Gl=s(Go);Ms=l(Gl,"PoolFormerModel"),Gl.forEach(t),Is=l(Xo,`. It is used to instantiate a
PoolFormer model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yield a similar configuration to that of the PoolFormer
`),He=a(Xo,"A",{href:!0,rel:!0});var Dl=s(He);Cs=l(Dl,"sail/poolformer_s12"),Dl.forEach(t),xs=l(Xo," architecture."),Xo.forEach(t),zs=d(Ie),oe=a(Ie,"P",{});var Yo=s(oe);ks=l(Yo,"Configuration objects inherit from "),Do=a(Yo,"A",{href:!0});var Sl=s(Do);Js=l(Sl,"PretrainedConfig"),Sl.forEach(t),Ns=l(Yo,` and can be used to control the model outputs. Read the
documentation from `),So=a(Yo,"A",{href:!0});var Vl=s(So);js=l(Vl,"PretrainedConfig"),Vl.forEach(t),Us=l(Yo," for more information."),Yo.forEach(t),As=d(Ie),y(_e.$$.fragment,Ie),Ie.forEach(t),lr=d(o),te=a(o,"H2",{class:!0});var Fr=s(te);ve=a(Fr,"A",{id:!0,class:!0,href:!0});var ql=s(ve);Mt=a(ql,"SPAN",{});var Ll=s(Mt);y(Xe.$$.fragment,Ll),Ll.forEach(t),ql.forEach(t),Ws=d(Fr),It=a(Fr,"SPAN",{});var Hl=s(It);Rs=l(Hl,"PoolFormerFeatureExtractor"),Hl.forEach(t),Fr.forEach(t),ir=d(o),re=a(o,"DIV",{class:!0});var $r=s(re);y(Ye.$$.fragment,$r),Zs=d($r),be=a($r,"DIV",{class:!0});var Er=s(be);y(Oe.$$.fragment,Er),Bs=d(Er),Ct=a(Er,"P",{});var Xl=s(Ct);Gs=l(Xl,"Preprocess an image or a batch of images."),Xl.forEach(t),Er.forEach(t),$r.forEach(t),cr=d(o),ae=a(o,"H2",{class:!0});var Mr=s(ae);ye=a(Mr,"A",{id:!0,class:!0,href:!0});var Yl=s(ye);xt=a(Yl,"SPAN",{});var Ol=s(xt);y(Qe.$$.fragment,Ol),Ol.forEach(t),Yl.forEach(t),Ds=d(Mr),zt=a(Mr,"SPAN",{});var Ql=s(zt);Ss=l(Ql,"PoolFormerImageProcessor"),Ql.forEach(t),Mr.forEach(t),dr=d(o),R=a(o,"DIV",{class:!0});var Oo=s(R);y(Ke.$$.fragment,Oo),Vs=d(Oo),kt=a(Oo,"P",{});var Kl=s(kt);qs=l(Kl,"Constructs a PoolFormer image processor."),Kl.forEach(t),Ls=d(Oo),we=a(Oo,"DIV",{class:!0});var Ir=s(we);y(eo.$$.fragment,Ir),Hs=d(Ir),Jt=a(Ir,"P",{});var ei=s(Jt);Xs=l(ei,"Preprocess an image or batch of images."),ei.forEach(t),Ir.forEach(t),Oo.forEach(t),mr=d(o),se=a(o,"H2",{class:!0});var Cr=s(se);Pe=a(Cr,"A",{id:!0,class:!0,href:!0});var oi=s(Pe);Nt=a(oi,"SPAN",{});var ti=s(Nt);y(oo.$$.fragment,ti),ti.forEach(t),oi.forEach(t),Ys=d(Cr),jt=a(Cr,"SPAN",{});var ri=s(jt);Os=l(ri,"PoolFormerModel"),ri.forEach(t),Cr.forEach(t),fr=d(o),Z=a(o,"DIV",{class:!0});var Qo=s(Z);y(to.$$.fragment,Qo),Qs=d(Qo),ro=a(Qo,"P",{});var xr=s(ro);Ks=l(xr,`The bare PoolFormer Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),ao=a(xr,"A",{href:!0,rel:!0});var ai=s(ao);en=l(ai,"torch.nn.Module"),ai.forEach(t),on=l(xr,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),xr.forEach(t),tn=d(Qo),U=a(Qo,"DIV",{class:!0});var Ce=s(U);y(so.$$.fragment,Ce),rn=d(Ce),ne=a(Ce,"P",{});var Ko=s(ne);an=l(Ko,"The "),Vo=a(Ko,"A",{href:!0});var si=s(Vo);sn=l(si,"PoolFormerModel"),si.forEach(t),nn=l(Ko," forward method, overrides the "),Ut=a(Ko,"CODE",{});var ni=s(Ut);ln=l(ni,"__call__"),ni.forEach(t),cn=l(Ko," special method."),Ko.forEach(t),dn=d(Ce),y(Te.$$.fragment,Ce),mn=d(Ce),y(Fe.$$.fragment,Ce),Ce.forEach(t),Qo.forEach(t),pr=d(o),le=a(o,"H2",{class:!0});var zr=s(le);$e=a(zr,"A",{id:!0,class:!0,href:!0});var li=s($e);At=a(li,"SPAN",{});var ii=s(At);y(no.$$.fragment,ii),ii.forEach(t),li.forEach(t),fn=d(zr),Wt=a(zr,"SPAN",{});var ci=s(Wt);pn=l(ci,"PoolFormerForImageClassification"),ci.forEach(t),zr.forEach(t),hr=d(o),N=a(o,"DIV",{class:!0});var xe=s(N);y(lo.$$.fragment,xe),hn=d(xe),Rt=a(xe,"P",{});var di=s(Rt);gn=l(di,"PoolFormer Model transformer with an image classification head on top"),di.forEach(t),un=d(xe),io=a(xe,"P",{});var kr=s(io);_n=l(kr,"This model is a PyTorch "),co=a(kr,"A",{href:!0,rel:!0});var mi=s(co);vn=l(mi,"torch.nn.Module"),mi.forEach(t),bn=l(kr,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),kr.forEach(t),yn=d(xe),A=a(xe,"DIV",{class:!0});var ze=s(A);y(mo.$$.fragment,ze),wn=d(ze),ie=a(ze,"P",{});var et=s(ie);Pn=l(et,"The "),qo=a(et,"A",{href:!0});var fi=s(qo);Tn=l(fi,"PoolFormerForImageClassification"),fi.forEach(t),Fn=l(et," forward method, overrides the "),Zt=a(et,"CODE",{});var pi=s(Zt);$n=l(pi,"__call__"),pi.forEach(t),En=l(et," special method."),et.forEach(t),Mn=d(ze),y(Ee.$$.fragment,ze),In=d(ze),y(Me.$$.fragment,ze),ze.forEach(t),xe.forEach(t),this.h()},h(){i(h,"name","hf:doc:metadata"),i(h,"content",JSON.stringify(Ii)),i(g,"id","poolformer"),i(g,"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"),i(g,"href","#poolformer"),i(_,"class","relative group"),i(de,"id","overview"),i(de,"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"),i(de,"href","#overview"),i(O,"class","relative group"),i(Ne,"href","https://arxiv.org/abs/2111.11418"),i(Ne,"rel","nofollow"),i(je,"href","https://arxiv.org/abs/2111.11418"),i(je,"rel","nofollow"),i(Ue,"width","600"),bi(Ue.src,Jn="https://user-images.githubusercontent.com/15921929/142746124-1ab7635d-2536-4a0e-ad43-b4fe2c5a525d.png")||i(Ue,"src",Jn),i(We,"href","https://huggingface.co/models?other=poolformer"),i(We,"rel","nofollow"),i(vo,"href","/docs/transformers/main/en/model_doc/poolformer#transformers.PoolFormerImageProcessor"),i(bo,"align","center"),i(yo,"align","center"),i(wo,"align","center"),i(Po,"align","center"),i(To,"align","center"),i(Fo,"align","center"),i($o,"align","center"),i(Eo,"align","center"),i(Mo,"align","center"),i(Io,"align","center"),i(Co,"align","center"),i(xo,"align","center"),i(zo,"align","center"),i(ko,"align","center"),i(Jo,"align","center"),i(No,"align","center"),i(jo,"align","center"),i(Uo,"align","center"),i(Ze,"href","https://huggingface.co/heytanay"),i(Ze,"rel","nofollow"),i(Be,"href","https://github.com/sail-sg/poolformer"),i(Be,"rel","nofollow"),i(he,"id","resources"),i(he,"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"),i(he,"href","#resources"),i(Q,"class","relative group"),i(Wo,"href","/docs/transformers/main/en/model_doc/poolformer#transformers.PoolFormerForImageClassification"),i(Se,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification"),i(Se,"rel","nofollow"),i(Ve,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb"),i(Ve,"rel","nofollow"),i(Zo,"href","../tasks/image_classification"),i(ue,"id","transformers.PoolFormerConfig"),i(ue,"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"),i(ue,"href","#transformers.PoolFormerConfig"),i(K,"class","relative group"),i(Go,"href","/docs/transformers/main/en/model_doc/poolformer#transformers.PoolFormerModel"),i(He,"href","https://huggingface.co/sail/poolformer_s12"),i(He,"rel","nofollow"),i(Do,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),i(So,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),i(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(ve,"id","transformers.PoolFormerFeatureExtractor"),i(ve,"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"),i(ve,"href","#transformers.PoolFormerFeatureExtractor"),i(te,"class","relative group"),i(be,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(ye,"id","transformers.PoolFormerImageProcessor"),i(ye,"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"),i(ye,"href","#transformers.PoolFormerImageProcessor"),i(ae,"class","relative group"),i(we,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(Pe,"id","transformers.PoolFormerModel"),i(Pe,"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"),i(Pe,"href","#transformers.PoolFormerModel"),i(se,"class","relative group"),i(ao,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),i(ao,"rel","nofollow"),i(Vo,"href","/docs/transformers/main/en/model_doc/poolformer#transformers.PoolFormerModel"),i(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i($e,"id","transformers.PoolFormerForImageClassification"),i($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"),i($e,"href","#transformers.PoolFormerForImageClassification"),i(le,"class","relative group"),i(co,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),i(co,"rel","nofollow"),i(qo,"href","/docs/transformers/main/en/model_doc/poolformer#transformers.PoolFormerForImageClassification"),i(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(o,f){e(document.head,h),p(o,$,f),p(o,_,f),e(_,g),e(g,v),w(m,v,null),e(_,u),e(_,W),e(W,Jr),p(o,St,f),p(o,O,f),e(O,de),e(de,ot),w(Je,ot,null),e(O,Nr),e(O,tt),e(tt,jr),p(o,Vt,f),p(o,me,f),e(me,Ur),e(me,Ne),e(Ne,Ar),e(me,Wr),p(o,qt,f),p(o,go,f),e(go,Rr),p(o,Lt,f),p(o,uo,f),e(uo,rt),e(rt,Zr),p(o,Ht,f),p(o,fe,f),e(fe,Br),e(fe,je),e(je,Gr),e(fe,Dr),p(o,Xt,f),p(o,Ue,f),p(o,Yt,f),p(o,_o,f),e(_o,Sr),p(o,Ot,f),p(o,B,f),e(B,Ae),e(Ae,Vr),e(Ae,We),e(We,qr),e(Ae,Lr),e(B,Hr),e(B,Re),e(Re,Xr),e(Re,vo),e(vo,Yr),e(Re,Or),e(B,Qr),e(B,at),e(at,Kr),p(o,Qt,f),p(o,pe,f),e(pe,st),e(st,E),e(E,bo),e(bo,nt),e(nt,ea),e(E,oa),e(E,lt),e(lt,it),e(it,ta),e(E,ra),e(E,ct),e(ct,dt),e(dt,aa),e(E,sa),e(E,yo),e(yo,mt),e(mt,na),e(E,la),e(E,wo),e(wo,ft),e(ft,ia),e(pe,ca),e(pe,M),e(M,I),e(I,Po),e(Po,da),e(I,ma),e(I,pt),e(pt,fa),e(I,pa),e(I,ht),e(ht,ha),e(I,ga),e(I,To),e(To,ua),e(I,_a),e(I,Fo),e(Fo,va),e(M,ba),e(M,C),e(C,$o),e($o,ya),e(C,wa),e(C,gt),e(gt,Pa),e(C,Ta),e(C,ut),e(ut,Fa),e(C,$a),e(C,Eo),e(Eo,Ea),e(C,Ma),e(C,Mo),e(Mo,Ia),e(M,Ca),e(M,x),e(x,Io),e(Io,xa),e(x,za),e(x,_t),e(_t,ka),e(x,Ja),e(x,vt),e(vt,Na),e(x,ja),e(x,Co),e(Co,Ua),e(x,Aa),e(x,xo),e(xo,Wa),e(M,Ra),e(M,z),e(z,zo),e(zo,Za),e(z,Ba),e(z,bt),e(bt,Ga),e(z,Da),e(z,yt),e(yt,Sa),e(z,Va),e(z,ko),e(ko,qa),e(z,La),e(z,Jo),e(Jo,Ha),e(M,Xa),e(M,k),e(k,No),e(No,Ya),e(k,Oa),e(k,wt),e(wt,Qa),e(k,Ka),e(k,Pt),e(Pt,es),e(k,os),e(k,jo),e(jo,ts),e(k,rs),e(k,Uo),e(Uo,as),p(o,Kt,f),p(o,G,f),e(G,ss),e(G,Ze),e(Ze,ns),e(G,ls),e(G,Be),e(Be,is),e(G,cs),p(o,er,f),p(o,Q,f),e(Q,he),e(he,Tt),w(Ge,Tt,null),e(Q,ds),e(Q,Ft),e(Ft,ms),p(o,or,f),p(o,Ao,f),e(Ao,fs),p(o,tr,f),w(De,o,f),p(o,rr,f),p(o,ge,f),e(ge,D),e(D,Wo),e(Wo,ps),e(D,hs),e(D,Se),e(Se,gs),e(D,us),e(D,Ve),e(Ve,_s),e(D,vs),e(ge,bs),e(ge,Ro),e(Ro,ys),e(Ro,Zo),e(Zo,ws),p(o,ar,f),p(o,Bo,f),e(Bo,Ps),p(o,sr,f),p(o,K,f),e(K,ue),e(ue,$t),w(qe,$t,null),e(K,Ts),e(K,Et),e(Et,Fs),p(o,nr,f),p(o,J,f),w(Le,J,null),e(J,$s),e(J,ee),e(ee,Es),e(ee,Go),e(Go,Ms),e(ee,Is),e(ee,He),e(He,Cs),e(ee,xs),e(J,zs),e(J,oe),e(oe,ks),e(oe,Do),e(Do,Js),e(oe,Ns),e(oe,So),e(So,js),e(oe,Us),e(J,As),w(_e,J,null),p(o,lr,f),p(o,te,f),e(te,ve),e(ve,Mt),w(Xe,Mt,null),e(te,Ws),e(te,It),e(It,Rs),p(o,ir,f),p(o,re,f),w(Ye,re,null),e(re,Zs),e(re,be),w(Oe,be,null),e(be,Bs),e(be,Ct),e(Ct,Gs),p(o,cr,f),p(o,ae,f),e(ae,ye),e(ye,xt),w(Qe,xt,null),e(ae,Ds),e(ae,zt),e(zt,Ss),p(o,dr,f),p(o,R,f),w(Ke,R,null),e(R,Vs),e(R,kt),e(kt,qs),e(R,Ls),e(R,we),w(eo,we,null),e(we,Hs),e(we,Jt),e(Jt,Xs),p(o,mr,f),p(o,se,f),e(se,Pe),e(Pe,Nt),w(oo,Nt,null),e(se,Ys),e(se,jt),e(jt,Os),p(o,fr,f),p(o,Z,f),w(to,Z,null),e(Z,Qs),e(Z,ro),e(ro,Ks),e(ro,ao),e(ao,en),e(ro,on),e(Z,tn),e(Z,U),w(so,U,null),e(U,rn),e(U,ne),e(ne,an),e(ne,Vo),e(Vo,sn),e(ne,nn),e(ne,Ut),e(Ut,ln),e(ne,cn),e(U,dn),w(Te,U,null),e(U,mn),w(Fe,U,null),p(o,pr,f),p(o,le,f),e(le,$e),e($e,At),w(no,At,null),e(le,fn),e(le,Wt),e(Wt,pn),p(o,hr,f),p(o,N,f),w(lo,N,null),e(N,hn),e(N,Rt),e(Rt,gn),e(N,un),e(N,io),e(io,_n),e(io,co),e(co,vn),e(io,bn),e(N,yn),e(N,A),w(mo,A,null),e(A,wn),e(A,ie),e(ie,Pn),e(ie,qo),e(qo,Tn),e(ie,Fn),e(ie,Zt),e(Zt,$n),e(ie,En),e(A,Mn),w(Ee,A,null),e(A,In),w(Me,A,null),gr=!0},p(o,[f]){const fo={};f&2&&(fo.$$scope={dirty:f,ctx:o}),_e.$set(fo);const Bt={};f&2&&(Bt.$$scope={dirty:f,ctx:o}),Te.$set(Bt);const Gt={};f&2&&(Gt.$$scope={dirty:f,ctx:o}),Fe.$set(Gt);const Dt={};f&2&&(Dt.$$scope={dirty:f,ctx:o}),Ee.$set(Dt);const po={};f&2&&(po.$$scope={dirty:f,ctx:o}),Me.$set(po)},i(o){gr||(P(m.$$.fragment,o),P(Je.$$.fragment,o),P(Ge.$$.fragment,o),P(De.$$.fragment,o),P(qe.$$.fragment,o),P(Le.$$.fragment,o),P(_e.$$.fragment,o),P(Xe.$$.fragment,o),P(Ye.$$.fragment,o),P(Oe.$$.fragment,o),P(Qe.$$.fragment,o),P(Ke.$$.fragment,o),P(eo.$$.fragment,o),P(oo.$$.fragment,o),P(to.$$.fragment,o),P(so.$$.fragment,o),P(Te.$$.fragment,o),P(Fe.$$.fragment,o),P(no.$$.fragment,o),P(lo.$$.fragment,o),P(mo.$$.fragment,o),P(Ee.$$.fragment,o),P(Me.$$.fragment,o),gr=!0)},o(o){T(m.$$.fragment,o),T(Je.$$.fragment,o),T(Ge.$$.fragment,o),T(De.$$.fragment,o),T(qe.$$.fragment,o),T(Le.$$.fragment,o),T(_e.$$.fragment,o),T(Xe.$$.fragment,o),T(Ye.$$.fragment,o),T(Oe.$$.fragment,o),T(Qe.$$.fragment,o),T(Ke.$$.fragment,o),T(eo.$$.fragment,o),T(oo.$$.fragment,o),T(to.$$.fragment,o),T(so.$$.fragment,o),T(Te.$$.fragment,o),T(Fe.$$.fragment,o),T(no.$$.fragment,o),T(lo.$$.fragment,o),T(mo.$$.fragment,o),T(Ee.$$.fragment,o),T(Me.$$.fragment,o),gr=!1},d(o){t(h),o&&t($),o&&t(_),F(m),o&&t(St),o&&t(O),F(Je),o&&t(Vt),o&&t(me),o&&t(qt),o&&t(go),o&&t(Lt),o&&t(uo),o&&t(Ht),o&&t(fe),o&&t(Xt),o&&t(Ue),o&&t(Yt),o&&t(_o),o&&t(Ot),o&&t(B),o&&t(Qt),o&&t(pe),o&&t(Kt),o&&t(G),o&&t(er),o&&t(Q),F(Ge),o&&t(or),o&&t(Ao),o&&t(tr),F(De,o),o&&t(rr),o&&t(ge),o&&t(ar),o&&t(Bo),o&&t(sr),o&&t(K),F(qe),o&&t(nr),o&&t(J),F(Le),F(_e),o&&t(lr),o&&t(te),F(Xe),o&&t(ir),o&&t(re),F(Ye),F(Oe),o&&t(cr),o&&t(ae),F(Qe),o&&t(dr),o&&t(R),F(Ke),F(eo),o&&t(mr),o&&t(se),F(oo),o&&t(fr),o&&t(Z),F(to),F(so),F(Te),F(Fe),o&&t(pr),o&&t(le),F(no),o&&t(hr),o&&t(N),F(lo),F(mo),F(Ee),F(Me)}}}const Ii={local:"poolformer",sections:[{local:"overview",title:"Overview"},{local:"resources",title:"Resources"},{local:"transformers.PoolFormerConfig",title:"PoolFormerConfig"},{local:"transformers.PoolFormerFeatureExtractor",title:"PoolFormerFeatureExtractor"},{local:"transformers.PoolFormerImageProcessor",title:"PoolFormerImageProcessor"},{local:"transformers.PoolFormerModel",title:"PoolFormerModel"},{local:"transformers.PoolFormerForImageClassification",title:"PoolFormerForImageClassification"}],title:"PoolFormer"};function Ci(j){return yi(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ai extends gi{constructor(h){super();ui(this,h,Ci,Mi,_i,{})}}export{Ai as default,Ii as metadata};
