import{S as gi,i as ui,s as _i,e as r,k as c,w as P,t as n,M as vi,c as a,d as t,m as d,a as s,x as b,h as l,b as i,N as Pi,G as e,g as p,y as w,q as $,o as F,B as y,v as bi,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 An}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Ae}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as kn}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as wi}from"../../chunks/PipelineTag-hf-doc-builder.js";function $i(j){let h,T,_,g,v;return g=new An({props:{code:`from transformers import PoolFormerConfig, PoolFormerModel

# Initializing a PoolFormer sail/poolformer_s12 style configuration
configuration = PoolFormerConfig()

# Initializing a model (with random weights) from the sail/poolformer_s12 style configuration
model = PoolFormerModel(configuration)

# Accessing the model configuration
configuration = model.config`,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"),T=n("Example:"),_=c(),P(g.$$.fragment)},l(m){h=a(m,"P",{});var u=s(h);T=l(u,"Example:"),u.forEach(t),_=d(m),b(g.$$.fragment,m)},m(m,u){p(m,h,u),e(h,T),p(m,_,u),w(g,m,u),v=!0},p:zn,i(m){v||($(g.$$.fragment,m),v=!0)},o(m){F(g.$$.fragment,m),v=!1},d(m){m&&t(h),m&&t(_),y(g,m)}}}function Fi(j){let h,T,_,g,v;return{c(){h=r("p"),T=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);T=l(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a(u,"CODE",{});var L=s(_);g=l(L,"Module"),L.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,T),e(h,_),e(_,g),e(h,v)},d(m){m&&t(h)}}}function yi(j){let h,T,_,g,v;return g=new An({props:{code:`from transformers import AutoImageProcessor, PoolFormerModel
import torch
from datasets import load_dataset

dataset = load_dataset("huggingface/cats-image")
image = dataset["test"]["image"][0]

image_processor = AutoImageProcessor.from_pretrained("sail/poolformer_s12")
model = PoolFormerModel.from_pretrained("sail/poolformer_s12")

inputs = image_processor(image, return_tensors="pt")

with torch.no_grad():
    outputs = model(**inputs)

last_hidden_states = outputs.last_hidden_state
list(last_hidden_states.shape)`,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"),T=n("Example:"),_=c(),P(g.$$.fragment)},l(m){h=a(m,"P",{});var u=s(h);T=l(u,"Example:"),u.forEach(t),_=d(m),b(g.$$.fragment,m)},m(m,u){p(m,h,u),e(h,T),p(m,_,u),w(g,m,u),v=!0},p:zn,i(m){v||($(g.$$.fragment,m),v=!0)},o(m){F(g.$$.fragment,m),v=!1},d(m){m&&t(h),m&&t(_),y(g,m)}}}function Ti(j){let h,T,_,g,v;return{c(){h=r("p"),T=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);T=l(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a(u,"CODE",{});var L=s(_);g=l(L,"Module"),L.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,T),e(h,_),e(_,g),e(h,v)},d(m){m&&t(h)}}}function Ei(j){let h,T,_,g,v;return g=new An({props:{code:`from transformers import AutoImageProcessor, PoolFormerForImageClassification
import torch
from datasets import load_dataset

dataset = load_dataset("huggingface/cats-image")
image = dataset["test"]["image"][0]

image_processor = AutoImageProcessor.from_pretrained("sail/poolformer_s12")
model = PoolFormerForImageClassification.from_pretrained("sail/poolformer_s12")

inputs = image_processor(image, return_tensors="pt")

with torch.no_grad():
    logits = model(**inputs).logits

# model predicts one of the 1000 ImageNet classes
predicted_label = logits.argmax(-1).item()
print(model.config.id2label[predicted_label])`,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"),T=n("Example:"),_=c(),P(g.$$.fragment)},l(m){h=a(m,"P",{});var u=s(h);T=l(u,"Example:"),u.forEach(t),_=d(m),b(g.$$.fragment,m)},m(m,u){p(m,h,u),e(h,T),p(m,_,u),w(g,m,u),v=!0},p:zn,i(m){v||($(g.$$.fragment,m),v=!0)},o(m){F(g.$$.fragment,m),v=!1},d(m){m&&t(h),m&&t(_),y(g,m)}}}function Ii(j){let h,T,_,g,v,m,u,L,Mr,Ut,X,de,ot,Me,Dr,tt,jr,Wt,me,Nr,De,qr,Lr,Vt,go,Sr,Gt,uo,rt,Rr,Yt,fe,Or,je,Hr,Br,Jt,Ne,Mn,Kt,_o,Ur,Xt,O,qe,Wr,Le,Vr,Gr,Yr,Se,Jr,vo,Kr,Xr,Qr,at,Zr,Qt,pe,st,E,Po,nt,ea,oa,lt,it,ta,ra,ct,dt,aa,sa,bo,mt,na,la,wo,ft,ia,ca,I,x,$o,da,ma,pt,fa,pa,ht,ha,ga,Fo,ua,_a,yo,va,Pa,C,To,ba,wa,gt,$a,Fa,ut,ya,Ta,Eo,Ea,Ia,Io,xa,Ca,k,xo,ka,za,_t,Aa,Ma,vt,Da,ja,Co,Na,qa,ko,La,Sa,z,zo,Ra,Oa,Pt,Ha,Ba,bt,Ua,Wa,Ao,Va,Ga,Mo,Ya,Ja,A,Do,Ka,Xa,wt,Qa,Za,$t,es,os,jo,ts,rs,No,as,Zt,H,ss,Re,ns,ls,Oe,is,cs,er,Q,he,Ft,He,ds,yt,ms,or,qo,fs,tr,Be,rr,ge,B,Lo,ps,hs,Ue,gs,us,We,_s,vs,Ps,So,bs,Ro,ws,ar,Oo,$s,sr,Z,ue,Tt,Ve,Fs,Et,ys,nr,M,Ge,Ts,ee,Es,Ho,Is,xs,Ye,Cs,ks,zs,oe,As,Bo,Ms,Ds,Uo,js,Ns,qs,_e,lr,te,ve,It,Je,Ls,xt,Ss,ir,re,Ke,Rs,Pe,Xe,Os,Ct,Hs,cr,ae,be,kt,Qe,Bs,zt,Us,dr,S,Ze,Ws,At,Vs,Gs,we,eo,Ys,Mt,Js,mr,se,$e,Dt,oo,Ks,jt,Xs,fr,R,to,Qs,ro,Zs,ao,en,on,tn,N,so,rn,ne,an,Wo,sn,nn,Nt,ln,cn,dn,Fe,mn,ye,pr,le,Te,qt,no,fn,Lt,pn,hr,D,lo,hn,St,gn,un,io,_n,co,vn,Pn,bn,q,mo,wn,ie,$n,Vo,Fn,yn,Rt,Tn,En,In,Ee,xn,Ie,gr;return m=new Ae({}),Me=new Ae({}),He=new Ae({}),Be=new wi({props:{pipeline:"image-classification"}}),Ve=new Ae({}),Ge=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/v4.29.0/src/transformers/models/poolformer/configuration_poolformer.py#L34"}}),_e=new kn({props:{anchor:"transformers.PoolFormerConfig.example",$$slots:{default:[$i]},$$scope:{ctx:j}}}),Je=new Ae({}),Ke=new ce({props:{name:"class transformers.PoolFormerFeatureExtractor",anchor:"transformers.PoolFormerFeatureExtractor",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/poolformer/feature_extraction_poolformer.py#L26"}}),Xe=new ce({props:{name:"__call__",anchor:"transformers.PoolFormerFeatureExtractor.__call__",parameters:[{name:"images",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/image_processing_utils.py#L462"}}),Qe=new Ae({}),Ze=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/v4.29.0/src/transformers/models/poolformer/image_processing_poolformer.py#L50"}}),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/v4.29.0/src/transformers/models/poolformer/image_processing_poolformer.py#L265"}}),oo=new Ae({}),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/v4.29.0/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/v4.29.0/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/v4.29.0/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/v4.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__call__">PoolFormerImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/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/v4.29.0/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>
`}}),Fe=new hi({props:{$$slots:{default:[Fi]},$$scope:{ctx:j}}}),ye=new kn({props:{anchor:"transformers.PoolFormerModel.forward.example",$$slots:{default:[yi]},$$scope:{ctx:j}}}),no=new Ae({}),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/v4.29.0/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/v4.29.0/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/v4.29.0/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/v4.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__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/v4.29.0/src/transformers/models/poolformer/modeling_poolformer.py#L396",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/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/v4.29.0/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/v4.29.0/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:[Ti]},$$scope:{ctx:j}}}),Ie=new kn({props:{anchor:"transformers.PoolFormerForImageClassification.forward.example",$$slots:{default:[Ei]},$$scope:{ctx:j}}}),{c(){h=r("meta"),T=c(),_=r("h1"),g=r("a"),v=r("span"),P(m.$$.fragment),u=c(),L=r("span"),Mr=n("PoolFormer"),Ut=c(),X=r("h2"),de=r("a"),ot=r("span"),P(Me.$$.fragment),Dr=c(),tt=r("span"),jr=n("Overview"),Wt=c(),me=r("p"),Nr=n("The PoolFormer model was proposed in "),De=r("a"),qr=n("MetaFormer is Actually What You Need for Vision"),Lr=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."),Vt=c(),go=r("p"),Sr=n("The abstract from the paper is the following:"),Gt=c(),uo=r("p"),rt=r("em"),Rr=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."),Yt=c(),fe=r("p"),Or=n("The figure below illustrates the architecture of PoolFormer. Taken from the "),je=r("a"),Hr=n("original paper"),Br=n("."),Jt=c(),Ne=r("img"),Kt=c(),_o=r("p"),Ur=n("Tips:"),Xt=c(),O=r("ul"),qe=r("li"),Wr=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 "),Le=r("a"),Vr=n("hub"),Gr=n("."),Yr=c(),Se=r("li"),Jr=n("One can use "),vo=r("a"),Kr=n("PoolFormerImageProcessor"),Xr=n(" to prepare images for the model."),Qr=c(),at=r("li"),Zr=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"),Po=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(),bo=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(),I=r("tbody"),x=r("tr"),$o=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(),Fo=r("td"),ua=n("12"),_a=c(),yo=r("td"),va=n("77.2"),Pa=c(),C=r("tr"),To=r("td"),ba=n("s24"),wa=c(),gt=r("td"),$a=n("[4, 4, 12, 4]"),Fa=c(),ut=r("td"),ya=n("[64, 128, 320, 512]"),Ta=c(),Eo=r("td"),Ea=n("21"),Ia=c(),Io=r("td"),xa=n("80.3"),Ca=c(),k=r("tr"),xo=r("td"),ka=n("s36"),za=c(),_t=r("td"),Aa=n("[6, 6, 18, 6]"),Ma=c(),vt=r("td"),Da=n("[64, 128, 320, 512]"),ja=c(),Co=r("td"),Na=n("31"),qa=c(),ko=r("td"),La=n("81.4"),Sa=c(),z=r("tr"),zo=r("td"),Ra=n("m36"),Oa=c(),Pt=r("td"),Ha=n("[6, 6, 18, 6]"),Ba=c(),bt=r("td"),Ua=n("[96, 192, 384, 768]"),Wa=c(),Ao=r("td"),Va=n("56"),Ga=c(),Mo=r("td"),Ya=n("82.1"),Ja=c(),A=r("tr"),Do=r("td"),Ka=n("m48"),Xa=c(),wt=r("td"),Qa=n("[8, 8, 24, 8]"),Za=c(),$t=r("td"),es=n("[96, 192, 384, 768]"),os=c(),jo=r("td"),ts=n("73"),rs=c(),No=r("td"),as=n("82.5"),Zt=c(),H=r("p"),ss=n("This model was contributed by "),Re=r("a"),ns=n("heytanay"),ls=n(". The original code can be found "),Oe=r("a"),is=n("here"),cs=n("."),er=c(),Q=r("h2"),he=r("a"),Ft=r("span"),P(He.$$.fragment),ds=c(),yt=r("span"),ms=n("Resources"),or=c(),qo=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(),P(Be.$$.fragment),rr=c(),ge=r("ul"),B=r("li"),Lo=r("a"),ps=n("PoolFormerForImageClassification"),hs=n(" is supported by this "),Ue=r("a"),gs=n("example script"),us=n(" and "),We=r("a"),_s=n("notebook"),vs=n("."),Ps=c(),So=r("li"),bs=n("See also: "),Ro=r("a"),ws=n("Image classification task guide"),ar=c(),Oo=r("p"),$s=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(),Z=r("h2"),ue=r("a"),Tt=r("span"),P(Ve.$$.fragment),Fs=c(),Et=r("span"),ys=n("PoolFormerConfig"),nr=c(),M=r("div"),P(Ge.$$.fragment),Ts=c(),ee=r("p"),Es=n("This is the configuration class to store the configuration of "),Ho=r("a"),Is=n("PoolFormerModel"),xs=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
`),Ye=r("a"),Cs=n("sail/poolformer_s12"),ks=n(" architecture."),zs=c(),oe=r("p"),As=n("Configuration objects inherit from "),Bo=r("a"),Ms=n("PretrainedConfig"),Ds=n(` and can be used to control the model outputs. Read the
documentation from `),Uo=r("a"),js=n("PretrainedConfig"),Ns=n(" for more information."),qs=c(),P(_e.$$.fragment),lr=c(),te=r("h2"),ve=r("a"),It=r("span"),P(Je.$$.fragment),Ls=c(),xt=r("span"),Ss=n("PoolFormerFeatureExtractor"),ir=c(),re=r("div"),P(Ke.$$.fragment),Rs=c(),Pe=r("div"),P(Xe.$$.fragment),Os=c(),Ct=r("p"),Hs=n("Preprocess an image or a batch of images."),cr=c(),ae=r("h2"),be=r("a"),kt=r("span"),P(Qe.$$.fragment),Bs=c(),zt=r("span"),Us=n("PoolFormerImageProcessor"),dr=c(),S=r("div"),P(Ze.$$.fragment),Ws=c(),At=r("p"),Vs=n("Constructs a PoolFormer image processor."),Gs=c(),we=r("div"),P(eo.$$.fragment),Ys=c(),Mt=r("p"),Js=n("Preprocess an image or batch of images."),mr=c(),se=r("h2"),$e=r("a"),Dt=r("span"),P(oo.$$.fragment),Ks=c(),jt=r("span"),Xs=n("PoolFormerModel"),fr=c(),R=r("div"),P(to.$$.fragment),Qs=c(),ro=r("p"),Zs=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(),N=r("div"),P(so.$$.fragment),rn=c(),ne=r("p"),an=n("The "),Wo=r("a"),sn=n("PoolFormerModel"),nn=n(" forward method, overrides the "),Nt=r("code"),ln=n("__call__"),cn=n(" special method."),dn=c(),P(Fe.$$.fragment),mn=c(),P(ye.$$.fragment),pr=c(),le=r("h2"),Te=r("a"),qt=r("span"),P(no.$$.fragment),fn=c(),Lt=r("span"),pn=n("PoolFormerForImageClassification"),hr=c(),D=r("div"),P(lo.$$.fragment),hn=c(),St=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"),Pn=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.`),bn=c(),q=r("div"),P(mo.$$.fragment),wn=c(),ie=r("p"),$n=n("The "),Vo=r("a"),Fn=n("PoolFormerForImageClassification"),yn=n(" forward method, overrides the "),Rt=r("code"),Tn=n("__call__"),En=n(" special method."),In=c(),P(Ee.$$.fragment),xn=c(),P(Ie.$$.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),T=d(o),_=a(o,"H1",{class:!0});var fo=s(_);g=a(fo,"A",{id:!0,class:!0,href:!0});var Ot=s(g);v=a(Ot,"SPAN",{});var Ht=s(v);b(m.$$.fragment,Ht),Ht.forEach(t),Ot.forEach(t),u=d(fo),L=a(fo,"SPAN",{});var Bt=s(L);Mr=l(Bt,"PoolFormer"),Bt.forEach(t),fo.forEach(t),Ut=d(o),X=a(o,"H2",{class:!0});var po=s(X);de=a(po,"A",{id:!0,class:!0,href:!0});var Dn=s(de);ot=a(Dn,"SPAN",{});var jn=s(ot);b(Me.$$.fragment,jn),jn.forEach(t),Dn.forEach(t),Dr=d(po),tt=a(po,"SPAN",{});var Nn=s(tt);jr=l(Nn,"Overview"),Nn.forEach(t),po.forEach(t),Wt=d(o),me=a(o,"P",{});var ur=s(me);Nr=l(ur,"The PoolFormer model was proposed in "),De=a(ur,"A",{href:!0,rel:!0});var qn=s(De);qr=l(qn,"MetaFormer is Actually What You Need for Vision"),qn.forEach(t),Lr=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),Vt=d(o),go=a(o,"P",{});var Ln=s(go);Sr=l(Ln,"The abstract from the paper is the following:"),Ln.forEach(t),Gt=d(o),uo=a(o,"P",{});var Sn=s(uo);rt=a(Sn,"EM",{});var Rn=s(rt);Rr=l(Rn,"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."),Rn.forEach(t),Sn.forEach(t),Yt=d(o),fe=a(o,"P",{});var _r=s(fe);Or=l(_r,"The figure below illustrates the architecture of PoolFormer. Taken from the "),je=a(_r,"A",{href:!0,rel:!0});var On=s(je);Hr=l(On,"original paper"),On.forEach(t),Br=l(_r,"."),_r.forEach(t),Jt=d(o),Ne=a(o,"IMG",{width:!0,src:!0}),Kt=d(o),_o=a(o,"P",{});var Hn=s(_o);Ur=l(Hn,"Tips:"),Hn.forEach(t),Xt=d(o),O=a(o,"UL",{});var Go=s(O);qe=a(Go,"LI",{});var vr=s(qe);Wr=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 "),Le=a(vr,"A",{href:!0,rel:!0});var Bn=s(Le);Vr=l(Bn,"hub"),Bn.forEach(t),Gr=l(vr,"."),vr.forEach(t),Yr=d(Go),Se=a(Go,"LI",{});var Pr=s(Se);Jr=l(Pr,"One can use "),vo=a(Pr,"A",{href:!0});var Un=s(vo);Kr=l(Un,"PoolFormerImageProcessor"),Un.forEach(t),Xr=l(Pr," to prepare images for the model."),Pr.forEach(t),Qr=d(Go),at=a(Go,"LI",{});var Wn=s(at);Zr=l(Wn,"As most models, PoolFormer comes in different sizes, the details of which can be found in the table below."),Wn.forEach(t),Go.forEach(t),Qt=d(o),pe=a(o,"TABLE",{});var br=s(pe);st=a(br,"THEAD",{});var Vn=s(st);E=a(Vn,"TR",{});var U=s(E);Po=a(U,"TH",{align:!0});var Gn=s(Po);nt=a(Gn,"STRONG",{});var Yn=s(nt);ea=l(Yn,"Model variant"),Yn.forEach(t),Gn.forEach(t),oa=d(U),lt=a(U,"TH",{});var Jn=s(lt);it=a(Jn,"STRONG",{});var Kn=s(it);ta=l(Kn,"Depths"),Kn.forEach(t),Jn.forEach(t),ra=d(U),ct=a(U,"TH",{});var Xn=s(ct);dt=a(Xn,"STRONG",{});var Qn=s(dt);aa=l(Qn,"Hidden sizes"),Qn.forEach(t),Xn.forEach(t),sa=d(U),bo=a(U,"TH",{align:!0});var Zn=s(bo);mt=a(Zn,"STRONG",{});var el=s(mt);na=l(el,"Params (M)"),el.forEach(t),Zn.forEach(t),la=d(U),wo=a(U,"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),U.forEach(t),Vn.forEach(t),ca=d(br),I=a(br,"TBODY",{});var W=s(I);x=a(W,"TR",{});var V=s(x);$o=a(V,"TD",{align:!0});var rl=s($o);da=l(rl,"s12"),rl.forEach(t),ma=d(V),pt=a(V,"TD",{});var al=s(pt);fa=l(al,"[2, 2, 6, 2]"),al.forEach(t),pa=d(V),ht=a(V,"TD",{});var sl=s(ht);ha=l(sl,"[64, 128, 320, 512]"),sl.forEach(t),ga=d(V),Fo=a(V,"TD",{align:!0});var nl=s(Fo);ua=l(nl,"12"),nl.forEach(t),_a=d(V),yo=a(V,"TD",{align:!0});var ll=s(yo);va=l(ll,"77.2"),ll.forEach(t),V.forEach(t),Pa=d(W),C=a(W,"TR",{});var G=s(C);To=a(G,"TD",{align:!0});var il=s(To);ba=l(il,"s24"),il.forEach(t),wa=d(G),gt=a(G,"TD",{});var cl=s(gt);$a=l(cl,"[4, 4, 12, 4]"),cl.forEach(t),Fa=d(G),ut=a(G,"TD",{});var dl=s(ut);ya=l(dl,"[64, 128, 320, 512]"),dl.forEach(t),Ta=d(G),Eo=a(G,"TD",{align:!0});var ml=s(Eo);Ea=l(ml,"21"),ml.forEach(t),Ia=d(G),Io=a(G,"TD",{align:!0});var fl=s(Io);xa=l(fl,"80.3"),fl.forEach(t),G.forEach(t),Ca=d(W),k=a(W,"TR",{});var Y=s(k);xo=a(Y,"TD",{align:!0});var pl=s(xo);ka=l(pl,"s36"),pl.forEach(t),za=d(Y),_t=a(Y,"TD",{});var hl=s(_t);Aa=l(hl,"[6, 6, 18, 6]"),hl.forEach(t),Ma=d(Y),vt=a(Y,"TD",{});var gl=s(vt);Da=l(gl,"[64, 128, 320, 512]"),gl.forEach(t),ja=d(Y),Co=a(Y,"TD",{align:!0});var ul=s(Co);Na=l(ul,"31"),ul.forEach(t),qa=d(Y),ko=a(Y,"TD",{align:!0});var _l=s(ko);La=l(_l,"81.4"),_l.forEach(t),Y.forEach(t),Sa=d(W),z=a(W,"TR",{});var J=s(z);zo=a(J,"TD",{align:!0});var vl=s(zo);Ra=l(vl,"m36"),vl.forEach(t),Oa=d(J),Pt=a(J,"TD",{});var Pl=s(Pt);Ha=l(Pl,"[6, 6, 18, 6]"),Pl.forEach(t),Ba=d(J),bt=a(J,"TD",{});var bl=s(bt);Ua=l(bl,"[96, 192, 384, 768]"),bl.forEach(t),Wa=d(J),Ao=a(J,"TD",{align:!0});var wl=s(Ao);Va=l(wl,"56"),wl.forEach(t),Ga=d(J),Mo=a(J,"TD",{align:!0});var $l=s(Mo);Ya=l($l,"82.1"),$l.forEach(t),J.forEach(t),Ja=d(W),A=a(W,"TR",{});var K=s(A);Do=a(K,"TD",{align:!0});var Fl=s(Do);Ka=l(Fl,"m48"),Fl.forEach(t),Xa=d(K),wt=a(K,"TD",{});var yl=s(wt);Qa=l(yl,"[8, 8, 24, 8]"),yl.forEach(t),Za=d(K),$t=a(K,"TD",{});var Tl=s($t);es=l(Tl,"[96, 192, 384, 768]"),Tl.forEach(t),os=d(K),jo=a(K,"TD",{align:!0});var El=s(jo);ts=l(El,"73"),El.forEach(t),rs=d(K),No=a(K,"TD",{align:!0});var Il=s(No);as=l(Il,"82.5"),Il.forEach(t),K.forEach(t),W.forEach(t),br.forEach(t),Zt=d(o),H=a(o,"P",{});var Yo=s(H);ss=l(Yo,"This model was contributed by "),Re=a(Yo,"A",{href:!0,rel:!0});var xl=s(Re);ns=l(xl,"heytanay"),xl.forEach(t),ls=l(Yo,". The original code can be found "),Oe=a(Yo,"A",{href:!0,rel:!0});var Cl=s(Oe);is=l(Cl,"here"),Cl.forEach(t),cs=l(Yo,"."),Yo.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 kl=s(he);Ft=a(kl,"SPAN",{});var zl=s(Ft);b(He.$$.fragment,zl),zl.forEach(t),kl.forEach(t),ds=d(wr),yt=a(wr,"SPAN",{});var Al=s(yt);ms=l(Al,"Resources"),Al.forEach(t),wr.forEach(t),or=d(o),qo=a(o,"P",{});var Ml=s(qo);fs=l(Ml,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with PoolFormer."),Ml.forEach(t),tr=d(o),b(Be.$$.fragment,o),rr=d(o),ge=a(o,"UL",{});var $r=s(ge);B=a($r,"LI",{});var ho=s(B);Lo=a(ho,"A",{href:!0});var Dl=s(Lo);ps=l(Dl,"PoolFormerForImageClassification"),Dl.forEach(t),hs=l(ho," is supported by this "),Ue=a(ho,"A",{href:!0,rel:!0});var jl=s(Ue);gs=l(jl,"example script"),jl.forEach(t),us=l(ho," and "),We=a(ho,"A",{href:!0,rel:!0});var Nl=s(We);_s=l(Nl,"notebook"),Nl.forEach(t),vs=l(ho,"."),ho.forEach(t),Ps=d($r),So=a($r,"LI",{});var Cn=s(So);bs=l(Cn,"See also: "),Ro=a(Cn,"A",{href:!0});var ql=s(Ro);ws=l(ql,"Image classification task guide"),ql.forEach(t),Cn.forEach(t),$r.forEach(t),ar=d(o),Oo=a(o,"P",{});var Ll=s(Oo);$s=l(Ll,"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."),Ll.forEach(t),sr=d(o),Z=a(o,"H2",{class:!0});var Fr=s(Z);ue=a(Fr,"A",{id:!0,class:!0,href:!0});var Sl=s(ue);Tt=a(Sl,"SPAN",{});var Rl=s(Tt);b(Ve.$$.fragment,Rl),Rl.forEach(t),Sl.forEach(t),Fs=d(Fr),Et=a(Fr,"SPAN",{});var Ol=s(Et);ys=l(Ol,"PoolFormerConfig"),Ol.forEach(t),Fr.forEach(t),nr=d(o),M=a(o,"DIV",{class:!0});var xe=s(M);b(Ge.$$.fragment,xe),Ts=d(xe),ee=a(xe,"P",{});var Jo=s(ee);Es=l(Jo,"This is the configuration class to store the configuration of "),Ho=a(Jo,"A",{href:!0});var Hl=s(Ho);Is=l(Hl,"PoolFormerModel"),Hl.forEach(t),xs=l(Jo,`. 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
`),Ye=a(Jo,"A",{href:!0,rel:!0});var Bl=s(Ye);Cs=l(Bl,"sail/poolformer_s12"),Bl.forEach(t),ks=l(Jo," architecture."),Jo.forEach(t),zs=d(xe),oe=a(xe,"P",{});var Ko=s(oe);As=l(Ko,"Configuration objects inherit from "),Bo=a(Ko,"A",{href:!0});var Ul=s(Bo);Ms=l(Ul,"PretrainedConfig"),Ul.forEach(t),Ds=l(Ko,` and can be used to control the model outputs. Read the
documentation from `),Uo=a(Ko,"A",{href:!0});var Wl=s(Uo);js=l(Wl,"PretrainedConfig"),Wl.forEach(t),Ns=l(Ko," for more information."),Ko.forEach(t),qs=d(xe),b(_e.$$.fragment,xe),xe.forEach(t),lr=d(o),te=a(o,"H2",{class:!0});var yr=s(te);ve=a(yr,"A",{id:!0,class:!0,href:!0});var Vl=s(ve);It=a(Vl,"SPAN",{});var Gl=s(It);b(Je.$$.fragment,Gl),Gl.forEach(t),Vl.forEach(t),Ls=d(yr),xt=a(yr,"SPAN",{});var Yl=s(xt);Ss=l(Yl,"PoolFormerFeatureExtractor"),Yl.forEach(t),yr.forEach(t),ir=d(o),re=a(o,"DIV",{class:!0});var Tr=s(re);b(Ke.$$.fragment,Tr),Rs=d(Tr),Pe=a(Tr,"DIV",{class:!0});var Er=s(Pe);b(Xe.$$.fragment,Er),Os=d(Er),Ct=a(Er,"P",{});var Jl=s(Ct);Hs=l(Jl,"Preprocess an image or a batch of images."),Jl.forEach(t),Er.forEach(t),Tr.forEach(t),cr=d(o),ae=a(o,"H2",{class:!0});var Ir=s(ae);be=a(Ir,"A",{id:!0,class:!0,href:!0});var Kl=s(be);kt=a(Kl,"SPAN",{});var Xl=s(kt);b(Qe.$$.fragment,Xl),Xl.forEach(t),Kl.forEach(t),Bs=d(Ir),zt=a(Ir,"SPAN",{});var Ql=s(zt);Us=l(Ql,"PoolFormerImageProcessor"),Ql.forEach(t),Ir.forEach(t),dr=d(o),S=a(o,"DIV",{class:!0});var Xo=s(S);b(Ze.$$.fragment,Xo),Ws=d(Xo),At=a(Xo,"P",{});var Zl=s(At);Vs=l(Zl,"Constructs a PoolFormer image processor."),Zl.forEach(t),Gs=d(Xo),we=a(Xo,"DIV",{class:!0});var xr=s(we);b(eo.$$.fragment,xr),Ys=d(xr),Mt=a(xr,"P",{});var ei=s(Mt);Js=l(ei,"Preprocess an image or batch of images."),ei.forEach(t),xr.forEach(t),Xo.forEach(t),mr=d(o),se=a(o,"H2",{class:!0});var Cr=s(se);$e=a(Cr,"A",{id:!0,class:!0,href:!0});var oi=s($e);Dt=a(oi,"SPAN",{});var ti=s(Dt);b(oo.$$.fragment,ti),ti.forEach(t),oi.forEach(t),Ks=d(Cr),jt=a(Cr,"SPAN",{});var ri=s(jt);Xs=l(ri,"PoolFormerModel"),ri.forEach(t),Cr.forEach(t),fr=d(o),R=a(o,"DIV",{class:!0});var Qo=s(R);b(to.$$.fragment,Qo),Qs=d(Qo),ro=a(Qo,"P",{});var kr=s(ro);Zs=l(kr,`The bare PoolFormer Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),ao=a(kr,"A",{href:!0,rel:!0});var ai=s(ao);en=l(ai,"torch.nn.Module"),ai.forEach(t),on=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),tn=d(Qo),N=a(Qo,"DIV",{class:!0});var Ce=s(N);b(so.$$.fragment,Ce),rn=d(Ce),ne=a(Ce,"P",{});var Zo=s(ne);an=l(Zo,"The "),Wo=a(Zo,"A",{href:!0});var si=s(Wo);sn=l(si,"PoolFormerModel"),si.forEach(t),nn=l(Zo," forward method, overrides the "),Nt=a(Zo,"CODE",{});var ni=s(Nt);ln=l(ni,"__call__"),ni.forEach(t),cn=l(Zo," special method."),Zo.forEach(t),dn=d(Ce),b(Fe.$$.fragment,Ce),mn=d(Ce),b(ye.$$.fragment,Ce),Ce.forEach(t),Qo.forEach(t),pr=d(o),le=a(o,"H2",{class:!0});var zr=s(le);Te=a(zr,"A",{id:!0,class:!0,href:!0});var li=s(Te);qt=a(li,"SPAN",{});var ii=s(qt);b(no.$$.fragment,ii),ii.forEach(t),li.forEach(t),fn=d(zr),Lt=a(zr,"SPAN",{});var ci=s(Lt);pn=l(ci,"PoolFormerForImageClassification"),ci.forEach(t),zr.forEach(t),hr=d(o),D=a(o,"DIV",{class:!0});var ke=s(D);b(lo.$$.fragment,ke),hn=d(ke),St=a(ke,"P",{});var di=s(St);gn=l(di,"PoolFormer Model transformer with an image classification head on top"),di.forEach(t),un=d(ke),io=a(ke,"P",{});var Ar=s(io);_n=l(Ar,"This model is a PyTorch "),co=a(Ar,"A",{href:!0,rel:!0});var mi=s(co);vn=l(mi,"torch.nn.Module"),mi.forEach(t),Pn=l(Ar,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ar.forEach(t),bn=d(ke),q=a(ke,"DIV",{class:!0});var ze=s(q);b(mo.$$.fragment,ze),wn=d(ze),ie=a(ze,"P",{});var et=s(ie);$n=l(et,"The "),Vo=a(et,"A",{href:!0});var fi=s(Vo);Fn=l(fi,"PoolFormerForImageClassification"),fi.forEach(t),yn=l(et," forward method, overrides the "),Rt=a(et,"CODE",{});var pi=s(Rt);Tn=l(pi,"__call__"),pi.forEach(t),En=l(et," special method."),et.forEach(t),In=d(ze),b(Ee.$$.fragment,ze),xn=d(ze),b(Ie.$$.fragment,ze),ze.forEach(t),ke.forEach(t),this.h()},h(){i(h,"name","hf:doc:metadata"),i(h,"content",JSON.stringify(xi)),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(X,"class","relative group"),i(De,"href","https://arxiv.org/abs/2111.11418"),i(De,"rel","nofollow"),i(je,"href","https://arxiv.org/abs/2111.11418"),i(je,"rel","nofollow"),i(Ne,"width","600"),Pi(Ne.src,Mn="https://user-images.githubusercontent.com/15921929/142746124-1ab7635d-2536-4a0e-ad43-b4fe2c5a525d.png")||i(Ne,"src",Mn),i(Le,"href","https://huggingface.co/models?other=poolformer"),i(Le,"rel","nofollow"),i(vo,"href","/docs/transformers/v4.29.0/en/model_doc/poolformer#transformers.PoolFormerImageProcessor"),i(Po,"align","center"),i(bo,"align","center"),i(wo,"align","center"),i($o,"align","center"),i(Fo,"align","center"),i(yo,"align","center"),i(To,"align","center"),i(Eo,"align","center"),i(Io,"align","center"),i(xo,"align","center"),i(Co,"align","center"),i(ko,"align","center"),i(zo,"align","center"),i(Ao,"align","center"),i(Mo,"align","center"),i(Do,"align","center"),i(jo,"align","center"),i(No,"align","center"),i(Re,"href","https://huggingface.co/heytanay"),i(Re,"rel","nofollow"),i(Oe,"href","https://github.com/sail-sg/poolformer"),i(Oe,"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(Lo,"href","/docs/transformers/v4.29.0/en/model_doc/poolformer#transformers.PoolFormerForImageClassification"),i(Ue,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification"),i(Ue,"rel","nofollow"),i(We,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb"),i(We,"rel","nofollow"),i(Ro,"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(Z,"class","relative group"),i(Ho,"href","/docs/transformers/v4.29.0/en/model_doc/poolformer#transformers.PoolFormerModel"),i(Ye,"href","https://huggingface.co/sail/poolformer_s12"),i(Ye,"rel","nofollow"),i(Bo,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),i(Uo,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),i(M,"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(Pe,"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(be,"id","transformers.PoolFormerImageProcessor"),i(be,"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(be,"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(S,"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.PoolFormerModel"),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.PoolFormerModel"),i(se,"class","relative group"),i(ao,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),i(ao,"rel","nofollow"),i(Wo,"href","/docs/transformers/v4.29.0/en/model_doc/poolformer#transformers.PoolFormerModel"),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"),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(Te,"id","transformers.PoolFormerForImageClassification"),i(Te,"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(Te,"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(Vo,"href","/docs/transformers/v4.29.0/en/model_doc/poolformer#transformers.PoolFormerForImageClassification"),i(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(D,"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,T,f),p(o,_,f),e(_,g),e(g,v),w(m,v,null),e(_,u),e(_,L),e(L,Mr),p(o,Ut,f),p(o,X,f),e(X,de),e(de,ot),w(Me,ot,null),e(X,Dr),e(X,tt),e(tt,jr),p(o,Wt,f),p(o,me,f),e(me,Nr),e(me,De),e(De,qr),e(me,Lr),p(o,Vt,f),p(o,go,f),e(go,Sr),p(o,Gt,f),p(o,uo,f),e(uo,rt),e(rt,Rr),p(o,Yt,f),p(o,fe,f),e(fe,Or),e(fe,je),e(je,Hr),e(fe,Br),p(o,Jt,f),p(o,Ne,f),p(o,Kt,f),p(o,_o,f),e(_o,Ur),p(o,Xt,f),p(o,O,f),e(O,qe),e(qe,Wr),e(qe,Le),e(Le,Vr),e(qe,Gr),e(O,Yr),e(O,Se),e(Se,Jr),e(Se,vo),e(vo,Kr),e(Se,Xr),e(O,Qr),e(O,at),e(at,Zr),p(o,Qt,f),p(o,pe,f),e(pe,st),e(st,E),e(E,Po),e(Po,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,bo),e(bo,mt),e(mt,na),e(E,la),e(E,wo),e(wo,ft),e(ft,ia),e(pe,ca),e(pe,I),e(I,x),e(x,$o),e($o,da),e(x,ma),e(x,pt),e(pt,fa),e(x,pa),e(x,ht),e(ht,ha),e(x,ga),e(x,Fo),e(Fo,ua),e(x,_a),e(x,yo),e(yo,va),e(I,Pa),e(I,C),e(C,To),e(To,ba),e(C,wa),e(C,gt),e(gt,$a),e(C,Fa),e(C,ut),e(ut,ya),e(C,Ta),e(C,Eo),e(Eo,Ea),e(C,Ia),e(C,Io),e(Io,xa),e(I,Ca),e(I,k),e(k,xo),e(xo,ka),e(k,za),e(k,_t),e(_t,Aa),e(k,Ma),e(k,vt),e(vt,Da),e(k,ja),e(k,Co),e(Co,Na),e(k,qa),e(k,ko),e(ko,La),e(I,Sa),e(I,z),e(z,zo),e(zo,Ra),e(z,Oa),e(z,Pt),e(Pt,Ha),e(z,Ba),e(z,bt),e(bt,Ua),e(z,Wa),e(z,Ao),e(Ao,Va),e(z,Ga),e(z,Mo),e(Mo,Ya),e(I,Ja),e(I,A),e(A,Do),e(Do,Ka),e(A,Xa),e(A,wt),e(wt,Qa),e(A,Za),e(A,$t),e($t,es),e(A,os),e(A,jo),e(jo,ts),e(A,rs),e(A,No),e(No,as),p(o,Zt,f),p(o,H,f),e(H,ss),e(H,Re),e(Re,ns),e(H,ls),e(H,Oe),e(Oe,is),e(H,cs),p(o,er,f),p(o,Q,f),e(Q,he),e(he,Ft),w(He,Ft,null),e(Q,ds),e(Q,yt),e(yt,ms),p(o,or,f),p(o,qo,f),e(qo,fs),p(o,tr,f),w(Be,o,f),p(o,rr,f),p(o,ge,f),e(ge,B),e(B,Lo),e(Lo,ps),e(B,hs),e(B,Ue),e(Ue,gs),e(B,us),e(B,We),e(We,_s),e(B,vs),e(ge,Ps),e(ge,So),e(So,bs),e(So,Ro),e(Ro,ws),p(o,ar,f),p(o,Oo,f),e(Oo,$s),p(o,sr,f),p(o,Z,f),e(Z,ue),e(ue,Tt),w(Ve,Tt,null),e(Z,Fs),e(Z,Et),e(Et,ys),p(o,nr,f),p(o,M,f),w(Ge,M,null),e(M,Ts),e(M,ee),e(ee,Es),e(ee,Ho),e(Ho,Is),e(ee,xs),e(ee,Ye),e(Ye,Cs),e(ee,ks),e(M,zs),e(M,oe),e(oe,As),e(oe,Bo),e(Bo,Ms),e(oe,Ds),e(oe,Uo),e(Uo,js),e(oe,Ns),e(M,qs),w(_e,M,null),p(o,lr,f),p(o,te,f),e(te,ve),e(ve,It),w(Je,It,null),e(te,Ls),e(te,xt),e(xt,Ss),p(o,ir,f),p(o,re,f),w(Ke,re,null),e(re,Rs),e(re,Pe),w(Xe,Pe,null),e(Pe,Os),e(Pe,Ct),e(Ct,Hs),p(o,cr,f),p(o,ae,f),e(ae,be),e(be,kt),w(Qe,kt,null),e(ae,Bs),e(ae,zt),e(zt,Us),p(o,dr,f),p(o,S,f),w(Ze,S,null),e(S,Ws),e(S,At),e(At,Vs),e(S,Gs),e(S,we),w(eo,we,null),e(we,Ys),e(we,Mt),e(Mt,Js),p(o,mr,f),p(o,se,f),e(se,$e),e($e,Dt),w(oo,Dt,null),e(se,Ks),e(se,jt),e(jt,Xs),p(o,fr,f),p(o,R,f),w(to,R,null),e(R,Qs),e(R,ro),e(ro,Zs),e(ro,ao),e(ao,en),e(ro,on),e(R,tn),e(R,N),w(so,N,null),e(N,rn),e(N,ne),e(ne,an),e(ne,Wo),e(Wo,sn),e(ne,nn),e(ne,Nt),e(Nt,ln),e(ne,cn),e(N,dn),w(Fe,N,null),e(N,mn),w(ye,N,null),p(o,pr,f),p(o,le,f),e(le,Te),e(Te,qt),w(no,qt,null),e(le,fn),e(le,Lt),e(Lt,pn),p(o,hr,f),p(o,D,f),w(lo,D,null),e(D,hn),e(D,St),e(St,gn),e(D,un),e(D,io),e(io,_n),e(io,co),e(co,vn),e(io,Pn),e(D,bn),e(D,q),w(mo,q,null),e(q,wn),e(q,ie),e(ie,$n),e(ie,Vo),e(Vo,Fn),e(ie,yn),e(ie,Rt),e(Rt,Tn),e(ie,En),e(q,In),w(Ee,q,null),e(q,xn),w(Ie,q,null),gr=!0},p(o,[f]){const fo={};f&2&&(fo.$$scope={dirty:f,ctx:o}),_e.$set(fo);const Ot={};f&2&&(Ot.$$scope={dirty:f,ctx:o}),Fe.$set(Ot);const Ht={};f&2&&(Ht.$$scope={dirty:f,ctx:o}),ye.$set(Ht);const Bt={};f&2&&(Bt.$$scope={dirty:f,ctx:o}),Ee.$set(Bt);const po={};f&2&&(po.$$scope={dirty:f,ctx:o}),Ie.$set(po)},i(o){gr||($(m.$$.fragment,o),$(Me.$$.fragment,o),$(He.$$.fragment,o),$(Be.$$.fragment,o),$(Ve.$$.fragment,o),$(Ge.$$.fragment,o),$(_e.$$.fragment,o),$(Je.$$.fragment,o),$(Ke.$$.fragment,o),$(Xe.$$.fragment,o),$(Qe.$$.fragment,o),$(Ze.$$.fragment,o),$(eo.$$.fragment,o),$(oo.$$.fragment,o),$(to.$$.fragment,o),$(so.$$.fragment,o),$(Fe.$$.fragment,o),$(ye.$$.fragment,o),$(no.$$.fragment,o),$(lo.$$.fragment,o),$(mo.$$.fragment,o),$(Ee.$$.fragment,o),$(Ie.$$.fragment,o),gr=!0)},o(o){F(m.$$.fragment,o),F(Me.$$.fragment,o),F(He.$$.fragment,o),F(Be.$$.fragment,o),F(Ve.$$.fragment,o),F(Ge.$$.fragment,o),F(_e.$$.fragment,o),F(Je.$$.fragment,o),F(Ke.$$.fragment,o),F(Xe.$$.fragment,o),F(Qe.$$.fragment,o),F(Ze.$$.fragment,o),F(eo.$$.fragment,o),F(oo.$$.fragment,o),F(to.$$.fragment,o),F(so.$$.fragment,o),F(Fe.$$.fragment,o),F(ye.$$.fragment,o),F(no.$$.fragment,o),F(lo.$$.fragment,o),F(mo.$$.fragment,o),F(Ee.$$.fragment,o),F(Ie.$$.fragment,o),gr=!1},d(o){t(h),o&&t(T),o&&t(_),y(m),o&&t(Ut),o&&t(X),y(Me),o&&t(Wt),o&&t(me),o&&t(Vt),o&&t(go),o&&t(Gt),o&&t(uo),o&&t(Yt),o&&t(fe),o&&t(Jt),o&&t(Ne),o&&t(Kt),o&&t(_o),o&&t(Xt),o&&t(O),o&&t(Qt),o&&t(pe),o&&t(Zt),o&&t(H),o&&t(er),o&&t(Q),y(He),o&&t(or),o&&t(qo),o&&t(tr),y(Be,o),o&&t(rr),o&&t(ge),o&&t(ar),o&&t(Oo),o&&t(sr),o&&t(Z),y(Ve),o&&t(nr),o&&t(M),y(Ge),y(_e),o&&t(lr),o&&t(te),y(Je),o&&t(ir),o&&t(re),y(Ke),y(Xe),o&&t(cr),o&&t(ae),y(Qe),o&&t(dr),o&&t(S),y(Ze),y(eo),o&&t(mr),o&&t(se),y(oo),o&&t(fr),o&&t(R),y(to),y(so),y(Fe),y(ye),o&&t(pr),o&&t(le),y(no),o&&t(hr),o&&t(D),y(lo),y(mo),y(Ee),y(Ie)}}}const xi={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 bi(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class qi extends gi{constructor(h){super();ui(this,h,Ci,Ii,_i,{})}}export{qi as default,xi as metadata};
