import{S as Sa,i as ka,s as ja,e as n,k as u,w as b,t as i,M as Ia,c as s,d as o,m as g,a,x as y,h as l,b as c,G as t,g as h,y as M,q as T,o as $,B as S,v as Fa,L as Co}from"../../chunks/vendor-hf-doc-builder.js";import{T as Eo}from"../../chunks/Tip-hf-doc-builder.js";import{D as He}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Uo}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Oe}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Jo}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as Ea}from"../../chunks/PipelineTag-hf-doc-builder.js";function Ja(k){let d,v,w,f,_;return f=new Uo({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFN3aW52MkNvbmZpZyUyQyUyMFN3aW52Mk1vZGVsJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMFN3aW52MiUyMG1pY3Jvc29mdCUyRnN3aW52Mi10aW55LXBhdGNoNC13aW5kb3c4LTI1NiUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBTd2ludjJDb25maWcoKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBtb2RlbCUyMCh3aXRoJTIwcmFuZG9tJTIwd2VpZ2h0cyklMjBmcm9tJTIwdGhlJTIwbWljcm9zb2Z0JTJGc3dpbnYyLXRpbnktcGF0Y2g0LXdpbmRvdzgtMjU2JTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBTd2ludjJNb2RlbChjb25maWd1cmF0aW9uKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWc=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Swinv2Config, Swinv2Model

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Swinv2 microsoft/swinv2-tiny-patch4-window8-256 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = Swinv2Config()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the microsoft/swinv2-tiny-patch4-window8-256 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Swinv2Model(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(){d=n("p"),v=i("Example:"),w=u(),b(f.$$.fragment)},l(r){d=s(r,"P",{});var m=a(d);v=l(m,"Example:"),m.forEach(o),w=g(r),y(f.$$.fragment,r)},m(r,m){h(r,d,m),t(d,v),h(r,w,m),M(f,r,m),_=!0},p:Co,i(r){_||(T(f.$$.fragment,r),_=!0)},o(r){$(f.$$.fragment,r),_=!1},d(r){r&&o(d),r&&o(w),S(f,r)}}}function Ca(k){let d,v,w,f,_;return{c(){d=n("p"),v=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),w=n("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(r){d=s(r,"P",{});var m=a(d);v=l(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),w=s(m,"CODE",{});var j=a(w);f=l(j,"Module"),j.forEach(o),_=l(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(r,m){h(r,d,m),t(d,v),t(d,w),t(w,f),t(d,_)},d(r){r&&o(d)}}}function Ua(k){let d,v,w,f,_;return f=new Uo({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFN3aW52Mk1vZGVsJTBBaW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGF0YXNldHMlMjBpbXBvcnQlMjBsb2FkX2RhdGFzZXQlMEElMEFkYXRhc2V0JTIwJTNEJTIwbG9hZF9kYXRhc2V0KCUyMmh1Z2dpbmdmYWNlJTJGY2F0cy1pbWFnZSUyMiklMEFpbWFnZSUyMCUzRCUyMGRhdGFzZXQlNUIlMjJ0ZXN0JTIyJTVEJTVCJTIyaW1hZ2UlMjIlNUQlNUIwJTVEJTBBJTBBaW1hZ2VfcHJvY2Vzc29yJTIwJTNEJTIwQXV0b0ltYWdlUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJtaWNyb3NvZnQlMkZzd2ludjItdGlueS1wYXRjaDQtd2luZG93OC0yNTYlMjIpJTBBbW9kZWwlMjAlM0QlMjBTd2ludjJNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIybWljcm9zb2Z0JTJGc3dpbnYyLXRpbnktcGF0Y2g0LXdpbmRvdzgtMjU2JTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMGltYWdlX3Byb2Nlc3NvcihpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBd2l0aCUyMHRvcmNoLm5vX2dyYWQoKSUzQSUwQSUyMCUyMCUyMCUyMG91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEElMEFsYXN0X2hpZGRlbl9zdGF0ZXMlMjAlM0QlMjBvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRlJTBBbGlzdChsYXN0X2hpZGRlbl9zdGF0ZXMuc2hhcGUp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, Swinv2Model
<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;microsoft/swinv2-tiny-patch4-window8-256&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Swinv2Model.from_pretrained(<span class="hljs-string">&quot;microsoft/swinv2-tiny-patch4-window8-256&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">64</span>, <span class="hljs-number">768</span>]`}}),{c(){d=n("p"),v=i("Example:"),w=u(),b(f.$$.fragment)},l(r){d=s(r,"P",{});var m=a(d);v=l(m,"Example:"),m.forEach(o),w=g(r),y(f.$$.fragment,r)},m(r,m){h(r,d,m),t(d,v),h(r,w,m),M(f,r,m),_=!0},p:Co,i(r){_||(T(f.$$.fragment,r),_=!0)},o(r){$(f.$$.fragment,r),_=!1},d(r){r&&o(d),r&&o(w),S(f,r)}}}function Wa(k){let d,v,w,f,_;return{c(){d=n("p"),v=i("Note that we provide a script to pre-train this model on custom data in our "),w=n("a"),f=i(`examples
directory`),_=i("."),this.h()},l(r){d=s(r,"P",{});var m=a(d);v=l(m,"Note that we provide a script to pre-train this model on custom data in our "),w=s(m,"A",{href:!0,rel:!0});var j=a(w);f=l(j,`examples
directory`),j.forEach(o),_=l(m,"."),m.forEach(o),this.h()},h(){c(w,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-pretraining"),c(w,"rel","nofollow")},m(r,m){h(r,d,m),t(d,v),t(d,w),t(w,f),t(d,_)},d(r){r&&o(d)}}}function Za(k){let d,v,w,f,_;return{c(){d=n("p"),v=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),w=n("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(r){d=s(r,"P",{});var m=a(d);v=l(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),w=s(m,"CODE",{});var j=a(w);f=l(j,"Module"),j.forEach(o),_=l(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(r,m){h(r,d,m),t(d,v),t(d,w),t(w,f),t(d,_)},d(r){r&&o(d)}}}function xa(k){let d,v,w,f,_;return f=new Uo({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFN3aW52MkZvck1hc2tlZEltYWdlTW9kZWxpbmclMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBQSUwlMjBpbXBvcnQlMjBJbWFnZSUwQWltcG9ydCUyMHJlcXVlc3RzJTBBJTBBdXJsJTIwJTNEJTIwJTIyaHR0cCUzQSUyRiUyRmltYWdlcy5jb2NvZGF0YXNldC5vcmclMkZ2YWwyMDE3JTJGMDAwMDAwMDM5NzY5LmpwZyUyMiUwQWltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUwQSUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMEF1dG9JbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIybWljcm9zb2Z0JTJGc3dpbnYyLXRpbnktcGF0Y2g0LXdpbmRvdzgtMjU2JTIyKSUwQW1vZGVsJTIwJTNEJTIwU3dpbnYyRm9yTWFza2VkSW1hZ2VNb2RlbGluZy5mcm9tX3ByZXRyYWluZWQoJTIybWljcm9zb2Z0JTJGc3dpbnYyLXRpbnktcGF0Y2g0LXdpbmRvdzgtMjU2JTIyKSUwQSUwQW51bV9wYXRjaGVzJTIwJTNEJTIwKG1vZGVsLmNvbmZpZy5pbWFnZV9zaXplJTIwJTJGJTJGJTIwbW9kZWwuY29uZmlnLnBhdGNoX3NpemUpJTIwKiolMjAyJTBBcGl4ZWxfdmFsdWVzJTIwJTNEJTIwaW1hZ2VfcHJvY2Vzc29yKGltYWdlcyUzRGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMikucGl4ZWxfdmFsdWVzJTBBJTIzJTIwY3JlYXRlJTIwcmFuZG9tJTIwYm9vbGVhbiUyMG1hc2slMjBvZiUyMHNoYXBlJTIwKGJhdGNoX3NpemUlMkMlMjBudW1fcGF0Y2hlcyklMEFib29sX21hc2tlZF9wb3MlMjAlM0QlMjB0b3JjaC5yYW5kaW50KGxvdyUzRDAlMkMlMjBoaWdoJTNEMiUyQyUyMHNpemUlM0QoMSUyQyUyMG51bV9wYXRjaGVzKSkuYm9vbCgpJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKHBpeGVsX3ZhbHVlcyUyQyUyMGJvb2xfbWFza2VkX3BvcyUzRGJvb2xfbWFza2VkX3BvcyklMEFsb3NzJTJDJTIwcmVjb25zdHJ1Y3RlZF9waXhlbF92YWx1ZXMlMjAlM0QlMjBvdXRwdXRzLmxvc3MlMkMlMjBvdXRwdXRzLnJlY29uc3RydWN0aW9uJTBBbGlzdChyZWNvbnN0cnVjdGVkX3BpeGVsX3ZhbHVlcy5zaGFwZSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, Swinv2ForMaskedImageModeling
<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> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;http://images.cocodataset.org/val2017/000000039769.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;microsoft/swinv2-tiny-patch4-window8-256&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Swinv2ForMaskedImageModeling.from_pretrained(<span class="hljs-string">&quot;microsoft/swinv2-tiny-patch4-window8-256&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>num_patches = (model.config.image_size // model.config.patch_size) ** <span class="hljs-number">2</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pixel_values = image_processor(images=image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).pixel_values
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># create random boolean mask of shape (batch_size, num_patches)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>bool_masked_pos = torch.randint(low=<span class="hljs-number">0</span>, high=<span class="hljs-number">2</span>, size=(<span class="hljs-number">1</span>, num_patches)).<span class="hljs-built_in">bool</span>()

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(pixel_values, bool_masked_pos=bool_masked_pos)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss, reconstructed_pixel_values = outputs.loss, outputs.reconstruction
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(reconstructed_pixel_values.shape)
[<span class="hljs-number">1</span>, <span class="hljs-number">3</span>, <span class="hljs-number">256</span>, <span class="hljs-number">256</span>]`}}),{c(){d=n("p"),v=i("Examples:"),w=u(),b(f.$$.fragment)},l(r){d=s(r,"P",{});var m=a(d);v=l(m,"Examples:"),m.forEach(o),w=g(r),y(f.$$.fragment,r)},m(r,m){h(r,d,m),t(d,v),h(r,w,m),M(f,r,m),_=!0},p:Co,i(r){_||(T(f.$$.fragment,r),_=!0)},o(r){$(f.$$.fragment,r),_=!1},d(r){r&&o(d),r&&o(w),S(f,r)}}}function Na(k){let d,v,w,f,_;return{c(){d=n("p"),v=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),w=n("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(r){d=s(r,"P",{});var m=a(d);v=l(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),w=s(m,"CODE",{});var j=a(w);f=l(j,"Module"),j.forEach(o),_=l(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(r,m){h(r,d,m),t(d,v),t(d,w),t(w,f),t(d,_)},d(r){r&&o(d)}}}function za(k){let d,v,w,f,_;return f=new Uo({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFN3aW52MkZvckltYWdlQ2xhc3NpZmljYXRpb24lMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBkYXRhc2V0cyUyMGltcG9ydCUyMGxvYWRfZGF0YXNldCUwQSUwQWRhdGFzZXQlMjAlM0QlMjBsb2FkX2RhdGFzZXQoJTIyaHVnZ2luZ2ZhY2UlMkZjYXRzLWltYWdlJTIyKSUwQWltYWdlJTIwJTNEJTIwZGF0YXNldCU1QiUyMnRlc3QlMjIlNUQlNUIlMjJpbWFnZSUyMiU1RCU1QjAlNUQlMEElMEFpbWFnZV9wcm9jZXNzb3IlMjAlM0QlMjBBdXRvSW1hZ2VQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMm1pY3Jvc29mdCUyRnN3aW52Mi10aW55LXBhdGNoNC13aW5kb3c4LTI1NiUyMiklMEFtb2RlbCUyMCUzRCUyMFN3aW52MkZvckltYWdlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMm1pY3Jvc29mdCUyRnN3aW52Mi10aW55LXBhdGNoNC13aW5kb3c4LTI1NiUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IoaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRzJTBBJTBBJTIzJTIwbW9kZWwlMjBwcmVkaWN0cyUyMG9uZSUyMG9mJTIwdGhlJTIwMTAwMCUyMEltYWdlTmV0JTIwY2xhc3NlcyUwQXByZWRpY3RlZF9sYWJlbCUyMCUzRCUyMGxvZ2l0cy5hcmdtYXgoLTEpLml0ZW0oKSUwQXByaW50KG1vZGVsLmNvbmZpZy5pZDJsYWJlbCU1QnByZWRpY3RlZF9sYWJlbCU1RCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, Swinv2ForImageClassification
<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;microsoft/swinv2-tiny-patch4-window8-256&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Swinv2ForImageClassification.from_pretrained(<span class="hljs-string">&quot;microsoft/swinv2-tiny-patch4-window8-256&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])
Egyptian cat`}}),{c(){d=n("p"),v=i("Example:"),w=u(),b(f.$$.fragment)},l(r){d=s(r,"P",{});var m=a(d);v=l(m,"Example:"),m.forEach(o),w=g(r),y(f.$$.fragment,r)},m(r,m){h(r,d,m),t(d,v),h(r,w,m),M(f,r,m),_=!0},p:Co,i(r){_||(T(f.$$.fragment,r),_=!0)},o(r){$(f.$$.fragment,r),_=!1},d(r){r&&o(d),r&&o(w),S(f,r)}}}function Ba(k){let d,v,w,f,_,r,m,j,Wo,qt,z,L,$t,we,Zo,St,xo,Lt,H,No,_e,zo,Bo,Ht,De,Go,Ot,Ke,kt,Ao,Dt,et,Po,Kt,tt,ve,Ro,ot,Xo,Vo,eo,Z,Yo,be,Qo,qo,ye,Lo,Ho,to,B,O,jt,Me,Oo,It,Do,oo,nt,Ko,no,Te,so,D,x,st,en,tn,$e,on,nn,Se,sn,an,rn,at,ln,rt,dn,ao,it,cn,ro,lt,K,dt,pn,mn,ke,hn,fn,io,ct,un,lo,G,ee,Ft,je,gn,Et,wn,co,F,Ie,_n,A,vn,pt,bn,yn,Fe,Mn,Tn,$n,P,Sn,mt,kn,jn,ht,In,Fn,En,te,po,R,oe,Jt,Ee,Jn,Ct,Cn,mo,W,Je,Un,Ce,Wn,Ue,Zn,xn,Nn,J,We,zn,X,Bn,ft,Gn,An,Ut,Pn,Rn,Xn,ne,Vn,se,ho,V,ae,Wt,Ze,Yn,Zt,Qn,fo,I,xe,qn,Ne,Ln,ze,Hn,On,Dn,re,Kn,Be,es,Ge,ts,os,ns,C,Ae,ss,Y,as,ut,rs,is,xt,ls,ds,cs,ie,ps,le,uo,Q,de,Nt,Pe,ms,zt,hs,go,E,Re,fs,Bt,us,gs,Xe,ws,Ve,_s,vs,bs,U,Ye,ys,q,Ms,gt,Ts,$s,Gt,Ss,ks,js,ce,Is,pe,wo;return r=new Oe({}),we=new Oe({}),Me=new Oe({}),Te=new Ea({props:{pipeline:"image-classification"}}),je=new Oe({}),Ie=new He({props:{name:"class transformers.Swinv2Config",anchor:"transformers.Swinv2Config",parameters:[{name:"image_size",val:" = 224"},{name:"patch_size",val:" = 4"},{name:"num_channels",val:" = 3"},{name:"embed_dim",val:" = 96"},{name:"depths",val:" = [2, 2, 6, 2]"},{name:"num_heads",val:" = [3, 6, 12, 24]"},{name:"window_size",val:" = 7"},{name:"mlp_ratio",val:" = 4.0"},{name:"qkv_bias",val:" = True"},{name:"hidden_dropout_prob",val:" = 0.0"},{name:"attention_probs_dropout_prob",val:" = 0.0"},{name:"drop_path_rate",val:" = 0.1"},{name:"hidden_act",val:" = 'gelu'"},{name:"use_absolute_embeddings",val:" = False"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-05"},{name:"encoder_stride",val:" = 32"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Swinv2Config.image_size",description:`<strong>image_size</strong> (<code>int</code>, <em>optional</em>, defaults to 224) &#x2014;
The size (resolution) of each image.`,name:"image_size"},{anchor:"transformers.Swinv2Config.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
The size (resolution) of each patch.`,name:"patch_size"},{anchor:"transformers.Swinv2Config.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.Swinv2Config.embed_dim",description:`<strong>embed_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 96) &#x2014;
Dimensionality of patch embedding.`,name:"embed_dim"},{anchor:"transformers.Swinv2Config.depths",description:`<strong>depths</strong> (<code>list(int)</code>, <em>optional</em>, defaults to <code>[2, 2, 6, 2]</code>) &#x2014;
Depth of each layer in the Transformer encoder.`,name:"depths"},{anchor:"transformers.Swinv2Config.num_heads",description:`<strong>num_heads</strong> (<code>list(int)</code>, <em>optional</em>, defaults to <code>[3, 6, 12, 24]</code>) &#x2014;
Number of attention heads in each layer of the Transformer encoder.`,name:"num_heads"},{anchor:"transformers.Swinv2Config.window_size",description:`<strong>window_size</strong> (<code>int</code>, <em>optional</em>, defaults to 7) &#x2014;
Size of windows.`,name:"window_size"},{anchor:"transformers.Swinv2Config.mlp_ratio",description:`<strong>mlp_ratio</strong> (<code>float</code>, <em>optional</em>, defaults to 4.0) &#x2014;
Ratio of MLP hidden dimensionality to embedding dimensionality.`,name:"mlp_ratio"},{anchor:"transformers.Swinv2Config.qkv_bias",description:`<strong>qkv_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not a learnable bias should be added to the queries, keys and values.`,name:"qkv_bias"},{anchor:"transformers.Swinv2Config.hidden_dropout_prob",description:`<strong>hidden_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout probability for all fully connected layers in the embeddings and encoder.`,name:"hidden_dropout_prob"},{anchor:"transformers.Swinv2Config.attention_probs_dropout_prob",description:`<strong>attention_probs_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_probs_dropout_prob"},{anchor:"transformers.Swinv2Config.drop_path_rate",description:`<strong>drop_path_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
Stochastic depth rate.`,name:"drop_path_rate"},{anchor:"transformers.Swinv2Config.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;gelu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder. If 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.Swinv2Config.use_absolute_embeddings",description:`<strong>use_absolute_embeddings</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to add absolute position embeddings to the patch embeddings.`,name:"use_absolute_embeddings"},{anchor:"transformers.Swinv2Config.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.Swinv2Config.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-12) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.Swinv2Config.encoder_stride",description:`<strong>encoder_stride</strong> (<code>int</code>, <code>optional</code>, defaults to 32) &#x2014;
Factor to increase the spatial resolution by in the decoder head for masked image modeling.`,name:"encoder_stride"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/swinv2/configuration_swinv2.py#L30"}}),te=new Jo({props:{anchor:"transformers.Swinv2Config.example",$$slots:{default:[Ja]},$$scope:{ctx:k}}}),Ee=new Oe({}),Je=new He({props:{name:"class transformers.Swinv2Model",anchor:"transformers.Swinv2Model",parameters:[{name:"config",val:""},{name:"add_pooling_layer",val:" = True"},{name:"use_mask_token",val:" = False"}],parametersDescription:[{anchor:"transformers.Swinv2Model.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/swinv2#transformers.Swinv2Config">Swinv2Config</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/swinv2/modeling_swinv2.py#L1024"}}),We=new He({props:{name:"forward",anchor:"transformers.Swinv2Model.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"bool_masked_pos",val:": typing.Optional[torch.BoolTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.Swinv2Model.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/donut#transformers.DonutFeatureExtractor.__call__">ViTImageProcessor.<strong>call</strong>()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.Swinv2Model.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.Swinv2Model.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.Swinv2Model.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.Swinv2Model.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.Swinv2Model.forward.bool_masked_pos",description:`<strong>bool_masked_pos</strong> (<code>torch.BoolTensor</code> of shape <code>(batch_size, num_patches)</code>, <em>optional</em>) &#x2014;
Boolean masked positions. Indicates which patches are masked (1) and which aren&#x2019;t (0).`,name:"bool_masked_pos"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/swinv2/modeling_swinv2.py#L1051",returnDescription:`
<p>A <code>transformers.models.swinv2.modeling_swinv2.Swinv2ModelOutput</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/swinv2#transformers.Swinv2Config"
>Swinv2Config</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>, <em>optional</em>, returned when <code>add_pooling_layer=True</code> is passed) \u2014 Average pooling of the last layer hidden-state.</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 + one for the output of each stage) of
shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each stage) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
<li>
<p><strong>reshaped_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 + one for the output of each stage) of
shape <code>(batch_size, hidden_size, height, width)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs reshaped to
include the spatial dimensions.</p>
</li>
</ul>
`,returnType:`
<p><code>transformers.models.swinv2.modeling_swinv2.Swinv2ModelOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ne=new Eo({props:{$$slots:{default:[Ca]},$$scope:{ctx:k}}}),se=new Jo({props:{anchor:"transformers.Swinv2Model.forward.example",$$slots:{default:[Ua]},$$scope:{ctx:k}}}),Ze=new Oe({}),xe=new He({props:{name:"class transformers.Swinv2ForMaskedImageModeling",anchor:"transformers.Swinv2ForMaskedImageModeling",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.Swinv2ForMaskedImageModeling.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/swinv2#transformers.Swinv2Config">Swinv2Config</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/swinv2/modeling_swinv2.py#L1135"}}),re=new Eo({props:{$$slots:{default:[Wa]},$$scope:{ctx:k}}}),Ae=new He({props:{name:"forward",anchor:"transformers.Swinv2ForMaskedImageModeling.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"bool_masked_pos",val:": typing.Optional[torch.BoolTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.Swinv2ForMaskedImageModeling.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/donut#transformers.DonutFeatureExtractor.__call__">ViTImageProcessor.<strong>call</strong>()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.Swinv2ForMaskedImageModeling.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.Swinv2ForMaskedImageModeling.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.Swinv2ForMaskedImageModeling.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.Swinv2ForMaskedImageModeling.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.Swinv2ForMaskedImageModeling.forward.bool_masked_pos",description:`<strong>bool_masked_pos</strong> (<code>torch.BoolTensor</code> of shape <code>(batch_size, num_patches)</code>) &#x2014;
Boolean masked positions. Indicates which patches are masked (1) and which aren&#x2019;t (0).`,name:"bool_masked_pos"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/swinv2/modeling_swinv2.py#L1152",returnDescription:`
<p>A <code>transformers.models.swinv2.modeling_swinv2.Swinv2MaskedImageModelingOutput</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/swinv2#transformers.Swinv2Config"
>Swinv2Config</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>bool_masked_pos</code> is provided) \u2014 Masked image modeling (MLM) loss.</p>
</li>
<li>
<p><strong>reconstruction</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) \u2014 Reconstructed pixel values.</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 + one for the output of each stage) of
shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each stage) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
<li>
<p><strong>reshaped_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 + one for the output of each stage) of
shape <code>(batch_size, hidden_size, height, width)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs reshaped to
include the spatial dimensions.</p>
</li>
</ul>
`,returnType:`
<p><code>transformers.models.swinv2.modeling_swinv2.Swinv2MaskedImageModelingOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ie=new Eo({props:{$$slots:{default:[Za]},$$scope:{ctx:k}}}),le=new Jo({props:{anchor:"transformers.Swinv2ForMaskedImageModeling.forward.example",$$slots:{default:[xa]},$$scope:{ctx:k}}}),Pe=new Oe({}),Re=new He({props:{name:"class transformers.Swinv2ForImageClassification",anchor:"transformers.Swinv2ForImageClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.Swinv2ForImageClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/swinv2#transformers.Swinv2Config">Swinv2Config</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/swinv2/modeling_swinv2.py#L1247"}}),Ye=new He({props:{name:"forward",anchor:"transformers.Swinv2ForImageClassification.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.Swinv2ForImageClassification.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/donut#transformers.DonutFeatureExtractor.__call__">ViTImageProcessor.<strong>call</strong>()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.Swinv2ForImageClassification.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.Swinv2ForImageClassification.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.Swinv2ForImageClassification.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.Swinv2ForImageClassification.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.Swinv2ForImageClassification.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/swinv2/modeling_swinv2.py#L1262",returnDescription:`
<p>A <code>transformers.models.swinv2.modeling_swinv2.Swinv2ImageClassifierOutput</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/swinv2#transformers.Swinv2Config"
>Swinv2Config</a>) and inputs.</p>
<ul>
<li>
<p><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.</p>
</li>
<li>
<p><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).</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 + one for the output of each stage) of
shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each stage) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
<li>
<p><strong>reshaped_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 + one for the output of each stage) of
shape <code>(batch_size, hidden_size, height, width)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs reshaped to
include the spatial dimensions.</p>
</li>
</ul>
`,returnType:`
<p><code>transformers.models.swinv2.modeling_swinv2.Swinv2ImageClassifierOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ce=new Eo({props:{$$slots:{default:[Na]},$$scope:{ctx:k}}}),pe=new Jo({props:{anchor:"transformers.Swinv2ForImageClassification.forward.example",$$slots:{default:[za]},$$scope:{ctx:k}}}),{c(){d=n("meta"),v=u(),w=n("h1"),f=n("a"),_=n("span"),b(r.$$.fragment),m=u(),j=n("span"),Wo=i("Swin Transformer V2"),qt=u(),z=n("h2"),L=n("a"),$t=n("span"),b(we.$$.fragment),Zo=u(),St=n("span"),xo=i("Overview"),Lt=u(),H=n("p"),No=i("The Swin Transformer V2 model was proposed in "),_e=n("a"),zo=i("Swin Transformer V2: Scaling Up Capacity and Resolution"),Bo=i(" by Ze Liu, Han Hu, Yutong Lin, Zhuliang Yao, Zhenda Xie, Yixuan Wei, Jia Ning, Yue Cao, Zheng Zhang, Li Dong, Furu Wei, Baining Guo."),Ht=u(),De=n("p"),Go=i("The abstract from the paper is the following:"),Ot=u(),Ke=n("p"),kt=n("em"),Ao=i("Large-scale NLP models have been shown to significantly improve the performance on language tasks with no signs of saturation. They also demonstrate amazing few-shot capabilities like that of human beings. This paper aims to explore large-scale models in computer vision. We tackle three major issues in training and application of large vision models, including training instability, resolution gaps between pre-training and fine-tuning, and hunger on labelled data. Three main techniques are proposed: 1) a residual-post-norm method combined with cosine attention to improve training stability; 2) A log-spaced continuous position bias method to effectively transfer models pre-trained using low-resolution images to downstream tasks with high-resolution inputs; 3) A self-supervised pre-training method, SimMIM, to reduce the needs of vast labeled images. Through these techniques, this paper successfully trained a 3 billion-parameter Swin Transformer V2 model, which is the largest dense vision model to date, and makes it capable of training with images of up to 1,536\xD71,536 resolution. It set new performance records on 4 representative vision tasks, including ImageNet-V2 image classification, COCO object detection, ADE20K semantic segmentation, and Kinetics-400 video action classification. Also note our training is much more efficient than that in Google\u2019s billion-level visual models, which consumes 40 times less labelled data and 40 times less training time."),Dt=u(),et=n("p"),Po=i("Tips:"),Kt=u(),tt=n("ul"),ve=n("li"),Ro=i("One can use the "),ot=n("a"),Xo=i("AutoImageProcessor"),Vo=i(" API to prepare images for the model."),eo=u(),Z=n("p"),Yo=i("This model was contributed by "),be=n("a"),Qo=i("nandwalritik"),qo=i(`.
The original code can be found `),ye=n("a"),Lo=i("here"),Ho=i("."),to=u(),B=n("h2"),O=n("a"),jt=n("span"),b(Me.$$.fragment),Oo=u(),It=n("span"),Do=i("Resources"),oo=u(),nt=n("p"),Ko=i("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with Swin Transformer v2."),no=u(),b(Te.$$.fragment),so=u(),D=n("ul"),x=n("li"),st=n("a"),en=i("Swinv2ForImageClassification"),tn=i(" is supported by this "),$e=n("a"),on=i("example script"),nn=i(" and "),Se=n("a"),sn=i("notebook"),an=i("."),rn=u(),at=n("li"),ln=i("See also: "),rt=n("a"),dn=i("Image classification task guide"),ao=u(),it=n("p"),cn=i("Besides that:"),ro=u(),lt=n("ul"),K=n("li"),dt=n("a"),pn=i("Swinv2ForMaskedImageModeling"),mn=i(" is supported by this "),ke=n("a"),hn=i("example script"),fn=i("."),io=u(),ct=n("p"),un=i("If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),lo=u(),G=n("h2"),ee=n("a"),Ft=n("span"),b(je.$$.fragment),gn=u(),Et=n("span"),wn=i("Swinv2Config"),co=u(),F=n("div"),b(Ie.$$.fragment),_n=u(),A=n("p"),vn=i("This is the configuration class to store the configuration of a "),pt=n("a"),bn=i("Swinv2Model"),yn=i(`. It is used to instantiate a Swin
Transformer v2 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 Swin Transformer v2
`),Fe=n("a"),Mn=i("microsoft/swinv2-tiny-patch4-window8-256"),Tn=i(`
architecture.`),$n=u(),P=n("p"),Sn=i("Configuration objects inherit from "),mt=n("a"),kn=i("PretrainedConfig"),jn=i(` and can be used to control the model outputs. Read the
documentation from `),ht=n("a"),In=i("PretrainedConfig"),Fn=i(" for more information."),En=u(),b(te.$$.fragment),po=u(),R=n("h2"),oe=n("a"),Jt=n("span"),b(Ee.$$.fragment),Jn=u(),Ct=n("span"),Cn=i("Swinv2Model"),mo=u(),W=n("div"),b(Je.$$.fragment),Un=u(),Ce=n("p"),Wn=i(`The bare Swinv2 Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Ue=n("a"),Zn=i("torch.nn.Module"),xn=i(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Nn=u(),J=n("div"),b(We.$$.fragment),zn=u(),X=n("p"),Bn=i("The "),ft=n("a"),Gn=i("Swinv2Model"),An=i(" forward method, overrides the "),Ut=n("code"),Pn=i("__call__"),Rn=i(" special method."),Xn=u(),b(ne.$$.fragment),Vn=u(),b(se.$$.fragment),ho=u(),V=n("h2"),ae=n("a"),Wt=n("span"),b(Ze.$$.fragment),Yn=u(),Zt=n("span"),Qn=i("Swinv2ForMaskedImageModeling"),fo=u(),I=n("div"),b(xe.$$.fragment),qn=u(),Ne=n("p"),Ln=i(`Swinv2 Model with a decoder on top for masked image modeling, as proposed in
`),ze=n("a"),Hn=i("SimMIM"),On=i("."),Dn=u(),b(re.$$.fragment),Kn=u(),Be=n("p"),es=i("This model is a PyTorch "),Ge=n("a"),ts=i("torch.nn.Module"),os=i(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),ns=u(),C=n("div"),b(Ae.$$.fragment),ss=u(),Y=n("p"),as=i("The "),ut=n("a"),rs=i("Swinv2ForMaskedImageModeling"),is=i(" forward method, overrides the "),xt=n("code"),ls=i("__call__"),ds=i(" special method."),cs=u(),b(ie.$$.fragment),ps=u(),b(le.$$.fragment),uo=u(),Q=n("h2"),de=n("a"),Nt=n("span"),b(Pe.$$.fragment),ms=u(),zt=n("span"),hs=i("Swinv2ForImageClassification"),go=u(),E=n("div"),b(Re.$$.fragment),fs=u(),Bt=n("p"),us=i(`Swinv2 Model transformer with an image classification head on top (a linear layer on top of the final hidden state
of the [CLS] token) e.g. for ImageNet.`),gs=u(),Xe=n("p"),ws=i("This model is a PyTorch "),Ve=n("a"),_s=i("torch.nn.Module"),vs=i(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),bs=u(),U=n("div"),b(Ye.$$.fragment),ys=u(),q=n("p"),Ms=i("The "),gt=n("a"),Ts=i("Swinv2ForImageClassification"),$s=i(" forward method, overrides the "),Gt=n("code"),Ss=i("__call__"),ks=i(" special method."),js=u(),b(ce.$$.fragment),Is=u(),b(pe.$$.fragment),this.h()},l(e){const p=Ia('[data-svelte="svelte-1phssyn"]',document.head);d=s(p,"META",{name:!0,content:!0}),p.forEach(o),v=g(e),w=s(e,"H1",{class:!0});var Qe=a(w);f=s(Qe,"A",{id:!0,class:!0,href:!0});var At=a(f);_=s(At,"SPAN",{});var Pt=a(_);y(r.$$.fragment,Pt),Pt.forEach(o),At.forEach(o),m=g(Qe),j=s(Qe,"SPAN",{});var Rt=a(j);Wo=l(Rt,"Swin Transformer V2"),Rt.forEach(o),Qe.forEach(o),qt=g(e),z=s(e,"H2",{class:!0});var qe=a(z);L=s(qe,"A",{id:!0,class:!0,href:!0});var Xt=a(L);$t=s(Xt,"SPAN",{});var Vt=a($t);y(we.$$.fragment,Vt),Vt.forEach(o),Xt.forEach(o),Zo=g(qe),St=s(qe,"SPAN",{});var Yt=a(St);xo=l(Yt,"Overview"),Yt.forEach(o),qe.forEach(o),Lt=g(e),H=s(e,"P",{});var _o=a(H);No=l(_o,"The Swin Transformer V2 model was proposed in "),_e=s(_o,"A",{href:!0,rel:!0});var Es=a(_e);zo=l(Es,"Swin Transformer V2: Scaling Up Capacity and Resolution"),Es.forEach(o),Bo=l(_o," by Ze Liu, Han Hu, Yutong Lin, Zhuliang Yao, Zhenda Xie, Yixuan Wei, Jia Ning, Yue Cao, Zheng Zhang, Li Dong, Furu Wei, Baining Guo."),_o.forEach(o),Ht=g(e),De=s(e,"P",{});var Js=a(De);Go=l(Js,"The abstract from the paper is the following:"),Js.forEach(o),Ot=g(e),Ke=s(e,"P",{});var Cs=a(Ke);kt=s(Cs,"EM",{});var Us=a(kt);Ao=l(Us,"Large-scale NLP models have been shown to significantly improve the performance on language tasks with no signs of saturation. They also demonstrate amazing few-shot capabilities like that of human beings. This paper aims to explore large-scale models in computer vision. We tackle three major issues in training and application of large vision models, including training instability, resolution gaps between pre-training and fine-tuning, and hunger on labelled data. Three main techniques are proposed: 1) a residual-post-norm method combined with cosine attention to improve training stability; 2) A log-spaced continuous position bias method to effectively transfer models pre-trained using low-resolution images to downstream tasks with high-resolution inputs; 3) A self-supervised pre-training method, SimMIM, to reduce the needs of vast labeled images. Through these techniques, this paper successfully trained a 3 billion-parameter Swin Transformer V2 model, which is the largest dense vision model to date, and makes it capable of training with images of up to 1,536\xD71,536 resolution. It set new performance records on 4 representative vision tasks, including ImageNet-V2 image classification, COCO object detection, ADE20K semantic segmentation, and Kinetics-400 video action classification. Also note our training is much more efficient than that in Google\u2019s billion-level visual models, which consumes 40 times less labelled data and 40 times less training time."),Us.forEach(o),Cs.forEach(o),Dt=g(e),et=s(e,"P",{});var Ws=a(et);Po=l(Ws,"Tips:"),Ws.forEach(o),Kt=g(e),tt=s(e,"UL",{});var Zs=a(tt);ve=s(Zs,"LI",{});var vo=a(ve);Ro=l(vo,"One can use the "),ot=s(vo,"A",{href:!0});var xs=a(ot);Xo=l(xs,"AutoImageProcessor"),xs.forEach(o),Vo=l(vo," API to prepare images for the model."),vo.forEach(o),Zs.forEach(o),eo=g(e),Z=s(e,"P",{});var wt=a(Z);Yo=l(wt,"This model was contributed by "),be=s(wt,"A",{href:!0,rel:!0});var Ns=a(be);Qo=l(Ns,"nandwalritik"),Ns.forEach(o),qo=l(wt,`.
The original code can be found `),ye=s(wt,"A",{href:!0,rel:!0});var zs=a(ye);Lo=l(zs,"here"),zs.forEach(o),Ho=l(wt,"."),wt.forEach(o),to=g(e),B=s(e,"H2",{class:!0});var bo=a(B);O=s(bo,"A",{id:!0,class:!0,href:!0});var Bs=a(O);jt=s(Bs,"SPAN",{});var Gs=a(jt);y(Me.$$.fragment,Gs),Gs.forEach(o),Bs.forEach(o),Oo=g(bo),It=s(bo,"SPAN",{});var As=a(It);Do=l(As,"Resources"),As.forEach(o),bo.forEach(o),oo=g(e),nt=s(e,"P",{});var Ps=a(nt);Ko=l(Ps,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with Swin Transformer v2."),Ps.forEach(o),no=g(e),y(Te.$$.fragment,e),so=g(e),D=s(e,"UL",{});var yo=a(D);x=s(yo,"LI",{});var Le=a(x);st=s(Le,"A",{href:!0});var Rs=a(st);en=l(Rs,"Swinv2ForImageClassification"),Rs.forEach(o),tn=l(Le," is supported by this "),$e=s(Le,"A",{href:!0,rel:!0});var Xs=a($e);on=l(Xs,"example script"),Xs.forEach(o),nn=l(Le," and "),Se=s(Le,"A",{href:!0,rel:!0});var Vs=a(Se);sn=l(Vs,"notebook"),Vs.forEach(o),an=l(Le,"."),Le.forEach(o),rn=g(yo),at=s(yo,"LI",{});var Fs=a(at);ln=l(Fs,"See also: "),rt=s(Fs,"A",{href:!0});var Ys=a(rt);dn=l(Ys,"Image classification task guide"),Ys.forEach(o),Fs.forEach(o),yo.forEach(o),ao=g(e),it=s(e,"P",{});var Qs=a(it);cn=l(Qs,"Besides that:"),Qs.forEach(o),ro=g(e),lt=s(e,"UL",{});var qs=a(lt);K=s(qs,"LI",{});var Qt=a(K);dt=s(Qt,"A",{href:!0});var Ls=a(dt);pn=l(Ls,"Swinv2ForMaskedImageModeling"),Ls.forEach(o),mn=l(Qt," is supported by this "),ke=s(Qt,"A",{href:!0,rel:!0});var Hs=a(ke);hn=l(Hs,"example script"),Hs.forEach(o),fn=l(Qt,"."),Qt.forEach(o),qs.forEach(o),io=g(e),ct=s(e,"P",{});var Os=a(ct);un=l(Os,"If you\u2019re interested in submitting a resource to be included here, please feel free to open a Pull Request and we\u2019ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource."),Os.forEach(o),lo=g(e),G=s(e,"H2",{class:!0});var Mo=a(G);ee=s(Mo,"A",{id:!0,class:!0,href:!0});var Ds=a(ee);Ft=s(Ds,"SPAN",{});var Ks=a(Ft);y(je.$$.fragment,Ks),Ks.forEach(o),Ds.forEach(o),gn=g(Mo),Et=s(Mo,"SPAN",{});var ea=a(Et);wn=l(ea,"Swinv2Config"),ea.forEach(o),Mo.forEach(o),co=g(e),F=s(e,"DIV",{class:!0});var me=a(F);y(Ie.$$.fragment,me),_n=g(me),A=s(me,"P",{});var _t=a(A);vn=l(_t,"This is the configuration class to store the configuration of a "),pt=s(_t,"A",{href:!0});var ta=a(pt);bn=l(ta,"Swinv2Model"),ta.forEach(o),yn=l(_t,`. It is used to instantiate a Swin
Transformer v2 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 Swin Transformer v2
`),Fe=s(_t,"A",{href:!0,rel:!0});var oa=a(Fe);Mn=l(oa,"microsoft/swinv2-tiny-patch4-window8-256"),oa.forEach(o),Tn=l(_t,`
architecture.`),_t.forEach(o),$n=g(me),P=s(me,"P",{});var vt=a(P);Sn=l(vt,"Configuration objects inherit from "),mt=s(vt,"A",{href:!0});var na=a(mt);kn=l(na,"PretrainedConfig"),na.forEach(o),jn=l(vt,` and can be used to control the model outputs. Read the
documentation from `),ht=s(vt,"A",{href:!0});var sa=a(ht);In=l(sa,"PretrainedConfig"),sa.forEach(o),Fn=l(vt," for more information."),vt.forEach(o),En=g(me),y(te.$$.fragment,me),me.forEach(o),po=g(e),R=s(e,"H2",{class:!0});var To=a(R);oe=s(To,"A",{id:!0,class:!0,href:!0});var aa=a(oe);Jt=s(aa,"SPAN",{});var ra=a(Jt);y(Ee.$$.fragment,ra),ra.forEach(o),aa.forEach(o),Jn=g(To),Ct=s(To,"SPAN",{});var ia=a(Ct);Cn=l(ia,"Swinv2Model"),ia.forEach(o),To.forEach(o),mo=g(e),W=s(e,"DIV",{class:!0});var bt=a(W);y(Je.$$.fragment,bt),Un=g(bt),Ce=s(bt,"P",{});var $o=a(Ce);Wn=l($o,`The bare Swinv2 Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Ue=s($o,"A",{href:!0,rel:!0});var la=a(Ue);Zn=l(la,"torch.nn.Module"),la.forEach(o),xn=l($o,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),$o.forEach(o),Nn=g(bt),J=s(bt,"DIV",{class:!0});var he=a(J);y(We.$$.fragment,he),zn=g(he),X=s(he,"P",{});var yt=a(X);Bn=l(yt,"The "),ft=s(yt,"A",{href:!0});var da=a(ft);Gn=l(da,"Swinv2Model"),da.forEach(o),An=l(yt," forward method, overrides the "),Ut=s(yt,"CODE",{});var ca=a(Ut);Pn=l(ca,"__call__"),ca.forEach(o),Rn=l(yt," special method."),yt.forEach(o),Xn=g(he),y(ne.$$.fragment,he),Vn=g(he),y(se.$$.fragment,he),he.forEach(o),bt.forEach(o),ho=g(e),V=s(e,"H2",{class:!0});var So=a(V);ae=s(So,"A",{id:!0,class:!0,href:!0});var pa=a(ae);Wt=s(pa,"SPAN",{});var ma=a(Wt);y(Ze.$$.fragment,ma),ma.forEach(o),pa.forEach(o),Yn=g(So),Zt=s(So,"SPAN",{});var ha=a(Zt);Qn=l(ha,"Swinv2ForMaskedImageModeling"),ha.forEach(o),So.forEach(o),fo=g(e),I=s(e,"DIV",{class:!0});var N=a(I);y(xe.$$.fragment,N),qn=g(N),Ne=s(N,"P",{});var ko=a(Ne);Ln=l(ko,`Swinv2 Model with a decoder on top for masked image modeling, as proposed in
`),ze=s(ko,"A",{href:!0,rel:!0});var fa=a(ze);Hn=l(fa,"SimMIM"),fa.forEach(o),On=l(ko,"."),ko.forEach(o),Dn=g(N),y(re.$$.fragment,N),Kn=g(N),Be=s(N,"P",{});var jo=a(Be);es=l(jo,"This model is a PyTorch "),Ge=s(jo,"A",{href:!0,rel:!0});var ua=a(Ge);ts=l(ua,"torch.nn.Module"),ua.forEach(o),os=l(jo,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),jo.forEach(o),ns=g(N),C=s(N,"DIV",{class:!0});var fe=a(C);y(Ae.$$.fragment,fe),ss=g(fe),Y=s(fe,"P",{});var Mt=a(Y);as=l(Mt,"The "),ut=s(Mt,"A",{href:!0});var ga=a(ut);rs=l(ga,"Swinv2ForMaskedImageModeling"),ga.forEach(o),is=l(Mt," forward method, overrides the "),xt=s(Mt,"CODE",{});var wa=a(xt);ls=l(wa,"__call__"),wa.forEach(o),ds=l(Mt," special method."),Mt.forEach(o),cs=g(fe),y(ie.$$.fragment,fe),ps=g(fe),y(le.$$.fragment,fe),fe.forEach(o),N.forEach(o),uo=g(e),Q=s(e,"H2",{class:!0});var Io=a(Q);de=s(Io,"A",{id:!0,class:!0,href:!0});var _a=a(de);Nt=s(_a,"SPAN",{});var va=a(Nt);y(Pe.$$.fragment,va),va.forEach(o),_a.forEach(o),ms=g(Io),zt=s(Io,"SPAN",{});var ba=a(zt);hs=l(ba,"Swinv2ForImageClassification"),ba.forEach(o),Io.forEach(o),go=g(e),E=s(e,"DIV",{class:!0});var ue=a(E);y(Re.$$.fragment,ue),fs=g(ue),Bt=s(ue,"P",{});var ya=a(Bt);us=l(ya,`Swinv2 Model transformer with an image classification head on top (a linear layer on top of the final hidden state
of the [CLS] token) e.g. for ImageNet.`),ya.forEach(o),gs=g(ue),Xe=s(ue,"P",{});var Fo=a(Xe);ws=l(Fo,"This model is a PyTorch "),Ve=s(Fo,"A",{href:!0,rel:!0});var Ma=a(Ve);_s=l(Ma,"torch.nn.Module"),Ma.forEach(o),vs=l(Fo,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Fo.forEach(o),bs=g(ue),U=s(ue,"DIV",{class:!0});var ge=a(U);y(Ye.$$.fragment,ge),ys=g(ge),q=s(ge,"P",{});var Tt=a(q);Ms=l(Tt,"The "),gt=s(Tt,"A",{href:!0});var Ta=a(gt);Ts=l(Ta,"Swinv2ForImageClassification"),Ta.forEach(o),$s=l(Tt," forward method, overrides the "),Gt=s(Tt,"CODE",{});var $a=a(Gt);Ss=l($a,"__call__"),$a.forEach(o),ks=l(Tt," special method."),Tt.forEach(o),js=g(ge),y(ce.$$.fragment,ge),Is=g(ge),y(pe.$$.fragment,ge),ge.forEach(o),ue.forEach(o),this.h()},h(){c(d,"name","hf:doc:metadata"),c(d,"content",JSON.stringify(Ga)),c(f,"id","swin-transformer-v2"),c(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"),c(f,"href","#swin-transformer-v2"),c(w,"class","relative group"),c(L,"id","overview"),c(L,"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"),c(L,"href","#overview"),c(z,"class","relative group"),c(_e,"href","https://arxiv.org/abs/2111.09883"),c(_e,"rel","nofollow"),c(ot,"href","/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor"),c(be,"href","https://huggingface.co/nandwalritik"),c(be,"rel","nofollow"),c(ye,"href","https://github.com/microsoft/Swin-Transformer"),c(ye,"rel","nofollow"),c(O,"id","resources"),c(O,"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"),c(O,"href","#resources"),c(B,"class","relative group"),c(st,"href","/docs/transformers/main/en/model_doc/swinv2#transformers.Swinv2ForImageClassification"),c($e,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification"),c($e,"rel","nofollow"),c(Se,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb"),c(Se,"rel","nofollow"),c(rt,"href","../tasks/image_classification"),c(dt,"href","/docs/transformers/main/en/model_doc/swinv2#transformers.Swinv2ForMaskedImageModeling"),c(ke,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-pretraining"),c(ke,"rel","nofollow"),c(ee,"id","transformers.Swinv2Config"),c(ee,"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"),c(ee,"href","#transformers.Swinv2Config"),c(G,"class","relative group"),c(pt,"href","/docs/transformers/main/en/model_doc/swinv2#transformers.Swinv2Model"),c(Fe,"href","https://huggingface.co/microsoft/swinv2-tiny-patch4-window8-256"),c(Fe,"rel","nofollow"),c(mt,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),c(ht,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),c(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(oe,"id","transformers.Swinv2Model"),c(oe,"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"),c(oe,"href","#transformers.Swinv2Model"),c(R,"class","relative group"),c(Ue,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(Ue,"rel","nofollow"),c(ft,"href","/docs/transformers/main/en/model_doc/swinv2#transformers.Swinv2Model"),c(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ae,"id","transformers.Swinv2ForMaskedImageModeling"),c(ae,"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"),c(ae,"href","#transformers.Swinv2ForMaskedImageModeling"),c(V,"class","relative group"),c(ze,"href","https://arxiv.org/abs/2111.09886"),c(ze,"rel","nofollow"),c(Ge,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(Ge,"rel","nofollow"),c(ut,"href","/docs/transformers/main/en/model_doc/swinv2#transformers.Swinv2ForMaskedImageModeling"),c(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(de,"id","transformers.Swinv2ForImageClassification"),c(de,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(de,"href","#transformers.Swinv2ForImageClassification"),c(Q,"class","relative group"),c(Ve,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(Ve,"rel","nofollow"),c(gt,"href","/docs/transformers/main/en/model_doc/swinv2#transformers.Swinv2ForImageClassification"),c(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(E,"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,p){t(document.head,d),h(e,v,p),h(e,w,p),t(w,f),t(f,_),M(r,_,null),t(w,m),t(w,j),t(j,Wo),h(e,qt,p),h(e,z,p),t(z,L),t(L,$t),M(we,$t,null),t(z,Zo),t(z,St),t(St,xo),h(e,Lt,p),h(e,H,p),t(H,No),t(H,_e),t(_e,zo),t(H,Bo),h(e,Ht,p),h(e,De,p),t(De,Go),h(e,Ot,p),h(e,Ke,p),t(Ke,kt),t(kt,Ao),h(e,Dt,p),h(e,et,p),t(et,Po),h(e,Kt,p),h(e,tt,p),t(tt,ve),t(ve,Ro),t(ve,ot),t(ot,Xo),t(ve,Vo),h(e,eo,p),h(e,Z,p),t(Z,Yo),t(Z,be),t(be,Qo),t(Z,qo),t(Z,ye),t(ye,Lo),t(Z,Ho),h(e,to,p),h(e,B,p),t(B,O),t(O,jt),M(Me,jt,null),t(B,Oo),t(B,It),t(It,Do),h(e,oo,p),h(e,nt,p),t(nt,Ko),h(e,no,p),M(Te,e,p),h(e,so,p),h(e,D,p),t(D,x),t(x,st),t(st,en),t(x,tn),t(x,$e),t($e,on),t(x,nn),t(x,Se),t(Se,sn),t(x,an),t(D,rn),t(D,at),t(at,ln),t(at,rt),t(rt,dn),h(e,ao,p),h(e,it,p),t(it,cn),h(e,ro,p),h(e,lt,p),t(lt,K),t(K,dt),t(dt,pn),t(K,mn),t(K,ke),t(ke,hn),t(K,fn),h(e,io,p),h(e,ct,p),t(ct,un),h(e,lo,p),h(e,G,p),t(G,ee),t(ee,Ft),M(je,Ft,null),t(G,gn),t(G,Et),t(Et,wn),h(e,co,p),h(e,F,p),M(Ie,F,null),t(F,_n),t(F,A),t(A,vn),t(A,pt),t(pt,bn),t(A,yn),t(A,Fe),t(Fe,Mn),t(A,Tn),t(F,$n),t(F,P),t(P,Sn),t(P,mt),t(mt,kn),t(P,jn),t(P,ht),t(ht,In),t(P,Fn),t(F,En),M(te,F,null),h(e,po,p),h(e,R,p),t(R,oe),t(oe,Jt),M(Ee,Jt,null),t(R,Jn),t(R,Ct),t(Ct,Cn),h(e,mo,p),h(e,W,p),M(Je,W,null),t(W,Un),t(W,Ce),t(Ce,Wn),t(Ce,Ue),t(Ue,Zn),t(Ce,xn),t(W,Nn),t(W,J),M(We,J,null),t(J,zn),t(J,X),t(X,Bn),t(X,ft),t(ft,Gn),t(X,An),t(X,Ut),t(Ut,Pn),t(X,Rn),t(J,Xn),M(ne,J,null),t(J,Vn),M(se,J,null),h(e,ho,p),h(e,V,p),t(V,ae),t(ae,Wt),M(Ze,Wt,null),t(V,Yn),t(V,Zt),t(Zt,Qn),h(e,fo,p),h(e,I,p),M(xe,I,null),t(I,qn),t(I,Ne),t(Ne,Ln),t(Ne,ze),t(ze,Hn),t(Ne,On),t(I,Dn),M(re,I,null),t(I,Kn),t(I,Be),t(Be,es),t(Be,Ge),t(Ge,ts),t(Be,os),t(I,ns),t(I,C),M(Ae,C,null),t(C,ss),t(C,Y),t(Y,as),t(Y,ut),t(ut,rs),t(Y,is),t(Y,xt),t(xt,ls),t(Y,ds),t(C,cs),M(ie,C,null),t(C,ps),M(le,C,null),h(e,uo,p),h(e,Q,p),t(Q,de),t(de,Nt),M(Pe,Nt,null),t(Q,ms),t(Q,zt),t(zt,hs),h(e,go,p),h(e,E,p),M(Re,E,null),t(E,fs),t(E,Bt),t(Bt,us),t(E,gs),t(E,Xe),t(Xe,ws),t(Xe,Ve),t(Ve,_s),t(Xe,vs),t(E,bs),t(E,U),M(Ye,U,null),t(U,ys),t(U,q),t(q,Ms),t(q,gt),t(gt,Ts),t(q,$s),t(q,Gt),t(Gt,Ss),t(q,ks),t(U,js),M(ce,U,null),t(U,Is),M(pe,U,null),wo=!0},p(e,[p]){const Qe={};p&2&&(Qe.$$scope={dirty:p,ctx:e}),te.$set(Qe);const At={};p&2&&(At.$$scope={dirty:p,ctx:e}),ne.$set(At);const Pt={};p&2&&(Pt.$$scope={dirty:p,ctx:e}),se.$set(Pt);const Rt={};p&2&&(Rt.$$scope={dirty:p,ctx:e}),re.$set(Rt);const qe={};p&2&&(qe.$$scope={dirty:p,ctx:e}),ie.$set(qe);const Xt={};p&2&&(Xt.$$scope={dirty:p,ctx:e}),le.$set(Xt);const Vt={};p&2&&(Vt.$$scope={dirty:p,ctx:e}),ce.$set(Vt);const Yt={};p&2&&(Yt.$$scope={dirty:p,ctx:e}),pe.$set(Yt)},i(e){wo||(T(r.$$.fragment,e),T(we.$$.fragment,e),T(Me.$$.fragment,e),T(Te.$$.fragment,e),T(je.$$.fragment,e),T(Ie.$$.fragment,e),T(te.$$.fragment,e),T(Ee.$$.fragment,e),T(Je.$$.fragment,e),T(We.$$.fragment,e),T(ne.$$.fragment,e),T(se.$$.fragment,e),T(Ze.$$.fragment,e),T(xe.$$.fragment,e),T(re.$$.fragment,e),T(Ae.$$.fragment,e),T(ie.$$.fragment,e),T(le.$$.fragment,e),T(Pe.$$.fragment,e),T(Re.$$.fragment,e),T(Ye.$$.fragment,e),T(ce.$$.fragment,e),T(pe.$$.fragment,e),wo=!0)},o(e){$(r.$$.fragment,e),$(we.$$.fragment,e),$(Me.$$.fragment,e),$(Te.$$.fragment,e),$(je.$$.fragment,e),$(Ie.$$.fragment,e),$(te.$$.fragment,e),$(Ee.$$.fragment,e),$(Je.$$.fragment,e),$(We.$$.fragment,e),$(ne.$$.fragment,e),$(se.$$.fragment,e),$(Ze.$$.fragment,e),$(xe.$$.fragment,e),$(re.$$.fragment,e),$(Ae.$$.fragment,e),$(ie.$$.fragment,e),$(le.$$.fragment,e),$(Pe.$$.fragment,e),$(Re.$$.fragment,e),$(Ye.$$.fragment,e),$(ce.$$.fragment,e),$(pe.$$.fragment,e),wo=!1},d(e){o(d),e&&o(v),e&&o(w),S(r),e&&o(qt),e&&o(z),S(we),e&&o(Lt),e&&o(H),e&&o(Ht),e&&o(De),e&&o(Ot),e&&o(Ke),e&&o(Dt),e&&o(et),e&&o(Kt),e&&o(tt),e&&o(eo),e&&o(Z),e&&o(to),e&&o(B),S(Me),e&&o(oo),e&&o(nt),e&&o(no),S(Te,e),e&&o(so),e&&o(D),e&&o(ao),e&&o(it),e&&o(ro),e&&o(lt),e&&o(io),e&&o(ct),e&&o(lo),e&&o(G),S(je),e&&o(co),e&&o(F),S(Ie),S(te),e&&o(po),e&&o(R),S(Ee),e&&o(mo),e&&o(W),S(Je),S(We),S(ne),S(se),e&&o(ho),e&&o(V),S(Ze),e&&o(fo),e&&o(I),S(xe),S(re),S(Ae),S(ie),S(le),e&&o(uo),e&&o(Q),S(Pe),e&&o(go),e&&o(E),S(Re),S(Ye),S(ce),S(pe)}}}const Ga={local:"swin-transformer-v2",sections:[{local:"overview",title:"Overview"},{local:"resources",title:"Resources"},{local:"transformers.Swinv2Config",title:"Swinv2Config"},{local:"transformers.Swinv2Model",title:"Swinv2Model"},{local:"transformers.Swinv2ForMaskedImageModeling",title:"Swinv2ForMaskedImageModeling"},{local:"transformers.Swinv2ForImageClassification",title:"Swinv2ForImageClassification"}],title:"Swin Transformer V2"};function Aa(k){return Fa(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class La extends Sa{constructor(d){super();ka(this,d,Aa,Ba,ja,{})}}export{La as default,Ga as metadata};
