import{S as ba,i as ya,s as va,e as r,k as u,w as y,t as i,M as Ma,c as s,d as o,m as g,a as n,x as v,h as l,b as m,G as t,g as p,y as M,q as F,o as $,B as S,v as Fa,L as No}from"../../chunks/vendor-hf-doc-builder.js";import{T as _a}from"../../chunks/Tip-hf-doc-builder.js";import{D as et}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Ro}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as tt}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as ko}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function $a(U){let c,b,w,f,_;return f=new Ro({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFN3aWZ0Rm9ybWVyQ29uZmlnJTJDJTIwU3dpZnRGb3JtZXJNb2RlbCUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBTd2lmdEZvcm1lciUyMHN3aWZ0Zm9ybWVyLWJhc2UtcGF0Y2gxNi0yMjQlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwU3dpZnRGb3JtZXJDb25maWcoKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBtb2RlbCUyMCh3aXRoJTIwcmFuZG9tJTIwd2VpZ2h0cyklMjBmcm9tJTIwdGhlJTIwc3dpZnRmb3JtZXItYmFzZS1wYXRjaDE2LTIyNCUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsJTIwJTNEJTIwU3dpZnRGb3JtZXJNb2RlbChjb25maWd1cmF0aW9uKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWc=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> SwiftFormerConfig, SwiftFormerModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a SwiftFormer swiftformer-base-patch16-224 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = SwiftFormerConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the swiftformer-base-patch16-224 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = SwiftFormerModel(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(){c=r("p"),b=i("Example:"),w=u(),y(f.$$.fragment)},l(a){c=s(a,"P",{});var h=n(c);b=l(h,"Example:"),h.forEach(o),w=g(a),v(f.$$.fragment,a)},m(a,h){p(a,c,h),t(c,b),p(a,w,h),M(f,a,h),_=!0},p:No,i(a){_||(F(f.$$.fragment,a),_=!0)},o(a){$(f.$$.fragment,a),_=!1},d(a){a&&o(c),a&&o(w),S(f,a)}}}function Sa(U){let c,b,w,f,_;return{c(){c=r("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),w=r("code"),f=i("Module"),_=i(`
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(a){c=s(a,"P",{});var h=n(c);b=l(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),w=s(h,"CODE",{});var E=n(w);f=l(E,"Module"),E.forEach(o),_=l(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(o)},m(a,h){p(a,c,h),t(c,b),t(c,w),t(w,f),t(c,_)},d(a){a&&o(c)}}}function Ta(U){let c,b,w,f,_;return f=new Ro({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFN3aWZ0Rm9ybWVyTW9kZWwlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBkYXRhc2V0cyUyMGltcG9ydCUyMGxvYWRfZGF0YXNldCUwQSUwQWRhdGFzZXQlMjAlM0QlMjBsb2FkX2RhdGFzZXQoJTIyaHVnZ2luZ2ZhY2UlMkZjYXRzLWltYWdlJTIyKSUwQWltYWdlJTIwJTNEJTIwZGF0YXNldCU1QiUyMnRlc3QlMjIlNUQlNUIlMjJpbWFnZSUyMiU1RCU1QjAlNUQlMEElMEFpbWFnZV9wcm9jZXNzb3IlMjAlM0QlMjBBdXRvSW1hZ2VQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMk1CWlVBSSUyRnN3aWZ0Zm9ybWVyLXhzJTIyKSUwQW1vZGVsJTIwJTNEJTIwU3dpZnRGb3JtZXJNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyTUJaVUFJJTJGc3dpZnRmb3JtZXIteHMlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwaW1hZ2VfcHJvY2Vzc29yKGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQSUwQWxhc3RfaGlkZGVuX3N0YXRlcyUyMCUzRCUyMG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGUlMEFsaXN0KGxhc3RfaGlkZGVuX3N0YXRlcy5zaGFwZSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, SwiftFormerModel
<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;MBZUAI/swiftformer-xs&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = SwiftFormerModel.from_pretrained(<span class="hljs-string">&quot;MBZUAI/swiftformer-xs&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">220</span>, <span class="hljs-number">7</span>, <span class="hljs-number">7</span>]`}}),{c(){c=r("p"),b=i("Example:"),w=u(),y(f.$$.fragment)},l(a){c=s(a,"P",{});var h=n(c);b=l(h,"Example:"),h.forEach(o),w=g(a),v(f.$$.fragment,a)},m(a,h){p(a,c,h),t(c,b),p(a,w,h),M(f,a,h),_=!0},p:No,i(a){_||(F(f.$$.fragment,a),_=!0)},o(a){$(f.$$.fragment,a),_=!1},d(a){a&&o(c),a&&o(w),S(f,a)}}}function Ca(U){let c,b,w,f,_;return{c(){c=r("p"),b=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),w=r("code"),f=i("Module"),_=i(`
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(a){c=s(a,"P",{});var h=n(c);b=l(h,"Although the recipe for forward pass needs to be defined within this function, one should call the "),w=s(h,"CODE",{});var E=n(w);f=l(E,"Module"),E.forEach(o),_=l(h,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),h.forEach(o)},m(a,h){p(a,c,h),t(c,b),t(c,w),t(w,f),t(c,_)},d(a){a&&o(c)}}}function Ua(U){let c,b,w,f,_;return f=new Ro({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFN3aWZ0Rm9ybWVyRm9ySW1hZ2VDbGFzc2lmaWNhdGlvbiUwQWltcG9ydCUyMHRvcmNoJTBBZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBZGF0YXNldCUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJodWdnaW5nZmFjZSUyRmNhdHMtaW1hZ2UlMjIpJTBBaW1hZ2UlMjAlM0QlMjBkYXRhc2V0JTVCJTIydGVzdCUyMiU1RCU1QiUyMmltYWdlJTIyJTVEJTVCMCU1RCUwQSUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMEF1dG9JbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIyTUJaVUFJJTJGc3dpZnRmb3JtZXIteHMlMjIpJTBBbW9kZWwlMjAlM0QlMjBTd2lmdEZvcm1lckZvckltYWdlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMk1CWlVBSSUyRnN3aWZ0Zm9ybWVyLXhzJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMGltYWdlX3Byb2Nlc3NvcihpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBd2l0aCUyMHRvcmNoLm5vX2dyYWQoKSUzQSUwQSUyMCUyMCUyMCUyMGxvZ2l0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKS5sb2dpdHMlMEElMEElMjMlMjBtb2RlbCUyMHByZWRpY3RzJTIwb25lJTIwb2YlMjB0aGUlMjAxMDAwJTIwSW1hZ2VOZXQlMjBjbGFzc2VzJTBBcHJlZGljdGVkX2xhYmVsJTIwJTNEJTIwbG9naXRzLmFyZ21heCgtMSkuaXRlbSgpJTBBcHJpbnQobW9kZWwuY29uZmlnLmlkMmxhYmVsJTVCcHJlZGljdGVkX2xhYmVsJTVEKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, SwiftFormerForImageClassification
<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;MBZUAI/swiftformer-xs&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = SwiftFormerForImageClassification.from_pretrained(<span class="hljs-string">&quot;MBZUAI/swiftformer-xs&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(){c=r("p"),b=i("Example:"),w=u(),y(f.$$.fragment)},l(a){c=s(a,"P",{});var h=n(c);b=l(h,"Example:"),h.forEach(o),w=g(a),v(f.$$.fragment,a)},m(a,h){p(a,c,h),t(c,b),p(a,w,h),M(f,a,h),_=!0},p:No,i(a){_||(F(f.$$.fragment,a),_=!0)},o(a){$(f.$$.fragment,a),_=!1},d(a){a&&o(c),a&&o(w),S(f,a)}}}function Ia(U){let c,b,w,f,_,a,h,E,$t,ot,x,G,Ae,oe,St,Ve,Tt,at,B,Ct,ae,Ut,It,rt,Me,jt,st,Fe,Et,nt,$e,Pe,Jt,it,Se,Zt,lt,Te,re,xt,Ce,Wt,kt,ct,Z,Nt,se,Rt,At,ne,Vt,Pt,mt,W,z,Ge,ie,Gt,Be,Bt,dt,T,le,zt,k,Xt,Ue,Qt,qt,ce,Yt,Ht,Ot,N,Dt,Ie,Lt,Kt,je,eo,to,oo,X,ft,R,Q,ze,me,ao,Xe,ro,ht,J,de,so,fe,no,he,io,lo,co,I,pe,mo,A,fo,Ee,ho,po,Qe,uo,go,wo,q,_o,Y,pt,V,H,qe,ue,bo,Ye,yo,ut,C,ge,vo,He,Mo,Fo,we,$o,_e,So,To,Co,j,be,Uo,P,Io,Je,jo,Eo,Oe,Jo,Zo,xo,O,Wo,D,gt;return a=new tt({}),oe=new tt({}),ie=new tt({}),le=new et({props:{name:"class transformers.SwiftFormerConfig",anchor:"transformers.SwiftFormerConfig",parameters:[{name:"num_channels",val:" = 3"},{name:"depths",val:" = [3, 3, 6, 4]"},{name:"embed_dims",val:" = [48, 56, 112, 220]"},{name:"mlp_ratio",val:" = 4"},{name:"downsamples",val:" = [True, True, True, True]"},{name:"hidden_act",val:" = 'gelu'"},{name:"down_patch_size",val:" = 3"},{name:"down_stride",val:" = 2"},{name:"down_pad",val:" = 1"},{name:"drop_path_rate",val:" = 0.0"},{name:"use_layer_scale",val:" = True"},{name:"layer_scale_init_value",val:" = 1e-05"},{name:"batch_norm_eps",val:" = 1e-05"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.SwiftFormerConfig.num_channels",description:`<strong>num_channels</strong> (<code>int</code>, <em>optional</em>, defaults to 3) &#x2014;
The number of input channels`,name:"num_channels"},{anchor:"transformers.SwiftFormerConfig.depths",description:`<strong>depths</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[3, 3, 6, 4]</code>) &#x2014;
Depth of each stage`,name:"depths"},{anchor:"transformers.SwiftFormerConfig.embed_dims",description:`<strong>embed_dims</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[48, 56, 112, 220]</code>) &#x2014;
The embedding dimension at each stage`,name:"embed_dims"},{anchor:"transformers.SwiftFormerConfig.mlp_ratio",description:`<strong>mlp_ratio</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
Ratio of size of the hidden dimensionality of an MLP to the dimensionality of its input.`,name:"mlp_ratio"},{anchor:"transformers.SwiftFormerConfig.downsamples",description:`<strong>downsamples</strong> (<code>List[bool]</code>, <em>optional</em>, defaults to <code>[True, True, True, True]</code>) &#x2014;
Whether or not to downsample inputs between two stages.`,name:"downsamples"},{anchor:"transformers.SwiftFormerConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;gelu&quot;</code>) &#x2014;
The non-linear activation function (string). <code>&quot;gelu&quot;</code>, <code>&quot;relu&quot;</code>, <code>&quot;selu&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.SwiftFormerConfig.down_patch_size",description:`<strong>down_patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3) &#x2014;
The size of patches in downsampling layers.`,name:"down_patch_size"},{anchor:"transformers.SwiftFormerConfig.down_stride",description:`<strong>down_stride</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
The stride of convolution kernels in downsampling layers.`,name:"down_stride"},{anchor:"transformers.SwiftFormerConfig.down_pad",description:`<strong>down_pad</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Padding in downsampling layers.`,name:"down_pad"},{anchor:"transformers.SwiftFormerConfig.drop_path_rate",description:`<strong>drop_path_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 0.) &#x2014;
Rate at which to increase dropout probability in DropPath.`,name:"drop_path_rate"},{anchor:"transformers.SwiftFormerConfig.use_layer_scale",description:`<strong>use_layer_scale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to scale outputs from token mixers.`,name:"use_layer_scale"},{anchor:"transformers.SwiftFormerConfig.layer_scale_init_value",description:`<strong>layer_scale_init_value</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-5) &#x2014;
Factor by which outputs from token mixers are scaled.`,name:"layer_scale_init_value"},{anchor:"transformers.SwiftFormerConfig.batch_norm_eps",description:`<strong>batch_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-5) &#x2014;
The epsilon used by the batch normalization layers.`,name:"batch_norm_eps"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/swiftformer/configuration_swiftformer.py#L34"}}),X=new ko({props:{anchor:"transformers.SwiftFormerConfig.example",$$slots:{default:[$a]},$$scope:{ctx:U}}}),me=new tt({}),de=new et({props:{name:"class transformers.SwiftFormerModel",anchor:"transformers.SwiftFormerModel",parameters:[{name:"config",val:": SwiftFormerConfig"}],parametersDescription:[{anchor:"transformers.SwiftFormerModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/swiftformer#transformers.SwiftFormerConfig">SwiftFormerConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/swiftformer/modeling_swiftformer.py#L479"}}),pe=new et({props:{name:"forward",anchor:"transformers.SwiftFormerModel.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.Tensor] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.SwiftFormerModel.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/mobilevit#transformers.MobileViTFeatureExtractor.__call__">ViTImageProcessor.<strong>call</strong>()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.SwiftFormerModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.SwiftFormerModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/swiftformer/modeling_swiftformer.py#L490",returnDescription:`
<p>A <code>transformers.modeling_outputs.BaseModelOutputWithNoAttention</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/swiftformer#transformers.SwiftFormerConfig"
>SwiftFormerConfig</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>
`}}),q=new _a({props:{$$slots:{default:[Sa]},$$scope:{ctx:U}}}),Y=new ko({props:{anchor:"transformers.SwiftFormerModel.forward.example",$$slots:{default:[Ta]},$$scope:{ctx:U}}}),ue=new tt({}),ge=new et({props:{name:"class transformers.SwiftFormerForImageClassification",anchor:"transformers.SwiftFormerForImageClassification",parameters:[{name:"config",val:": SwiftFormerConfig"}],parametersDescription:[{anchor:"transformers.SwiftFormerForImageClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/swiftformer#transformers.SwiftFormerConfig">SwiftFormerConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/swiftformer/modeling_swiftformer.py#L536"}}),be=new et({props:{name:"forward",anchor:"transformers.SwiftFormerForImageClassification.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.Tensor] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.SwiftFormerForImageClassification.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/mobilevit#transformers.MobileViTFeatureExtractor.__call__">ViTImageProcessor.<strong>call</strong>()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.SwiftFormerForImageClassification.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.SwiftFormerForImageClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.SwiftFormerForImageClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the image classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/swiftformer/modeling_swiftformer.py#L553",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutputWithNoAttention"
>transformers.modeling_outputs.ImageClassifierOutputWithNoAttention</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/swiftformer#transformers.SwiftFormerConfig"
>SwiftFormerConfig</a>) and inputs.</p>
<ul>
<li><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Classification (or regression if config.num_labels==1) loss.</li>
<li><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) \u2014 Classification (or regression if config.num_labels==1) scores (before SoftMax).</li>
<li><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each stage) of shape <code>(batch_size, num_channels, height, width)</code>. Hidden-states (also
called feature maps) of the model at the output of each stage.</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutputWithNoAttention"
>transformers.modeling_outputs.ImageClassifierOutputWithNoAttention</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),O=new _a({props:{$$slots:{default:[Ca]},$$scope:{ctx:U}}}),D=new ko({props:{anchor:"transformers.SwiftFormerForImageClassification.forward.example",$$slots:{default:[Ua]},$$scope:{ctx:U}}}),{c(){c=r("meta"),b=u(),w=r("h1"),f=r("a"),_=r("span"),y(a.$$.fragment),h=u(),E=r("span"),$t=i("SwiftFormer"),ot=u(),x=r("h2"),G=r("a"),Ae=r("span"),y(oe.$$.fragment),St=u(),Ve=r("span"),Tt=i("Overview"),at=u(),B=r("p"),Ct=i("The SwiftFormer model was proposed in "),ae=r("a"),Ut=i("SwiftFormer: Efficient Additive Attention for Transformer-based Real-time Mobile Vision Applications"),It=i(" by Abdelrahman Shaker, Muhammad Maaz, Hanoona Rasheed, Salman Khan, Ming-Hsuan Yang, Fahad Shahbaz Khan."),rt=u(),Me=r("p"),jt=i("The SwiftFormer paper introduces a novel efficient additive attention mechanism that effectively replaces the quadratic matrix multiplication operations in the self-attention computation with linear element-wise multiplications. A series of models called \u2018SwiftFormer\u2019 is built based on this, which achieves state-of-the-art performance in terms of both accuracy and mobile inference speed. Even their small variant achieves 78.5% top-1 ImageNet1K accuracy with only 0.8 ms latency on iPhone 14, which is more accurate and 2\xD7 faster compared to MobileViT-v2."),st=u(),Fe=r("p"),Et=i("The abstract from the paper is the following:"),nt=u(),$e=r("p"),Pe=r("em"),Jt=i("Self-attention has become a defacto choice for capturing global context in various vision applications. However, its quadratic computational complexity with respect to image resolution limits its use in real-time applications, especially for deployment on resource-constrained mobile devices. Although hybrid approaches have been proposed to combine the advantages of convolutions and self-attention for a better speed-accuracy trade-off, the expensive matrix multiplication operations in self-attention remain a bottleneck. In this work, we introduce a novel efficient additive attention mechanism that effectively replaces the quadratic matrix multiplication operations with linear element-wise multiplications. Our design shows that the key-value interaction can be replaced with a linear layer without sacrificing any accuracy. Unlike previous state-of-the-art methods, our efficient formulation of self-attention enables its usage at all stages of the network. Using our proposed efficient additive attention, we build a series of models called \u201CSwiftFormer\u201D which achieves state-of-the-art performance in terms of both accuracy and mobile inference speed. Our small variant achieves 78.5% top-1 ImageNet-1K accuracy with only 0.8 ms latency on iPhone 14, which is more accurate and 2x faster compared to MobileViT-v2."),it=u(),Se=r("p"),Zt=i("Tips:"),lt=u(),Te=r("ul"),re=r("li"),xt=i("One can use the "),Ce=r("a"),Wt=i("ViTImageProcessor"),kt=i(" API to prepare images for the model."),ct=u(),Z=r("p"),Nt=i("This model was contributed by "),se=r("a"),Rt=i("shehan97"),At=i(`.
The original code can be found `),ne=r("a"),Vt=i("here"),Pt=i("."),mt=u(),W=r("h2"),z=r("a"),Ge=r("span"),y(ie.$$.fragment),Gt=u(),Be=r("span"),Bt=i("SwiftFormerConfig"),dt=u(),T=r("div"),y(le.$$.fragment),zt=u(),k=r("p"),Xt=i("This is the configuration class to store the configuration of a "),Ue=r("a"),Qt=i("SwiftFormerModel"),qt=i(`. It is used to instantiate an
SwiftFormer 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 SwiftFormer
`),ce=r("a"),Yt=i("MBZUAI/swiftformer-xs"),Ht=i(" architecture."),Ot=u(),N=r("p"),Dt=i("Configuration objects inherit from "),Ie=r("a"),Lt=i("PretrainedConfig"),Kt=i(` and can be used to control the model outputs. Read the
documentation from `),je=r("a"),eo=i("PretrainedConfig"),to=i(" for more information."),oo=u(),y(X.$$.fragment),ft=u(),R=r("h2"),Q=r("a"),ze=r("span"),y(me.$$.fragment),ao=u(),Xe=r("span"),ro=i("SwiftFormerModel"),ht=u(),J=r("div"),y(de.$$.fragment),so=u(),fe=r("p"),no=i(`The bare SwiftFormer Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),he=r("a"),io=i("torch.nn.Module"),lo=i(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),co=u(),I=r("div"),y(pe.$$.fragment),mo=u(),A=r("p"),fo=i("The "),Ee=r("a"),ho=i("SwiftFormerModel"),po=i(" forward method, overrides the "),Qe=r("code"),uo=i("__call__"),go=i(" special method."),wo=u(),y(q.$$.fragment),_o=u(),y(Y.$$.fragment),pt=u(),V=r("h2"),H=r("a"),qe=r("span"),y(ue.$$.fragment),bo=u(),Ye=r("span"),yo=i("SwiftFormerForImageClassification"),ut=u(),C=r("div"),y(ge.$$.fragment),vo=u(),He=r("p"),Mo=i("SwiftFormer Model transformer with an image classification head on top (e.g. for ImageNet)."),Fo=u(),we=r("p"),$o=i("This model is a PyTorch "),_e=r("a"),So=i("torch.nn.Module"),To=i(` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Co=u(),j=r("div"),y(be.$$.fragment),Uo=u(),P=r("p"),Io=i("The "),Je=r("a"),jo=i("SwiftFormerForImageClassification"),Eo=i(" forward method, overrides the "),Oe=r("code"),Jo=i("__call__"),Zo=i(" special method."),xo=u(),y(O.$$.fragment),Wo=u(),y(D.$$.fragment),this.h()},l(e){const d=Ma('[data-svelte="svelte-1phssyn"]',document.head);c=s(d,"META",{name:!0,content:!0}),d.forEach(o),b=g(e),w=s(e,"H1",{class:!0});var ye=n(w);f=s(ye,"A",{id:!0,class:!0,href:!0});var De=n(f);_=s(De,"SPAN",{});var Le=n(_);v(a.$$.fragment,Le),Le.forEach(o),De.forEach(o),h=g(ye),E=s(ye,"SPAN",{});var Ke=n(E);$t=l(Ke,"SwiftFormer"),Ke.forEach(o),ye.forEach(o),ot=g(e),x=s(e,"H2",{class:!0});var ve=n(x);G=s(ve,"A",{id:!0,class:!0,href:!0});var Ao=n(G);Ae=s(Ao,"SPAN",{});var Vo=n(Ae);v(oe.$$.fragment,Vo),Vo.forEach(o),Ao.forEach(o),St=g(ve),Ve=s(ve,"SPAN",{});var Po=n(Ve);Tt=l(Po,"Overview"),Po.forEach(o),ve.forEach(o),at=g(e),B=s(e,"P",{});var wt=n(B);Ct=l(wt,"The SwiftFormer model was proposed in "),ae=s(wt,"A",{href:!0,rel:!0});var Go=n(ae);Ut=l(Go,"SwiftFormer: Efficient Additive Attention for Transformer-based Real-time Mobile Vision Applications"),Go.forEach(o),It=l(wt," by Abdelrahman Shaker, Muhammad Maaz, Hanoona Rasheed, Salman Khan, Ming-Hsuan Yang, Fahad Shahbaz Khan."),wt.forEach(o),rt=g(e),Me=s(e,"P",{});var Bo=n(Me);jt=l(Bo,"The SwiftFormer paper introduces a novel efficient additive attention mechanism that effectively replaces the quadratic matrix multiplication operations in the self-attention computation with linear element-wise multiplications. A series of models called \u2018SwiftFormer\u2019 is built based on this, which achieves state-of-the-art performance in terms of both accuracy and mobile inference speed. Even their small variant achieves 78.5% top-1 ImageNet1K accuracy with only 0.8 ms latency on iPhone 14, which is more accurate and 2\xD7 faster compared to MobileViT-v2."),Bo.forEach(o),st=g(e),Fe=s(e,"P",{});var zo=n(Fe);Et=l(zo,"The abstract from the paper is the following:"),zo.forEach(o),nt=g(e),$e=s(e,"P",{});var Xo=n($e);Pe=s(Xo,"EM",{});var Qo=n(Pe);Jt=l(Qo,"Self-attention has become a defacto choice for capturing global context in various vision applications. However, its quadratic computational complexity with respect to image resolution limits its use in real-time applications, especially for deployment on resource-constrained mobile devices. Although hybrid approaches have been proposed to combine the advantages of convolutions and self-attention for a better speed-accuracy trade-off, the expensive matrix multiplication operations in self-attention remain a bottleneck. In this work, we introduce a novel efficient additive attention mechanism that effectively replaces the quadratic matrix multiplication operations with linear element-wise multiplications. Our design shows that the key-value interaction can be replaced with a linear layer without sacrificing any accuracy. Unlike previous state-of-the-art methods, our efficient formulation of self-attention enables its usage at all stages of the network. Using our proposed efficient additive attention, we build a series of models called \u201CSwiftFormer\u201D which achieves state-of-the-art performance in terms of both accuracy and mobile inference speed. Our small variant achieves 78.5% top-1 ImageNet-1K accuracy with only 0.8 ms latency on iPhone 14, which is more accurate and 2x faster compared to MobileViT-v2."),Qo.forEach(o),Xo.forEach(o),it=g(e),Se=s(e,"P",{});var qo=n(Se);Zt=l(qo,"Tips:"),qo.forEach(o),lt=g(e),Te=s(e,"UL",{});var Yo=n(Te);re=s(Yo,"LI",{});var _t=n(re);xt=l(_t,"One can use the "),Ce=s(_t,"A",{href:!0});var Ho=n(Ce);Wt=l(Ho,"ViTImageProcessor"),Ho.forEach(o),kt=l(_t," API to prepare images for the model."),_t.forEach(o),Yo.forEach(o),ct=g(e),Z=s(e,"P",{});var Ze=n(Z);Nt=l(Ze,"This model was contributed by "),se=s(Ze,"A",{href:!0,rel:!0});var Oo=n(se);Rt=l(Oo,"shehan97"),Oo.forEach(o),At=l(Ze,`.
The original code can be found `),ne=s(Ze,"A",{href:!0,rel:!0});var Do=n(ne);Vt=l(Do,"here"),Do.forEach(o),Pt=l(Ze,"."),Ze.forEach(o),mt=g(e),W=s(e,"H2",{class:!0});var bt=n(W);z=s(bt,"A",{id:!0,class:!0,href:!0});var Lo=n(z);Ge=s(Lo,"SPAN",{});var Ko=n(Ge);v(ie.$$.fragment,Ko),Ko.forEach(o),Lo.forEach(o),Gt=g(bt),Be=s(bt,"SPAN",{});var ea=n(Be);Bt=l(ea,"SwiftFormerConfig"),ea.forEach(o),bt.forEach(o),dt=g(e),T=s(e,"DIV",{class:!0});var L=n(T);v(le.$$.fragment,L),zt=g(L),k=s(L,"P",{});var xe=n(k);Xt=l(xe,"This is the configuration class to store the configuration of a "),Ue=s(xe,"A",{href:!0});var ta=n(Ue);Qt=l(ta,"SwiftFormerModel"),ta.forEach(o),qt=l(xe,`. It is used to instantiate an
SwiftFormer 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 SwiftFormer
`),ce=s(xe,"A",{href:!0,rel:!0});var oa=n(ce);Yt=l(oa,"MBZUAI/swiftformer-xs"),oa.forEach(o),Ht=l(xe," architecture."),xe.forEach(o),Ot=g(L),N=s(L,"P",{});var We=n(N);Dt=l(We,"Configuration objects inherit from "),Ie=s(We,"A",{href:!0});var aa=n(Ie);Lt=l(aa,"PretrainedConfig"),aa.forEach(o),Kt=l(We,` and can be used to control the model outputs. Read the
documentation from `),je=s(We,"A",{href:!0});var ra=n(je);eo=l(ra,"PretrainedConfig"),ra.forEach(o),to=l(We," for more information."),We.forEach(o),oo=g(L),v(X.$$.fragment,L),L.forEach(o),ft=g(e),R=s(e,"H2",{class:!0});var yt=n(R);Q=s(yt,"A",{id:!0,class:!0,href:!0});var sa=n(Q);ze=s(sa,"SPAN",{});var na=n(ze);v(me.$$.fragment,na),na.forEach(o),sa.forEach(o),ao=g(yt),Xe=s(yt,"SPAN",{});var ia=n(Xe);ro=l(ia,"SwiftFormerModel"),ia.forEach(o),yt.forEach(o),ht=g(e),J=s(e,"DIV",{class:!0});var ke=n(J);v(de.$$.fragment,ke),so=g(ke),fe=s(ke,"P",{});var vt=n(fe);no=l(vt,`The bare SwiftFormer Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),he=s(vt,"A",{href:!0,rel:!0});var la=n(he);io=l(la,"torch.nn.Module"),la.forEach(o),lo=l(vt,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),vt.forEach(o),co=g(ke),I=s(ke,"DIV",{class:!0});var K=n(I);v(pe.$$.fragment,K),mo=g(K),A=s(K,"P",{});var Ne=n(A);fo=l(Ne,"The "),Ee=s(Ne,"A",{href:!0});var ca=n(Ee);ho=l(ca,"SwiftFormerModel"),ca.forEach(o),po=l(Ne," forward method, overrides the "),Qe=s(Ne,"CODE",{});var ma=n(Qe);uo=l(ma,"__call__"),ma.forEach(o),go=l(Ne," special method."),Ne.forEach(o),wo=g(K),v(q.$$.fragment,K),_o=g(K),v(Y.$$.fragment,K),K.forEach(o),ke.forEach(o),pt=g(e),V=s(e,"H2",{class:!0});var Mt=n(V);H=s(Mt,"A",{id:!0,class:!0,href:!0});var da=n(H);qe=s(da,"SPAN",{});var fa=n(qe);v(ue.$$.fragment,fa),fa.forEach(o),da.forEach(o),bo=g(Mt),Ye=s(Mt,"SPAN",{});var ha=n(Ye);yo=l(ha,"SwiftFormerForImageClassification"),ha.forEach(o),Mt.forEach(o),ut=g(e),C=s(e,"DIV",{class:!0});var ee=n(C);v(ge.$$.fragment,ee),vo=g(ee),He=s(ee,"P",{});var pa=n(He);Mo=l(pa,"SwiftFormer Model transformer with an image classification head on top (e.g. for ImageNet)."),pa.forEach(o),Fo=g(ee),we=s(ee,"P",{});var Ft=n(we);$o=l(Ft,"This model is a PyTorch "),_e=s(Ft,"A",{href:!0,rel:!0});var ua=n(_e);So=l(ua,"torch.nn.Module"),ua.forEach(o),To=l(Ft,` subclass. Use it
as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ft.forEach(o),Co=g(ee),j=s(ee,"DIV",{class:!0});var te=n(j);v(be.$$.fragment,te),Uo=g(te),P=s(te,"P",{});var Re=n(P);Io=l(Re,"The "),Je=s(Re,"A",{href:!0});var ga=n(Je);jo=l(ga,"SwiftFormerForImageClassification"),ga.forEach(o),Eo=l(Re," forward method, overrides the "),Oe=s(Re,"CODE",{});var wa=n(Oe);Jo=l(wa,"__call__"),wa.forEach(o),Zo=l(Re," special method."),Re.forEach(o),xo=g(te),v(O.$$.fragment,te),Wo=g(te),v(D.$$.fragment,te),te.forEach(o),ee.forEach(o),this.h()},h(){m(c,"name","hf:doc:metadata"),m(c,"content",JSON.stringify(ja)),m(f,"id","swiftformer"),m(f,"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"),m(f,"href","#swiftformer"),m(w,"class","relative group"),m(G,"id","overview"),m(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"),m(G,"href","#overview"),m(x,"class","relative group"),m(ae,"href","https://arxiv.org/abs/2303.15446"),m(ae,"rel","nofollow"),m(Ce,"href","/docs/transformers/main/en/model_doc/vit#transformers.ViTImageProcessor"),m(se,"href","https://huggingface.co/shehan97"),m(se,"rel","nofollow"),m(ne,"href","https://github.com/Amshaker/SwiftFormer"),m(ne,"rel","nofollow"),m(z,"id","transformers.SwiftFormerConfig"),m(z,"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"),m(z,"href","#transformers.SwiftFormerConfig"),m(W,"class","relative group"),m(Ue,"href","/docs/transformers/main/en/model_doc/swiftformer#transformers.SwiftFormerModel"),m(ce,"href","https://huggingface.co/MBZUAI/swiftformer-xs"),m(ce,"rel","nofollow"),m(Ie,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),m(je,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),m(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Q,"id","transformers.SwiftFormerModel"),m(Q,"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"),m(Q,"href","#transformers.SwiftFormerModel"),m(R,"class","relative group"),m(he,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),m(he,"rel","nofollow"),m(Ee,"href","/docs/transformers/main/en/model_doc/swiftformer#transformers.SwiftFormerModel"),m(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(H,"id","transformers.SwiftFormerForImageClassification"),m(H,"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"),m(H,"href","#transformers.SwiftFormerForImageClassification"),m(V,"class","relative group"),m(_e,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),m(_e,"rel","nofollow"),m(Je,"href","/docs/transformers/main/en/model_doc/swiftformer#transformers.SwiftFormerForImageClassification"),m(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,d){t(document.head,c),p(e,b,d),p(e,w,d),t(w,f),t(f,_),M(a,_,null),t(w,h),t(w,E),t(E,$t),p(e,ot,d),p(e,x,d),t(x,G),t(G,Ae),M(oe,Ae,null),t(x,St),t(x,Ve),t(Ve,Tt),p(e,at,d),p(e,B,d),t(B,Ct),t(B,ae),t(ae,Ut),t(B,It),p(e,rt,d),p(e,Me,d),t(Me,jt),p(e,st,d),p(e,Fe,d),t(Fe,Et),p(e,nt,d),p(e,$e,d),t($e,Pe),t(Pe,Jt),p(e,it,d),p(e,Se,d),t(Se,Zt),p(e,lt,d),p(e,Te,d),t(Te,re),t(re,xt),t(re,Ce),t(Ce,Wt),t(re,kt),p(e,ct,d),p(e,Z,d),t(Z,Nt),t(Z,se),t(se,Rt),t(Z,At),t(Z,ne),t(ne,Vt),t(Z,Pt),p(e,mt,d),p(e,W,d),t(W,z),t(z,Ge),M(ie,Ge,null),t(W,Gt),t(W,Be),t(Be,Bt),p(e,dt,d),p(e,T,d),M(le,T,null),t(T,zt),t(T,k),t(k,Xt),t(k,Ue),t(Ue,Qt),t(k,qt),t(k,ce),t(ce,Yt),t(k,Ht),t(T,Ot),t(T,N),t(N,Dt),t(N,Ie),t(Ie,Lt),t(N,Kt),t(N,je),t(je,eo),t(N,to),t(T,oo),M(X,T,null),p(e,ft,d),p(e,R,d),t(R,Q),t(Q,ze),M(me,ze,null),t(R,ao),t(R,Xe),t(Xe,ro),p(e,ht,d),p(e,J,d),M(de,J,null),t(J,so),t(J,fe),t(fe,no),t(fe,he),t(he,io),t(fe,lo),t(J,co),t(J,I),M(pe,I,null),t(I,mo),t(I,A),t(A,fo),t(A,Ee),t(Ee,ho),t(A,po),t(A,Qe),t(Qe,uo),t(A,go),t(I,wo),M(q,I,null),t(I,_o),M(Y,I,null),p(e,pt,d),p(e,V,d),t(V,H),t(H,qe),M(ue,qe,null),t(V,bo),t(V,Ye),t(Ye,yo),p(e,ut,d),p(e,C,d),M(ge,C,null),t(C,vo),t(C,He),t(He,Mo),t(C,Fo),t(C,we),t(we,$o),t(we,_e),t(_e,So),t(we,To),t(C,Co),t(C,j),M(be,j,null),t(j,Uo),t(j,P),t(P,Io),t(P,Je),t(Je,jo),t(P,Eo),t(P,Oe),t(Oe,Jo),t(P,Zo),t(j,xo),M(O,j,null),t(j,Wo),M(D,j,null),gt=!0},p(e,[d]){const ye={};d&2&&(ye.$$scope={dirty:d,ctx:e}),X.$set(ye);const De={};d&2&&(De.$$scope={dirty:d,ctx:e}),q.$set(De);const Le={};d&2&&(Le.$$scope={dirty:d,ctx:e}),Y.$set(Le);const Ke={};d&2&&(Ke.$$scope={dirty:d,ctx:e}),O.$set(Ke);const ve={};d&2&&(ve.$$scope={dirty:d,ctx:e}),D.$set(ve)},i(e){gt||(F(a.$$.fragment,e),F(oe.$$.fragment,e),F(ie.$$.fragment,e),F(le.$$.fragment,e),F(X.$$.fragment,e),F(me.$$.fragment,e),F(de.$$.fragment,e),F(pe.$$.fragment,e),F(q.$$.fragment,e),F(Y.$$.fragment,e),F(ue.$$.fragment,e),F(ge.$$.fragment,e),F(be.$$.fragment,e),F(O.$$.fragment,e),F(D.$$.fragment,e),gt=!0)},o(e){$(a.$$.fragment,e),$(oe.$$.fragment,e),$(ie.$$.fragment,e),$(le.$$.fragment,e),$(X.$$.fragment,e),$(me.$$.fragment,e),$(de.$$.fragment,e),$(pe.$$.fragment,e),$(q.$$.fragment,e),$(Y.$$.fragment,e),$(ue.$$.fragment,e),$(ge.$$.fragment,e),$(be.$$.fragment,e),$(O.$$.fragment,e),$(D.$$.fragment,e),gt=!1},d(e){o(c),e&&o(b),e&&o(w),S(a),e&&o(ot),e&&o(x),S(oe),e&&o(at),e&&o(B),e&&o(rt),e&&o(Me),e&&o(st),e&&o(Fe),e&&o(nt),e&&o($e),e&&o(it),e&&o(Se),e&&o(lt),e&&o(Te),e&&o(ct),e&&o(Z),e&&o(mt),e&&o(W),S(ie),e&&o(dt),e&&o(T),S(le),S(X),e&&o(ft),e&&o(R),S(me),e&&o(ht),e&&o(J),S(de),S(pe),S(q),S(Y),e&&o(pt),e&&o(V),S(ue),e&&o(ut),e&&o(C),S(ge),S(be),S(O),S(D)}}}const ja={local:"swiftformer",sections:[{local:"overview",title:"Overview"},{local:"transformers.SwiftFormerConfig",title:"SwiftFormerConfig"},{local:"transformers.SwiftFormerModel",title:"SwiftFormerModel"},{local:"transformers.SwiftFormerForImageClassification",title:"SwiftFormerForImageClassification"}],title:"SwiftFormer"};function Ea(U){return Fa(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ra extends ba{constructor(c){super();ya(this,c,Ea,Ia,va,{})}}export{Ra as default,ja as metadata};
