import{S as El,i as zl,s as xl,e as t,k as i,w as b,t as n,M as Cl,c as a,d as r,m as c,a as s,x as w,h as l,b as d,N as kl,G as e,g as f,y as F,q as y,o as $,B as T,v as Ml,L as Ks}from"../../chunks/vendor-hf-doc-builder.js";import{T as Il}from"../../chunks/Tip-hf-doc-builder.js";import{D as le}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Xs}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as ao}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Js}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Al(N){let h,P,_,g,v;return g=new Xs({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=t("p"),P=n("Example:"),_=i(),b(g.$$.fragment)},l(m){h=a(m,"P",{});var u=s(h);P=l(u,"Example:"),u.forEach(r),_=c(m),w(g.$$.fragment,m)},m(m,u){f(m,h,u),e(h,P),f(m,_,u),F(g,m,u),v=!0},p:Ks,i(m){v||(y(g.$$.fragment,m),v=!0)},o(m){$(g.$$.fragment,m),v=!1},d(m){m&&r(h),m&&r(_),T(g,m)}}}function Dl(N){let h,P,_,g,v;return{c(){h=t("p"),P=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=t("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);P=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(r),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(r)},m(m,u){f(m,h,u),e(h,P),e(h,_),e(_,g),e(h,v)},d(m){m&&r(h)}}}function Nl(N){let h,P,_,g,v;return g=new Xs({props:{code:`from transformers import PoolFormerImageProcessor, PoolFormerModel
import torch
from datasets import load_dataset

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

feature_extractor = PoolFormerImageProcessor.from_pretrained("sail/poolformer_s12")
model = PoolFormerModel.from_pretrained("sail/poolformer_s12")

inputs = feature_extractor(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> PoolFormerImageProcessor, 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>feature_extractor = PoolFormerImageProcessor.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 = feature_extractor(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=t("p"),P=n("Example:"),_=i(),b(g.$$.fragment)},l(m){h=a(m,"P",{});var u=s(h);P=l(u,"Example:"),u.forEach(r),_=c(m),w(g.$$.fragment,m)},m(m,u){f(m,h,u),e(h,P),f(m,_,u),F(g,m,u),v=!0},p:Ks,i(m){v||(y(g.$$.fragment,m),v=!0)},o(m){$(g.$$.fragment,m),v=!1},d(m){m&&r(h),m&&r(_),T(g,m)}}}function ql(N){let h,P,_,g,v;return{c(){h=t("p"),P=n("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=t("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);P=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(r),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(r)},m(m,u){f(m,h,u),e(h,P),e(h,_),e(_,g),e(h,v)},d(m){m&&r(h)}}}function jl(N){let h,P,_,g,v;return g=new Xs({props:{code:`from transformers import PoolFormerImageProcessor, PoolFormerForImageClassification
import torch
from datasets import load_dataset

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

feature_extractor = PoolFormerImageProcessor.from_pretrained("sail/poolformer_s12")
model = PoolFormerForImageClassification.from_pretrained("sail/poolformer_s12")

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