import{S as Jl,i as Ql,s as Xl,e as n,k as u,w as v,t as r,M as ed,c as a,d as o,m as g,a as l,x as $,h as i,b as c,N as td,G as e,g as _,y as T,q as y,o as S,B as k,v as od,L as Zt}from"../../chunks/vendor-hf-doc-builder.js";import{T as Kt}from"../../chunks/Tip-hf-doc-builder.js";import{D as A}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Gt}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Y}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Yt}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as sd}from"../../chunks/PipelineTag-hf-doc-builder.js";function nd(M){let d,b,f,h,w;return h=new Gt({props:{code:`from transformers import SwinConfig, SwinModel

# Initializing a Swin microsoft/swin-tiny-patch4-window7-224 style configuration
configuration = SwinConfig()

# Initializing a model (with random weights) from the microsoft/swin-tiny-patch4-window7-224 style configuration
model = SwinModel(configuration)

# Accessing the model configuration
configuration = model.config`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> SwinConfig, SwinModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Swin microsoft/swin-tiny-patch4-window7-224 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = SwinConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the microsoft/swin-tiny-patch4-window7-224 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = SwinModel(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"),b=r("Example:"),f=u(),v(h.$$.fragment)},l(s){d=a(s,"P",{});var p=l(d);b=i(p,"Example:"),p.forEach(o),f=g(s),$(h.$$.fragment,s)},m(s,p){_(s,d,p),e(d,b),_(s,f,p),T(h,s,p),w=!0},p:Zt,i(s){w||(y(h.$$.fragment,s),w=!0)},o(s){S(h.$$.fragment,s),w=!1},d(s){s&&o(d),s&&o(f),k(h,s)}}}function ad(M){let d,b,f,h,w;return{c(){d=n("p"),b=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),h=r("Module"),w=r(`
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(s){d=a(s,"P",{});var p=l(d);b=i(p,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a(p,"CODE",{});var F=l(f);h=i(F,"Module"),F.forEach(o),w=i(p,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),p.forEach(o)},m(s,p){_(s,d,p),e(d,b),e(d,f),e(f,h),e(d,w)},d(s){s&&o(d)}}}function rd(M){let d,b,f,h,w;return h=new Gt({props:{code:`from transformers import AutoImageProcessor, SwinModel
import torch
from datasets import load_dataset

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

image_processor = AutoImageProcessor.from_pretrained("microsoft/swin-tiny-patch4-window7-224")
model = SwinModel.from_pretrained("microsoft/swin-tiny-patch4-window7-224")

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

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

last_hidden_states = outputs.last_hidden_state
list(last_hidden_states.shape)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, SwinModel
<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/swin-tiny-patch4-window7-224&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = SwinModel.from_pretrained(<span class="hljs-string">&quot;microsoft/swin-tiny-patch4-window7-224&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">49</span>, <span class="hljs-number">768</span>]`}}),{c(){d=n("p"),b=r("Example:"),f=u(),v(h.$$.fragment)},l(s){d=a(s,"P",{});var p=l(d);b=i(p,"Example:"),p.forEach(o),f=g(s),$(h.$$.fragment,s)},m(s,p){_(s,d,p),e(d,b),_(s,f,p),T(h,s,p),w=!0},p:Zt,i(s){w||(y(h.$$.fragment,s),w=!0)},o(s){S(h.$$.fragment,s),w=!1},d(s){s&&o(d),s&&o(f),k(h,s)}}}function id(M){let d,b,f,h,w;return{c(){d=n("p"),b=r("Note that we provide a script to pre-train this model on custom data in our "),f=n("a"),h=r(`examples
directory`),w=r("."),this.h()},l(s){d=a(s,"P",{});var p=l(d);b=i(p,"Note that we provide a script to pre-train this model on custom data in our "),f=a(p,"A",{href:!0,rel:!0});var F=l(f);h=i(F,`examples
directory`),F.forEach(o),w=i(p,"."),p.forEach(o),this.h()},h(){c(f,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-pretraining"),c(f,"rel","nofollow")},m(s,p){_(s,d,p),e(d,b),e(d,f),e(f,h),e(d,w)},d(s){s&&o(d)}}}function ld(M){let d,b,f,h,w;return{c(){d=n("p"),b=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),h=r("Module"),w=r(`
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(s){d=a(s,"P",{});var p=l(d);b=i(p,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a(p,"CODE",{});var F=l(f);h=i(F,"Module"),F.forEach(o),w=i(p,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),p.forEach(o)},m(s,p){_(s,d,p),e(d,b),e(d,f),e(f,h),e(d,w)},d(s){s&&o(d)}}}function dd(M){let d,b,f,h,w;return h=new Gt({props:{code:`from transformers import AutoImageProcessor, SwinForMaskedImageModeling
import torch
from PIL import Image
import requests

url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)

image_processor = AutoImageProcessor.from_pretrained("microsoft/swin-base-simmim-window6-192")
model = SwinForMaskedImageModeling.from_pretrained("microsoft/swin-base-simmim-window6-192")

num_patches = (model.config.image_size // model.config.patch_size) ** 2
pixel_values = image_processor(images=image, return_tensors="pt").pixel_values
# create random boolean mask of shape (batch_size, num_patches)
bool_masked_pos = torch.randint(low=0, high=2, size=(1, num_patches)).bool()

outputs = model(pixel_values, bool_masked_pos=bool_masked_pos)
loss, reconstructed_pixel_values = outputs.loss, outputs.logits
list(reconstructed_pixel_values.shape)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, SwinForMaskedImageModeling
<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/swin-base-simmim-window6-192&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = SwinForMaskedImageModeling.from_pretrained(<span class="hljs-string">&quot;microsoft/swin-base-simmim-window6-192&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.logits
<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">192</span>, <span class="hljs-number">192</span>]`}}),{c(){d=n("p"),b=r("Examples:"),f=u(),v(h.$$.fragment)},l(s){d=a(s,"P",{});var p=l(d);b=i(p,"Examples:"),p.forEach(o),f=g(s),$(h.$$.fragment,s)},m(s,p){_(s,d,p),e(d,b),_(s,f,p),T(h,s,p),w=!0},p:Zt,i(s){w||(y(h.$$.fragment,s),w=!0)},o(s){S(h.$$.fragment,s),w=!1},d(s){s&&o(d),s&&o(f),k(h,s)}}}function cd(M){let d,b,f,h,w;return{c(){d=n("p"),b=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),h=r("Module"),w=r(`
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(s){d=a(s,"P",{});var p=l(d);b=i(p,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a(p,"CODE",{});var F=l(f);h=i(F,"Module"),F.forEach(o),w=i(p,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),p.forEach(o)},m(s,p){_(s,d,p),e(d,b),e(d,f),e(f,h),e(d,w)},d(s){s&&o(d)}}}function pd(M){let d,b,f,h,w;return h=new Gt({props:{code:`from transformers import AutoImageProcessor, SwinForImageClassification
import torch
from datasets import load_dataset

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

image_processor = AutoImageProcessor.from_pretrained("microsoft/swin-tiny-patch4-window7-224")
model = SwinForImageClassification.from_pretrained("microsoft/swin-tiny-patch4-window7-224")

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

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

# model predicts one of the 1000 ImageNet classes
predicted_label = logits.argmax(-1).item()
print(model.config.id2label[predicted_label])`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, SwinForImageClassification
<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/swin-tiny-patch4-window7-224&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = SwinForImageClassification.from_pretrained(<span class="hljs-string">&quot;microsoft/swin-tiny-patch4-window7-224&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(){d=n("p"),b=r("Example:"),f=u(),v(h.$$.fragment)},l(s){d=a(s,"P",{});var p=l(d);b=i(p,"Example:"),p.forEach(o),f=g(s),$(h.$$.fragment,s)},m(s,p){_(s,d,p),e(d,b),_(s,f,p),T(h,s,p),w=!0},p:Zt,i(s){w||(y(h.$$.fragment,s),w=!0)},o(s){S(h.$$.fragment,s),w=!1},d(s){s&&o(d),s&&o(f),k(h,s)}}}function md(M){let d,b,f,h,w;return{c(){d=n("p"),b=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),h=r("Module"),w=r(`
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(s){d=a(s,"P",{});var p=l(d);b=i(p,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a(p,"CODE",{});var F=l(f);h=i(F,"Module"),F.forEach(o),w=i(p,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),p.forEach(o)},m(s,p){_(s,d,p),e(d,b),e(d,f),e(f,h),e(d,w)},d(s){s&&o(d)}}}function hd(M){let d,b,f,h,w;return h=new Gt({props:{code:`from transformers import AutoImageProcessor, TFSwinModel
from datasets import load_dataset

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

image_processor = AutoImageProcessor.from_pretrained("microsoft/swin-tiny-patch4-window7-224")
model = TFSwinModel.from_pretrained("microsoft/swin-tiny-patch4-window7-224")

inputs = image_processor(image, return_tensors="tf")
outputs = model(**inputs)

last_hidden_states = outputs.last_hidden_state
list(last_hidden_states.shape)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, TFSwinModel
<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/swin-tiny-patch4-window7-224&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFSwinModel.from_pretrained(<span class="hljs-string">&quot;microsoft/swin-tiny-patch4-window7-224&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(image, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </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">49</span>, <span class="hljs-number">768</span>]`}}),{c(){d=n("p"),b=r("Example:"),f=u(),v(h.$$.fragment)},l(s){d=a(s,"P",{});var p=l(d);b=i(p,"Example:"),p.forEach(o),f=g(s),$(h.$$.fragment,s)},m(s,p){_(s,d,p),e(d,b),_(s,f,p),T(h,s,p),w=!0},p:Zt,i(s){w||(y(h.$$.fragment,s),w=!0)},o(s){S(h.$$.fragment,s),w=!1},d(s){s&&o(d),s&&o(f),k(h,s)}}}function fd(M){let d,b,f,h,w;return{c(){d=n("p"),b=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),h=r("Module"),w=r(`
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(s){d=a(s,"P",{});var p=l(d);b=i(p,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a(p,"CODE",{});var F=l(f);h=i(F,"Module"),F.forEach(o),w=i(p,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),p.forEach(o)},m(s,p){_(s,d,p),e(d,b),e(d,f),e(f,h),e(d,w)},d(s){s&&o(d)}}}function ud(M){let d,b,f,h,w;return h=new Gt({props:{code:`from transformers import AutoImageProcessor, TFSwinForMaskedImageModeling
import tensorflow as tf
from PIL import Image
import requests

url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)

image_processor = AutoImageProcessor.from_pretrained("microsoft/swin-tiny-patch4-window7-224")
model = TFSwinForMaskedImageModeling.from_pretrained("microsoft/swin-tiny-patch4-window7-224")

num_patches = (model.config.image_size // model.config.patch_size) ** 2
pixel_values = image_processor(images=image, return_tensors="tf").pixel_values
# create random boolean mask of shape (batch_size, num_patches)
bool_masked_pos = tf.random.uniform((1, num_patches)) >= 0.5

outputs = model(pixel_values, bool_masked_pos=bool_masked_pos)
loss, reconstructed_pixel_values = outputs.loss, outputs.logits
list(reconstructed_pixel_values.shape)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, TFSwinForMaskedImageModeling
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf
<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/swin-tiny-patch4-window7-224&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFSwinForMaskedImageModeling.from_pretrained(<span class="hljs-string">&quot;microsoft/swin-tiny-patch4-window7-224&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;tf&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 = tf.random.uniform((<span class="hljs-number">1</span>, num_patches)) &gt;= <span class="hljs-number">0.5</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.logits
<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">224</span>, <span class="hljs-number">224</span>]`}}),{c(){d=n("p"),b=r("Examples:"),f=u(),v(h.$$.fragment)},l(s){d=a(s,"P",{});var p=l(d);b=i(p,"Examples:"),p.forEach(o),f=g(s),$(h.$$.fragment,s)},m(s,p){_(s,d,p),e(d,b),_(s,f,p),T(h,s,p),w=!0},p:Zt,i(s){w||(y(h.$$.fragment,s),w=!0)},o(s){S(h.$$.fragment,s),w=!1},d(s){s&&o(d),s&&o(f),k(h,s)}}}function gd(M){let d,b,f,h,w;return{c(){d=n("p"),b=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),h=r("Module"),w=r(`
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(s){d=a(s,"P",{});var p=l(d);b=i(p,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=a(p,"CODE",{});var F=l(f);h=i(F,"Module"),F.forEach(o),w=i(p,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),p.forEach(o)},m(s,p){_(s,d,p),e(d,b),e(d,f),e(f,h),e(d,w)},d(s){s&&o(d)}}}function _d(M){let d,b,f,h,w;return h=new Gt({props:{code:`from transformers import AutoImageProcessor, TFSwinForImageClassification
import tensorflow as tf
from datasets import load_dataset

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

image_processor = AutoImageProcessor.from_pretrained("microsoft/swin-tiny-patch4-window7-224")
model = TFSwinForImageClassification.from_pretrained("microsoft/swin-tiny-patch4-window7-224")

inputs = image_processor(image, return_tensors="tf")
logits = model(**inputs).logits

# model predicts one of the 1000 ImageNet classes
predicted_label = int(tf.math.argmax(logits, axis=-1))
print(model.config.id2label[predicted_label])`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, TFSwinForImageClassification
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf
<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/swin-tiny-patch4-window7-224&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFSwinForImageClassification.from_pretrained(<span class="hljs-string">&quot;microsoft/swin-tiny-patch4-window7-224&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = image_processor(image, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </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 = <span class="hljs-built_in">int</span>(tf.math.argmax(logits, axis=-<span class="hljs-number">1</span>))
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(model.config.id2label[predicted_label])
tabby, tabby cat`}}),{c(){d=n("p"),b=r("Example:"),f=u(),v(h.$$.fragment)},l(s){d=a(s,"P",{});var p=l(d);b=i(p,"Example:"),p.forEach(o),f=g(s),$(h.$$.fragment,s)},m(s,p){_(s,d,p),e(d,b),_(s,f,p),T(h,s,p),w=!0},p:Zt,i(s){w||(y(h.$$.fragment,s),w=!0)},o(s){S(h.$$.fragment,s),w=!1},d(s){s&&o(d),s&&o(f),k(h,s)}}}function wd(M){let d,b,f,h,w,s,p,F,vn,ks,Z,he,Po,Ge,$n,Co,Tn,Ms,fe,yn,Je,Sn,kn,Fs,Jt,Mn,Is,Qt,Ao,Fn,xs,Xt,In,js,B,Qe,xn,eo,jn,En,Pn,Xe,Cn,qo,An,qn,zn,I,On,zo,Nn,Dn,Oo,Ln,Hn,No,Wn,Vn,Do,Un,Bn,Lo,Rn,Kn,Ho,Yn,Zn,Wo,Gn,Jn,Es,ue,Ei,Ps,ge,Qn,to,Xn,ea,Cs,q,ta,et,oa,sa,tt,na,aa,ot,ra,ia,As,G,_e,Vo,st,la,Uo,da,qs,oo,ca,zs,nt,Os,so,R,no,pa,ma,at,ha,fa,rt,ua,ga,Ns,ao,_a,Ds,ro,we,io,wa,ba,it,va,$a,Ls,lo,Ta,Hs,J,be,Bo,lt,ya,Ro,Sa,Ws,E,dt,ka,Q,Ma,co,Fa,Ia,ct,xa,ja,Ea,X,Pa,po,Ca,Aa,mo,qa,za,Oa,ve,Vs,ee,$e,Ko,pt,Na,Yo,Da,Us,W,mt,La,ht,Ha,ft,Wa,Va,Ua,z,ut,Ba,te,Ra,ho,Ka,Ya,Zo,Za,Ga,Ja,Te,Qa,ye,Bs,oe,Se,Go,gt,Xa,Jo,er,Rs,j,_t,tr,wt,or,bt,sr,nr,ar,ke,rr,vt,ir,$t,lr,dr,cr,O,Tt,pr,se,mr,fo,hr,fr,Qo,ur,gr,_r,Me,wr,Fe,Ks,ne,Ie,Xo,yt,br,es,vr,Ys,P,St,$r,ts,Tr,yr,kt,Sr,Mt,kr,Mr,Fr,N,Ft,Ir,ae,xr,uo,jr,Er,os,Pr,Cr,Ar,xe,qr,je,Zs,re,Ee,ss,It,zr,ns,Or,Gs,V,xt,Nr,jt,Dr,Et,Lr,Hr,Wr,D,Pt,Vr,ie,Ur,go,Br,Rr,as,Kr,Yr,Zr,Pe,Gr,Ce,Js,le,Ae,rs,Ct,Jr,is,Qr,Qs,U,At,Xr,de,ei,qt,ti,oi,zt,si,ni,ai,L,Ot,ri,ce,ii,_o,li,di,ls,ci,pi,mi,qe,hi,ze,Xs,pe,Oe,ds,Nt,fi,cs,ui,en,C,Dt,gi,ps,_i,wi,Lt,bi,Ht,vi,$i,Ti,H,Wt,yi,me,Si,wo,ki,Mi,ms,Fi,Ii,xi,Ne,ji,De,tn;return s=new Y({}),Ge=new Y({}),st=new Y({}),nt=new sd({props:{pipeline:"image-classification"}}),lt=new Y({}),dt=new A({props:{name:"class transformers.SwinConfig",anchor:"transformers.SwinConfig",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:"patch_norm",val:" = True"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-05"},{name:"encoder_stride",val:" = 32"},{name:"out_features",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.SwinConfig.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.SwinConfig.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.SwinConfig.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.SwinConfig.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.SwinConfig.depths",description:`<strong>depths</strong> (<code>list(int)</code>, <em>optional</em>, defaults to [2, 2, 6, 2]) &#x2014;
Depth of each layer in the Transformer encoder.`,name:"depths"},{anchor:"transformers.SwinConfig.num_heads",description:`<strong>num_heads</strong> (<code>list(int)</code>, <em>optional</em>, defaults to [3, 6, 12, 24]) &#x2014;
Number of attention heads in each layer of the Transformer encoder.`,name:"num_heads"},{anchor:"transformers.SwinConfig.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.SwinConfig.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.SwinConfig.qkv_bias",description:`<strong>qkv_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to True) &#x2014;
Whether or not a learnable bias should be added to the queries, keys and values.`,name:"qkv_bias"},{anchor:"transformers.SwinConfig.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.SwinConfig.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.SwinConfig.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.SwinConfig.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.SwinConfig.use_absolute_embeddings",description:`<strong>use_absolute_embeddings</strong> (<code>bool</code>, <em>optional</em>, defaults to False) &#x2014;
Whether or not to add absolute position embeddings to the patch embeddings.`,name:"use_absolute_embeddings"},{anchor:"transformers.SwinConfig.patch_norm",description:`<strong>patch_norm</strong> (<code>bool</code>, <em>optional</em>, defaults to True) &#x2014;
Whether or not to add layer normalization after patch embedding.`,name:"patch_norm"},{anchor:"transformers.SwinConfig.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.SwinConfig.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.SwinConfig.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"},{anchor:"transformers.SwinConfig.out_features",description:`<strong>out_features</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
If used as backbone, list of features to output. Can be any of <code>&quot;stem&quot;</code>, <code>&quot;stage1&quot;</code>, <code>&quot;stage2&quot;</code>, etc.
(depending on how many stages the model has). Will default to the last stage if unset.`,name:"out_features"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/swin/configuration_swin.py#L37"}}),ve=new Yt({props:{anchor:"transformers.SwinConfig.example",$$slots:{default:[nd]},$$scope:{ctx:M}}}),pt=new Y({}),mt=new A({props:{name:"class transformers.SwinModel",anchor:"transformers.SwinModel",parameters:[{name:"config",val:""},{name:"add_pooling_layer",val:" = True"},{name:"use_mask_token",val:" = False"}],parametersDescription:[{anchor:"transformers.SwinModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/swin#transformers.SwinConfig">SwinConfig</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/swin/modeling_swin.py#L936"}}),ut=new A({props:{name:"forward",anchor:"transformers.SwinModel.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.SwinModel.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/poolformer#transformers.PoolFormerFeatureExtractor.__call__">ViTImageProcessor.<strong>call</strong>()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.SwinModel.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.SwinModel.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.SwinModel.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.SwinModel.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/swin/modeling_swin.py#L963",returnDescription:`
<p>A <code>transformers.models.swin.modeling_swin.SwinModelOutput</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/swin#transformers.SwinConfig"
>SwinConfig</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.swin.modeling_swin.SwinModelOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Te=new Kt({props:{$$slots:{default:[ad]},$$scope:{ctx:M}}}),ye=new Yt({props:{anchor:"transformers.SwinModel.forward.example",$$slots:{default:[rd]},$$scope:{ctx:M}}}),gt=new Y({}),_t=new A({props:{name:"class transformers.SwinForMaskedImageModeling",anchor:"transformers.SwinForMaskedImageModeling",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.SwinForMaskedImageModeling.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/swin#transformers.SwinConfig">SwinConfig</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/swin/modeling_swin.py#L1041"}}),ke=new Kt({props:{$$slots:{default:[id]},$$scope:{ctx:M}}}),Tt=new A({props:{name:"forward",anchor:"transformers.SwinForMaskedImageModeling.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.SwinForMaskedImageModeling.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/poolformer#transformers.PoolFormerFeatureExtractor.__call__">ViTImageProcessor.<strong>call</strong>()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.SwinForMaskedImageModeling.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.SwinForMaskedImageModeling.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.SwinForMaskedImageModeling.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.SwinForMaskedImageModeling.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.SwinForMaskedImageModeling.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/swin/modeling_swin.py#L1058",returnDescription:`
<p>A <code>transformers.models.swin.modeling_swin.SwinMaskedImageModelingOutput</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/swin#transformers.SwinConfig"
>SwinConfig</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>logits</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.swin.modeling_swin.SwinMaskedImageModelingOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Me=new Kt({props:{$$slots:{default:[ld]},$$scope:{ctx:M}}}),Fe=new Yt({props:{anchor:"transformers.SwinForMaskedImageModeling.forward.example",$$slots:{default:[dd]},$$scope:{ctx:M}}}),yt=new Y({}),St=new A({props:{name:"class transformers.SwinForImageClassification",anchor:"transformers.SwinForImageClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.SwinForImageClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/swin#transformers.SwinConfig">SwinConfig</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/swin/modeling_swin.py#L1152"}}),Ft=new A({props:{name:"forward",anchor:"transformers.SwinForImageClassification.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.SwinForImageClassification.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/poolformer#transformers.PoolFormerFeatureExtractor.__call__">ViTImageProcessor.<strong>call</strong>()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.SwinForImageClassification.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.SwinForImageClassification.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.SwinForImageClassification.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.SwinForImageClassification.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.SwinForImageClassification.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/swin/modeling_swin.py#L1167",returnDescription:`
<p>A <code>transformers.models.swin.modeling_swin.SwinImageClassifierOutput</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/swin#transformers.SwinConfig"
>SwinConfig</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.swin.modeling_swin.SwinImageClassifierOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),xe=new Kt({props:{$$slots:{default:[cd]},$$scope:{ctx:M}}}),je=new Yt({props:{anchor:"transformers.SwinForImageClassification.forward.example",$$slots:{default:[pd]},$$scope:{ctx:M}}}),It=new Y({}),xt=new A({props:{name:"class transformers.TFSwinModel",anchor:"transformers.TFSwinModel",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFSwinModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/swin#transformers.SwinConfig">SwinConfig</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/swin/modeling_tf_swin.py#L1184"}}),Pt=new A({props:{name:"call",anchor:"transformers.TFSwinModel.call",parameters:[{name:"pixel_values",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"bool_masked_pos",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"head_mask",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = 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"},{name:"training",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TFSwinModel.call.pixel_values",description:`<strong>pixel_values</strong> (<code>tf.Tensor</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/poolformer#transformers.PoolFormerFeatureExtractor.__call__">ViTImageProcessor.<strong>call</strong>()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.TFSwinModel.call.head_mask",description:`<strong>head_mask</strong> (<code>tf.Tensor</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.TFSwinModel.call.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.TFSwinModel.call.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.TFSwinModel.call.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/swin/modeling_tf_swin.py#L1192",returnDescription:`
<p>A <code>transformers.models.swin.modeling_tf_swin.TFSwinModelOutput</code> or a tuple of <code>tf.Tensor</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/swin#transformers.SwinConfig"
>SwinConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>tf.Tensor</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>tf.Tensor</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(tf.Tensor)</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>tf.Tensor</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(tf.Tensor)</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>tf.Tensor</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(tf.Tensor)</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>tf.Tensor</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.swin.modeling_tf_swin.TFSwinModelOutput</code> or <code>tuple(tf.Tensor)</code></p>
`}}),Pe=new Kt({props:{$$slots:{default:[md]},$$scope:{ctx:M}}}),Ce=new Yt({props:{anchor:"transformers.TFSwinModel.call.example",$$slots:{default:[hd]},$$scope:{ctx:M}}}),Ct=new Y({}),At=new A({props:{name:"class transformers.TFSwinForMaskedImageModeling",anchor:"transformers.TFSwinForMaskedImageModeling",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFSwinForMaskedImageModeling.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/swin#transformers.SwinConfig">SwinConfig</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/swin/modeling_tf_swin.py#L1293"}}),Ot=new A({props:{name:"call",anchor:"transformers.TFSwinForMaskedImageModeling.call",parameters:[{name:"pixel_values",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"bool_masked_pos",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"head_mask",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = 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"},{name:"training",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TFSwinForMaskedImageModeling.call.pixel_values",description:`<strong>pixel_values</strong> (<code>tf.Tensor</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/poolformer#transformers.PoolFormerFeatureExtractor.__call__">ViTImageProcessor.<strong>call</strong>()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.TFSwinForMaskedImageModeling.call.head_mask",description:`<strong>head_mask</strong> (<code>tf.Tensor</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.TFSwinForMaskedImageModeling.call.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.TFSwinForMaskedImageModeling.call.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.TFSwinForMaskedImageModeling.call.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.TFSwinForMaskedImageModeling.call.bool_masked_pos",description:`<strong>bool_masked_pos</strong> (<code>tf.Tensor</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/swin/modeling_tf_swin.py#L1301",returnDescription:`
<p>A <code>transformers.models.swin.modeling_tf_swin.TFSwinMaskedImageModelingOutput</code> or a tuple of <code>tf.Tensor</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/swin#transformers.SwinConfig"
>SwinConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>tf.Tensor</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>logits</strong> (<code>tf.Tensor</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(tf.Tensor)</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>tf.Tensor</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(tf.Tensor)</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>tf.Tensor</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(tf.Tensor)</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>tf.Tensor</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.swin.modeling_tf_swin.TFSwinMaskedImageModelingOutput</code> or <code>tuple(tf.Tensor)</code></p>
`}}),qe=new Kt({props:{$$slots:{default:[fd]},$$scope:{ctx:M}}}),ze=new Yt({props:{anchor:"transformers.TFSwinForMaskedImageModeling.call.example",$$slots:{default:[ud]},$$scope:{ctx:M}}}),Nt=new Y({}),Dt=new A({props:{name:"class transformers.TFSwinForImageClassification",anchor:"transformers.TFSwinForImageClassification",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFSwinForImageClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/swin#transformers.SwinConfig">SwinConfig</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/swin/modeling_tf_swin.py#L1414"}}),Wt=new A({props:{name:"call",anchor:"transformers.TFSwinForImageClassification.call",parameters:[{name:"pixel_values",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"head_mask",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"labels",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = 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"},{name:"training",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TFSwinForImageClassification.call.pixel_values",description:`<strong>pixel_values</strong> (<code>tf.Tensor</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/poolformer#transformers.PoolFormerFeatureExtractor.__call__">ViTImageProcessor.<strong>call</strong>()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.TFSwinForImageClassification.call.head_mask",description:`<strong>head_mask</strong> (<code>tf.Tensor</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.TFSwinForImageClassification.call.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.TFSwinForImageClassification.call.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.TFSwinForImageClassification.call.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.TFSwinForImageClassification.call.labels",description:`<strong>labels</strong> (<code>tf.Tensor</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/swin/modeling_tf_swin.py#L1428",returnDescription:`
<p>A <code>transformers.models.swin.modeling_tf_swin.TFSwinImageClassifierOutput</code> or a tuple of <code>tf.Tensor</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/swin#transformers.SwinConfig"
>SwinConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>tf.Tensor</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>tf.Tensor</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(tf.Tensor)</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>tf.Tensor</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(tf.Tensor)</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>tf.Tensor</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(tf.Tensor)</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>tf.Tensor</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.swin.modeling_tf_swin.TFSwinImageClassifierOutput</code> or <code>tuple(tf.Tensor)</code></p>
`}}),Ne=new Kt({props:{$$slots:{default:[gd]},$$scope:{ctx:M}}}),De=new Yt({props:{anchor:"transformers.TFSwinForImageClassification.call.example",$$slots:{default:[_d]},$$scope:{ctx:M}}}),{c(){d=n("meta"),b=u(),f=n("h1"),h=n("a"),w=n("span"),v(s.$$.fragment),p=u(),F=n("span"),vn=r("Swin Transformer"),ks=u(),Z=n("h2"),he=n("a"),Po=n("span"),v(Ge.$$.fragment),$n=u(),Co=n("span"),Tn=r("Overview"),Ms=u(),fe=n("p"),yn=r("The Swin Transformer was proposed in "),Je=n("a"),Sn=r("Swin Transformer: Hierarchical Vision Transformer using Shifted Windows"),kn=r(`
by Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, Baining Guo.`),Fs=u(),Jt=n("p"),Mn=r("The abstract from the paper is the following:"),Is=u(),Qt=n("p"),Ao=n("em"),Fn=r(`This paper presents a new vision Transformer, called Swin Transformer, that capably serves as a general-purpose backbone
for computer vision. Challenges in adapting Transformer from language to vision arise from differences between the two domains,
such as large variations in the scale of visual entities and the high resolution of pixels in images compared to words in text.
To address these differences, we propose a hierarchical Transformer whose representation is computed with \\bold{S}hifted
\\bold{win}dows. The shifted windowing scheme brings greater efficiency by limiting self-attention computation to non-overlapping
local windows while also allowing for cross-window connection. This hierarchical architecture has the flexibility to model at
various scales and has linear computational complexity with respect to image size. These qualities of Swin Transformer make it
compatible with a broad range of vision tasks, including image classification (87.3 top-1 accuracy on ImageNet-1K) and dense
prediction tasks such as object detection (58.7 box AP and 51.1 mask AP on COCO test-dev) and semantic segmentation
(53.5 mIoU on ADE20K val). Its performance surpasses the previous state-of-the-art by a large margin of +2.7 box AP and
+2.6 mask AP on COCO, and +3.2 mIoU on ADE20K, demonstrating the potential of Transformer-based models as vision backbones.
The hierarchical design and the shifted window approach also prove beneficial for all-MLP architectures.`),xs=u(),Xt=n("p"),In=r("Tips:"),js=u(),B=n("ul"),Qe=n("li"),xn=r("One can use the "),eo=n("a"),jn=r("AutoImageProcessor"),En=r(" API to prepare images for the model."),Pn=u(),Xe=n("li"),Cn=r("Swin pads the inputs supporting any input height and width (if divisible by "),qo=n("code"),An=r("32"),qn=r(")."),zn=u(),I=n("li"),On=r("Swin can be used as a "),zo=n("em"),Nn=r("backbone"),Dn=r(". When "),Oo=n("code"),Ln=r("output_hidden_states = True"),Hn=r(", it will output both "),No=n("code"),Wn=r("hidden_states"),Vn=r(" and "),Do=n("code"),Un=r("reshaped_hidden_states"),Bn=r(". The "),Lo=n("code"),Rn=r("reshaped_hidden_states"),Kn=r(" have a shape of "),Ho=n("code"),Yn=r("(batch, num_channels, height, width)"),Zn=r(" rather than "),Wo=n("code"),Gn=r("(batch_size, sequence_length, num_channels)"),Jn=r("."),Es=u(),ue=n("img"),Ps=u(),ge=n("small"),Qn=r("Swin Transformer architecture. Taken from the "),to=n("a"),Xn=r("original paper"),ea=r("."),Cs=u(),q=n("p"),ta=r("This model was contributed by "),et=n("a"),oa=r("novice03"),sa=r(". The Tensorflow version of this model was contributed by "),tt=n("a"),na=r("amyeroberts"),aa=r(". The original code can be found "),ot=n("a"),ra=r("here"),ia=r("."),As=u(),G=n("h2"),_e=n("a"),Vo=n("span"),v(st.$$.fragment),la=u(),Uo=n("span"),da=r("Resources"),qs=u(),oo=n("p"),ca=r("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with Swin Transformer."),zs=u(),v(nt.$$.fragment),Os=u(),so=n("ul"),R=n("li"),no=n("a"),pa=r("SwinForImageClassification"),ma=r(" is supported by this "),at=n("a"),ha=r("example script"),fa=r(" and "),rt=n("a"),ua=r("notebook"),ga=r("."),Ns=u(),ao=n("p"),_a=r("Besides that:"),Ds=u(),ro=n("ul"),we=n("li"),io=n("a"),wa=r("SwinForMaskedImageModeling"),ba=r(" is supported by this "),it=n("a"),va=r("example script"),$a=r("."),Ls=u(),lo=n("p"),Ta=r("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."),Hs=u(),J=n("h2"),be=n("a"),Bo=n("span"),v(lt.$$.fragment),ya=u(),Ro=n("span"),Sa=r("SwinConfig"),Ws=u(),E=n("div"),v(dt.$$.fragment),ka=u(),Q=n("p"),Ma=r("This is the configuration class to store the configuration of a "),co=n("a"),Fa=r("SwinModel"),Ia=r(`. It is used to instantiate a Swin
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
`),ct=n("a"),xa=r("microsoft/swin-tiny-patch4-window7-224"),ja=r(`
architecture.`),Ea=u(),X=n("p"),Pa=r("Configuration objects inherit from "),po=n("a"),Ca=r("PretrainedConfig"),Aa=r(` and can be used to control the model outputs. Read the
documentation from `),mo=n("a"),qa=r("PretrainedConfig"),za=r(" for more information."),Oa=u(),v(ve.$$.fragment),Vs=u(),ee=n("h2"),$e=n("a"),Ko=n("span"),v(pt.$$.fragment),Na=u(),Yo=n("span"),Da=r("SwinModel"),Us=u(),W=n("div"),v(mt.$$.fragment),La=u(),ht=n("p"),Ha=r(`The bare Swin Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),ft=n("a"),Wa=r("torch.nn.Module"),Va=r(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ua=u(),z=n("div"),v(ut.$$.fragment),Ba=u(),te=n("p"),Ra=r("The "),ho=n("a"),Ka=r("SwinModel"),Ya=r(" forward method, overrides the "),Zo=n("code"),Za=r("__call__"),Ga=r(" special method."),Ja=u(),v(Te.$$.fragment),Qa=u(),v(ye.$$.fragment),Bs=u(),oe=n("h2"),Se=n("a"),Go=n("span"),v(gt.$$.fragment),Xa=u(),Jo=n("span"),er=r("SwinForMaskedImageModeling"),Rs=u(),j=n("div"),v(_t.$$.fragment),tr=u(),wt=n("p"),or=r("Swin Model with a decoder on top for masked image modeling, as proposed in "),bt=n("a"),sr=r("SimMIM"),nr=r("."),ar=u(),v(ke.$$.fragment),rr=u(),vt=n("p"),ir=r("This model is a PyTorch "),$t=n("a"),lr=r("torch.nn.Module"),dr=r(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),cr=u(),O=n("div"),v(Tt.$$.fragment),pr=u(),se=n("p"),mr=r("The "),fo=n("a"),hr=r("SwinForMaskedImageModeling"),fr=r(" forward method, overrides the "),Qo=n("code"),ur=r("__call__"),gr=r(" special method."),_r=u(),v(Me.$$.fragment),wr=u(),v(Fe.$$.fragment),Ks=u(),ne=n("h2"),Ie=n("a"),Xo=n("span"),v(yt.$$.fragment),br=u(),es=n("span"),vr=r("SwinForImageClassification"),Ys=u(),P=n("div"),v(St.$$.fragment),$r=u(),ts=n("p"),Tr=r(`Swin 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.`),yr=u(),kt=n("p"),Sr=r("This model is a PyTorch "),Mt=n("a"),kr=r("torch.nn.Module"),Mr=r(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Fr=u(),N=n("div"),v(Ft.$$.fragment),Ir=u(),ae=n("p"),xr=r("The "),uo=n("a"),jr=r("SwinForImageClassification"),Er=r(" forward method, overrides the "),os=n("code"),Pr=r("__call__"),Cr=r(" special method."),Ar=u(),v(xe.$$.fragment),qr=u(),v(je.$$.fragment),Zs=u(),re=n("h2"),Ee=n("a"),ss=n("span"),v(It.$$.fragment),zr=u(),ns=n("span"),Or=r("TFSwinModel"),Gs=u(),V=n("div"),v(xt.$$.fragment),Nr=u(),jt=n("p"),Dr=r(`The bare Swin Model transformer outputting raw hidden-states without any specific head on top.
This model is a Tensorflow
`),Et=n("a"),Lr=r("tf.keras.layers.Layer"),Hr=r(` sub-class. Use it as a
regular Tensorflow Module and refer to the Tensorflow documentation for all matter related to general usage and
behavior.`),Wr=u(),D=n("div"),v(Pt.$$.fragment),Vr=u(),ie=n("p"),Ur=r("The "),go=n("a"),Br=r("TFSwinModel"),Rr=r(" forward method, overrides the "),as=n("code"),Kr=r("__call__"),Yr=r(" special method."),Zr=u(),v(Pe.$$.fragment),Gr=u(),v(Ce.$$.fragment),Js=u(),le=n("h2"),Ae=n("a"),rs=n("span"),v(Ct.$$.fragment),Jr=u(),is=n("span"),Qr=r("TFSwinForMaskedImageModeling"),Qs=u(),U=n("div"),v(At.$$.fragment),Xr=u(),de=n("p"),ei=r("Swin Model with a decoder on top for masked image modeling, as proposed in "),qt=n("a"),ti=r("SimMIM"),oi=r(`.
This model is a Tensorflow
`),zt=n("a"),si=r("tf.keras.layers.Layer"),ni=r(` sub-class. Use it as a
regular Tensorflow Module and refer to the Tensorflow documentation for all matter related to general usage and
behavior.`),ai=u(),L=n("div"),v(Ot.$$.fragment),ri=u(),ce=n("p"),ii=r("The "),_o=n("a"),li=r("TFSwinForMaskedImageModeling"),di=r(" forward method, overrides the "),ls=n("code"),ci=r("__call__"),pi=r(" special method."),mi=u(),v(qe.$$.fragment),hi=u(),v(ze.$$.fragment),Xs=u(),pe=n("h2"),Oe=n("a"),ds=n("span"),v(Nt.$$.fragment),fi=u(),cs=n("span"),ui=r("TFSwinForImageClassification"),en=u(),C=n("div"),v(Dt.$$.fragment),gi=u(),ps=n("p"),_i=r(`Swin 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.`),wi=u(),Lt=n("p"),bi=r(`This model is a Tensorflow
`),Ht=n("a"),vi=r("tf.keras.layers.Layer"),$i=r(` sub-class. Use it as a
regular Tensorflow Module and refer to the Tensorflow documentation for all matter related to general usage and
behavior.`),Ti=u(),H=n("div"),v(Wt.$$.fragment),yi=u(),me=n("p"),Si=r("The "),wo=n("a"),ki=r("TFSwinForImageClassification"),Mi=r(" forward method, overrides the "),ms=n("code"),Fi=r("__call__"),Ii=r(" special method."),xi=u(),v(Ne.$$.fragment),ji=u(),v(De.$$.fragment),this.h()},l(t){const m=ed('[data-svelte="svelte-1phssyn"]',document.head);d=a(m,"META",{name:!0,content:!0}),m.forEach(o),b=g(t),f=a(t,"H1",{class:!0});var Vt=l(f);h=a(Vt,"A",{id:!0,class:!0,href:!0});var hs=l(h);w=a(hs,"SPAN",{});var fs=l(w);$(s.$$.fragment,fs),fs.forEach(o),hs.forEach(o),p=g(Vt),F=a(Vt,"SPAN",{});var us=l(F);vn=i(us,"Swin Transformer"),us.forEach(o),Vt.forEach(o),ks=g(t),Z=a(t,"H2",{class:!0});var Ut=l(Z);he=a(Ut,"A",{id:!0,class:!0,href:!0});var gs=l(he);Po=a(gs,"SPAN",{});var _s=l(Po);$(Ge.$$.fragment,_s),_s.forEach(o),gs.forEach(o),$n=g(Ut),Co=a(Ut,"SPAN",{});var ws=l(Co);Tn=i(ws,"Overview"),ws.forEach(o),Ut.forEach(o),Ms=g(t),fe=a(t,"P",{});var Bt=l(fe);yn=i(Bt,"The Swin Transformer was proposed in "),Je=a(Bt,"A",{href:!0,rel:!0});var bs=l(Je);Sn=i(bs,"Swin Transformer: Hierarchical Vision Transformer using Shifted Windows"),bs.forEach(o),kn=i(Bt,`
by Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, Baining Guo.`),Bt.forEach(o),Fs=g(t),Jt=a(t,"P",{});var vs=l(Jt);Mn=i(vs,"The abstract from the paper is the following:"),vs.forEach(o),Is=g(t),Qt=a(t,"P",{});var $s=l(Qt);Ao=a($s,"EM",{});var Ts=l(Ao);Fn=i(Ts,`This paper presents a new vision Transformer, called Swin Transformer, that capably serves as a general-purpose backbone
for computer vision. Challenges in adapting Transformer from language to vision arise from differences between the two domains,
such as large variations in the scale of visual entities and the high resolution of pixels in images compared to words in text.
To address these differences, we propose a hierarchical Transformer whose representation is computed with \\bold{S}hifted
\\bold{win}dows. The shifted windowing scheme brings greater efficiency by limiting self-attention computation to non-overlapping
local windows while also allowing for cross-window connection. This hierarchical architecture has the flexibility to model at
various scales and has linear computational complexity with respect to image size. These qualities of Swin Transformer make it
compatible with a broad range of vision tasks, including image classification (87.3 top-1 accuracy on ImageNet-1K) and dense
prediction tasks such as object detection (58.7 box AP and 51.1 mask AP on COCO test-dev) and semantic segmentation
(53.5 mIoU on ADE20K val). Its performance surpasses the previous state-of-the-art by a large margin of +2.7 box AP and
+2.6 mask AP on COCO, and +3.2 mIoU on ADE20K, demonstrating the potential of Transformer-based models as vision backbones.
The hierarchical design and the shifted window approach also prove beneficial for all-MLP architectures.`),Ts.forEach(o),$s.forEach(o),xs=g(t),Xt=a(t,"P",{});var ys=l(Xt);In=i(ys,"Tips:"),ys.forEach(o),js=g(t),B=a(t,"UL",{});var bo=l(B);Qe=a(bo,"LI",{});var on=l(Qe);xn=i(on,"One can use the "),eo=a(on,"A",{href:!0});var Pi=l(eo);jn=i(Pi,"AutoImageProcessor"),Pi.forEach(o),En=i(on," API to prepare images for the model."),on.forEach(o),Pn=g(bo),Xe=a(bo,"LI",{});var sn=l(Xe);Cn=i(sn,"Swin pads the inputs supporting any input height and width (if divisible by "),qo=a(sn,"CODE",{});var Ci=l(qo);An=i(Ci,"32"),Ci.forEach(o),qn=i(sn,")."),sn.forEach(o),zn=g(bo),I=a(bo,"LI",{});var x=l(I);On=i(x,"Swin can be used as a "),zo=a(x,"EM",{});var Ai=l(zo);Nn=i(Ai,"backbone"),Ai.forEach(o),Dn=i(x,". When "),Oo=a(x,"CODE",{});var qi=l(Oo);Ln=i(qi,"output_hidden_states = True"),qi.forEach(o),Hn=i(x,", it will output both "),No=a(x,"CODE",{});var zi=l(No);Wn=i(zi,"hidden_states"),zi.forEach(o),Vn=i(x," and "),Do=a(x,"CODE",{});var Oi=l(Do);Un=i(Oi,"reshaped_hidden_states"),Oi.forEach(o),Bn=i(x,". The "),Lo=a(x,"CODE",{});var Ni=l(Lo);Rn=i(Ni,"reshaped_hidden_states"),Ni.forEach(o),Kn=i(x," have a shape of "),Ho=a(x,"CODE",{});var Di=l(Ho);Yn=i(Di,"(batch, num_channels, height, width)"),Di.forEach(o),Zn=i(x," rather than "),Wo=a(x,"CODE",{});var Li=l(Wo);Gn=i(Li,"(batch_size, sequence_length, num_channels)"),Li.forEach(o),Jn=i(x,"."),x.forEach(o),bo.forEach(o),Es=g(t),ue=a(t,"IMG",{src:!0,alt:!0,width:!0}),Ps=g(t),ge=a(t,"SMALL",{});var nn=l(ge);Qn=i(nn,"Swin Transformer architecture. Taken from the "),to=a(nn,"A",{href:!0});var Hi=l(to);Xn=i(Hi,"original paper"),Hi.forEach(o),ea=i(nn,"."),nn.forEach(o),Cs=g(t),q=a(t,"P",{});var Le=l(q);ta=i(Le,"This model was contributed by "),et=a(Le,"A",{href:!0,rel:!0});var Wi=l(et);oa=i(Wi,"novice03"),Wi.forEach(o),sa=i(Le,". The Tensorflow version of this model was contributed by "),tt=a(Le,"A",{href:!0,rel:!0});var Vi=l(tt);na=i(Vi,"amyeroberts"),Vi.forEach(o),aa=i(Le,". The original code can be found "),ot=a(Le,"A",{href:!0,rel:!0});var Ui=l(ot);ra=i(Ui,"here"),Ui.forEach(o),ia=i(Le,"."),Le.forEach(o),As=g(t),G=a(t,"H2",{class:!0});var an=l(G);_e=a(an,"A",{id:!0,class:!0,href:!0});var Bi=l(_e);Vo=a(Bi,"SPAN",{});var Ri=l(Vo);$(st.$$.fragment,Ri),Ri.forEach(o),Bi.forEach(o),la=g(an),Uo=a(an,"SPAN",{});var Ki=l(Uo);da=i(Ki,"Resources"),Ki.forEach(o),an.forEach(o),qs=g(t),oo=a(t,"P",{});var Yi=l(oo);ca=i(Yi,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with Swin Transformer."),Yi.forEach(o),zs=g(t),$(nt.$$.fragment,t),Os=g(t),so=a(t,"UL",{});var Zi=l(so);R=a(Zi,"LI",{});var Rt=l(R);no=a(Rt,"A",{href:!0});var Gi=l(no);pa=i(Gi,"SwinForImageClassification"),Gi.forEach(o),ma=i(Rt," is supported by this "),at=a(Rt,"A",{href:!0,rel:!0});var Ji=l(at);ha=i(Ji,"example script"),Ji.forEach(o),fa=i(Rt," and "),rt=a(Rt,"A",{href:!0,rel:!0});var Qi=l(rt);ua=i(Qi,"notebook"),Qi.forEach(o),ga=i(Rt,"."),Rt.forEach(o),Zi.forEach(o),Ns=g(t),ao=a(t,"P",{});var Xi=l(ao);_a=i(Xi,"Besides that:"),Xi.forEach(o),Ds=g(t),ro=a(t,"UL",{});var el=l(ro);we=a(el,"LI",{});var Ss=l(we);io=a(Ss,"A",{href:!0});var tl=l(io);wa=i(tl,"SwinForMaskedImageModeling"),tl.forEach(o),ba=i(Ss," is supported by this "),it=a(Ss,"A",{href:!0,rel:!0});var ol=l(it);va=i(ol,"example script"),ol.forEach(o),$a=i(Ss,"."),Ss.forEach(o),el.forEach(o),Ls=g(t),lo=a(t,"P",{});var sl=l(lo);Ta=i(sl,"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."),sl.forEach(o),Hs=g(t),J=a(t,"H2",{class:!0});var rn=l(J);be=a(rn,"A",{id:!0,class:!0,href:!0});var nl=l(be);Bo=a(nl,"SPAN",{});var al=l(Bo);$(lt.$$.fragment,al),al.forEach(o),nl.forEach(o),ya=g(rn),Ro=a(rn,"SPAN",{});var rl=l(Ro);Sa=i(rl,"SwinConfig"),rl.forEach(o),rn.forEach(o),Ws=g(t),E=a(t,"DIV",{class:!0});var He=l(E);$(dt.$$.fragment,He),ka=g(He),Q=a(He,"P",{});var vo=l(Q);Ma=i(vo,"This is the configuration class to store the configuration of a "),co=a(vo,"A",{href:!0});var il=l(co);Fa=i(il,"SwinModel"),il.forEach(o),Ia=i(vo,`. It is used to instantiate a Swin
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
`),ct=a(vo,"A",{href:!0,rel:!0});var ll=l(ct);xa=i(ll,"microsoft/swin-tiny-patch4-window7-224"),ll.forEach(o),ja=i(vo,`
architecture.`),vo.forEach(o),Ea=g(He),X=a(He,"P",{});var $o=l(X);Pa=i($o,"Configuration objects inherit from "),po=a($o,"A",{href:!0});var dl=l(po);Ca=i(dl,"PretrainedConfig"),dl.forEach(o),Aa=i($o,` and can be used to control the model outputs. Read the
documentation from `),mo=a($o,"A",{href:!0});var cl=l(mo);qa=i(cl,"PretrainedConfig"),cl.forEach(o),za=i($o," for more information."),$o.forEach(o),Oa=g(He),$(ve.$$.fragment,He),He.forEach(o),Vs=g(t),ee=a(t,"H2",{class:!0});var ln=l(ee);$e=a(ln,"A",{id:!0,class:!0,href:!0});var pl=l($e);Ko=a(pl,"SPAN",{});var ml=l(Ko);$(pt.$$.fragment,ml),ml.forEach(o),pl.forEach(o),Na=g(ln),Yo=a(ln,"SPAN",{});var hl=l(Yo);Da=i(hl,"SwinModel"),hl.forEach(o),ln.forEach(o),Us=g(t),W=a(t,"DIV",{class:!0});var To=l(W);$(mt.$$.fragment,To),La=g(To),ht=a(To,"P",{});var dn=l(ht);Ha=i(dn,`The bare Swin Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),ft=a(dn,"A",{href:!0,rel:!0});var fl=l(ft);Wa=i(fl,"torch.nn.Module"),fl.forEach(o),Va=i(dn,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),dn.forEach(o),Ua=g(To),z=a(To,"DIV",{class:!0});var We=l(z);$(ut.$$.fragment,We),Ba=g(We),te=a(We,"P",{});var yo=l(te);Ra=i(yo,"The "),ho=a(yo,"A",{href:!0});var ul=l(ho);Ka=i(ul,"SwinModel"),ul.forEach(o),Ya=i(yo," forward method, overrides the "),Zo=a(yo,"CODE",{});var gl=l(Zo);Za=i(gl,"__call__"),gl.forEach(o),Ga=i(yo," special method."),yo.forEach(o),Ja=g(We),$(Te.$$.fragment,We),Qa=g(We),$(ye.$$.fragment,We),We.forEach(o),To.forEach(o),Bs=g(t),oe=a(t,"H2",{class:!0});var cn=l(oe);Se=a(cn,"A",{id:!0,class:!0,href:!0});var _l=l(Se);Go=a(_l,"SPAN",{});var wl=l(Go);$(gt.$$.fragment,wl),wl.forEach(o),_l.forEach(o),Xa=g(cn),Jo=a(cn,"SPAN",{});var bl=l(Jo);er=i(bl,"SwinForMaskedImageModeling"),bl.forEach(o),cn.forEach(o),Rs=g(t),j=a(t,"DIV",{class:!0});var K=l(j);$(_t.$$.fragment,K),tr=g(K),wt=a(K,"P",{});var pn=l(wt);or=i(pn,"Swin Model with a decoder on top for masked image modeling, as proposed in "),bt=a(pn,"A",{href:!0,rel:!0});var vl=l(bt);sr=i(vl,"SimMIM"),vl.forEach(o),nr=i(pn,"."),pn.forEach(o),ar=g(K),$(ke.$$.fragment,K),rr=g(K),vt=a(K,"P",{});var mn=l(vt);ir=i(mn,"This model is a PyTorch "),$t=a(mn,"A",{href:!0,rel:!0});var $l=l($t);lr=i($l,"torch.nn.Module"),$l.forEach(o),dr=i(mn,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),mn.forEach(o),cr=g(K),O=a(K,"DIV",{class:!0});var Ve=l(O);$(Tt.$$.fragment,Ve),pr=g(Ve),se=a(Ve,"P",{});var So=l(se);mr=i(So,"The "),fo=a(So,"A",{href:!0});var Tl=l(fo);hr=i(Tl,"SwinForMaskedImageModeling"),Tl.forEach(o),fr=i(So," forward method, overrides the "),Qo=a(So,"CODE",{});var yl=l(Qo);ur=i(yl,"__call__"),yl.forEach(o),gr=i(So," special method."),So.forEach(o),_r=g(Ve),$(Me.$$.fragment,Ve),wr=g(Ve),$(Fe.$$.fragment,Ve),Ve.forEach(o),K.forEach(o),Ks=g(t),ne=a(t,"H2",{class:!0});var hn=l(ne);Ie=a(hn,"A",{id:!0,class:!0,href:!0});var Sl=l(Ie);Xo=a(Sl,"SPAN",{});var kl=l(Xo);$(yt.$$.fragment,kl),kl.forEach(o),Sl.forEach(o),br=g(hn),es=a(hn,"SPAN",{});var Ml=l(es);vr=i(Ml,"SwinForImageClassification"),Ml.forEach(o),hn.forEach(o),Ys=g(t),P=a(t,"DIV",{class:!0});var Ue=l(P);$(St.$$.fragment,Ue),$r=g(Ue),ts=a(Ue,"P",{});var Fl=l(ts);Tr=i(Fl,`Swin 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.`),Fl.forEach(o),yr=g(Ue),kt=a(Ue,"P",{});var fn=l(kt);Sr=i(fn,"This model is a PyTorch "),Mt=a(fn,"A",{href:!0,rel:!0});var Il=l(Mt);kr=i(Il,"torch.nn.Module"),Il.forEach(o),Mr=i(fn,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),fn.forEach(o),Fr=g(Ue),N=a(Ue,"DIV",{class:!0});var Be=l(N);$(Ft.$$.fragment,Be),Ir=g(Be),ae=a(Be,"P",{});var ko=l(ae);xr=i(ko,"The "),uo=a(ko,"A",{href:!0});var xl=l(uo);jr=i(xl,"SwinForImageClassification"),xl.forEach(o),Er=i(ko," forward method, overrides the "),os=a(ko,"CODE",{});var jl=l(os);Pr=i(jl,"__call__"),jl.forEach(o),Cr=i(ko," special method."),ko.forEach(o),Ar=g(Be),$(xe.$$.fragment,Be),qr=g(Be),$(je.$$.fragment,Be),Be.forEach(o),Ue.forEach(o),Zs=g(t),re=a(t,"H2",{class:!0});var un=l(re);Ee=a(un,"A",{id:!0,class:!0,href:!0});var El=l(Ee);ss=a(El,"SPAN",{});var Pl=l(ss);$(It.$$.fragment,Pl),Pl.forEach(o),El.forEach(o),zr=g(un),ns=a(un,"SPAN",{});var Cl=l(ns);Or=i(Cl,"TFSwinModel"),Cl.forEach(o),un.forEach(o),Gs=g(t),V=a(t,"DIV",{class:!0});var Mo=l(V);$(xt.$$.fragment,Mo),Nr=g(Mo),jt=a(Mo,"P",{});var gn=l(jt);Dr=i(gn,`The bare Swin Model transformer outputting raw hidden-states without any specific head on top.
This model is a Tensorflow
`),Et=a(gn,"A",{href:!0,rel:!0});var Al=l(Et);Lr=i(Al,"tf.keras.layers.Layer"),Al.forEach(o),Hr=i(gn,` sub-class. Use it as a
regular Tensorflow Module and refer to the Tensorflow documentation for all matter related to general usage and
behavior.`),gn.forEach(o),Wr=g(Mo),D=a(Mo,"DIV",{class:!0});var Re=l(D);$(Pt.$$.fragment,Re),Vr=g(Re),ie=a(Re,"P",{});var Fo=l(ie);Ur=i(Fo,"The "),go=a(Fo,"A",{href:!0});var ql=l(go);Br=i(ql,"TFSwinModel"),ql.forEach(o),Rr=i(Fo," forward method, overrides the "),as=a(Fo,"CODE",{});var zl=l(as);Kr=i(zl,"__call__"),zl.forEach(o),Yr=i(Fo," special method."),Fo.forEach(o),Zr=g(Re),$(Pe.$$.fragment,Re),Gr=g(Re),$(Ce.$$.fragment,Re),Re.forEach(o),Mo.forEach(o),Js=g(t),le=a(t,"H2",{class:!0});var _n=l(le);Ae=a(_n,"A",{id:!0,class:!0,href:!0});var Ol=l(Ae);rs=a(Ol,"SPAN",{});var Nl=l(rs);$(Ct.$$.fragment,Nl),Nl.forEach(o),Ol.forEach(o),Jr=g(_n),is=a(_n,"SPAN",{});var Dl=l(is);Qr=i(Dl,"TFSwinForMaskedImageModeling"),Dl.forEach(o),_n.forEach(o),Qs=g(t),U=a(t,"DIV",{class:!0});var Io=l(U);$(At.$$.fragment,Io),Xr=g(Io),de=a(Io,"P",{});var xo=l(de);ei=i(xo,"Swin Model with a decoder on top for masked image modeling, as proposed in "),qt=a(xo,"A",{href:!0,rel:!0});var Ll=l(qt);ti=i(Ll,"SimMIM"),Ll.forEach(o),oi=i(xo,`.
This model is a Tensorflow
`),zt=a(xo,"A",{href:!0,rel:!0});var Hl=l(zt);si=i(Hl,"tf.keras.layers.Layer"),Hl.forEach(o),ni=i(xo,` sub-class. Use it as a
regular Tensorflow Module and refer to the Tensorflow documentation for all matter related to general usage and
behavior.`),xo.forEach(o),ai=g(Io),L=a(Io,"DIV",{class:!0});var Ke=l(L);$(Ot.$$.fragment,Ke),ri=g(Ke),ce=a(Ke,"P",{});var jo=l(ce);ii=i(jo,"The "),_o=a(jo,"A",{href:!0});var Wl=l(_o);li=i(Wl,"TFSwinForMaskedImageModeling"),Wl.forEach(o),di=i(jo," forward method, overrides the "),ls=a(jo,"CODE",{});var Vl=l(ls);ci=i(Vl,"__call__"),Vl.forEach(o),pi=i(jo," special method."),jo.forEach(o),mi=g(Ke),$(qe.$$.fragment,Ke),hi=g(Ke),$(ze.$$.fragment,Ke),Ke.forEach(o),Io.forEach(o),Xs=g(t),pe=a(t,"H2",{class:!0});var wn=l(pe);Oe=a(wn,"A",{id:!0,class:!0,href:!0});var Ul=l(Oe);ds=a(Ul,"SPAN",{});var Bl=l(ds);$(Nt.$$.fragment,Bl),Bl.forEach(o),Ul.forEach(o),fi=g(wn),cs=a(wn,"SPAN",{});var Rl=l(cs);ui=i(Rl,"TFSwinForImageClassification"),Rl.forEach(o),wn.forEach(o),en=g(t),C=a(t,"DIV",{class:!0});var Ye=l(C);$(Dt.$$.fragment,Ye),gi=g(Ye),ps=a(Ye,"P",{});var Kl=l(ps);_i=i(Kl,`Swin 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.`),Kl.forEach(o),wi=g(Ye),Lt=a(Ye,"P",{});var bn=l(Lt);bi=i(bn,`This model is a Tensorflow
`),Ht=a(bn,"A",{href:!0,rel:!0});var Yl=l(Ht);vi=i(Yl,"tf.keras.layers.Layer"),Yl.forEach(o),$i=i(bn,` sub-class. Use it as a
regular Tensorflow Module and refer to the Tensorflow documentation for all matter related to general usage and
behavior.`),bn.forEach(o),Ti=g(Ye),H=a(Ye,"DIV",{class:!0});var Ze=l(H);$(Wt.$$.fragment,Ze),yi=g(Ze),me=a(Ze,"P",{});var Eo=l(me);Si=i(Eo,"The "),wo=a(Eo,"A",{href:!0});var Zl=l(wo);ki=i(Zl,"TFSwinForImageClassification"),Zl.forEach(o),Mi=i(Eo," forward method, overrides the "),ms=a(Eo,"CODE",{});var Gl=l(ms);Fi=i(Gl,"__call__"),Gl.forEach(o),Ii=i(Eo," special method."),Eo.forEach(o),xi=g(Ze),$(Ne.$$.fragment,Ze),ji=g(Ze),$(De.$$.fragment,Ze),Ze.forEach(o),Ye.forEach(o),this.h()},h(){c(d,"name","hf:doc:metadata"),c(d,"content",JSON.stringify(bd)),c(h,"id","swin-transformer"),c(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"),c(h,"href","#swin-transformer"),c(f,"class","relative group"),c(he,"id","overview"),c(he,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(he,"href","#overview"),c(Z,"class","relative group"),c(Je,"href","https://arxiv.org/abs/2103.14030"),c(Je,"rel","nofollow"),c(eo,"href","/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor"),td(ue.src,Ei="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/swin_transformer_architecture.png")||c(ue,"src",Ei),c(ue,"alt","drawing"),c(ue,"width","600"),c(to,"href","https://arxiv.org/abs/2102.03334"),c(et,"href","https://huggingface.co/novice03"),c(et,"rel","nofollow"),c(tt,"href","https://huggingface.co/amyeroberts"),c(tt,"rel","nofollow"),c(ot,"href","https://github.com/microsoft/Swin-Transformer"),c(ot,"rel","nofollow"),c(_e,"id","resources"),c(_e,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(_e,"href","#resources"),c(G,"class","relative group"),c(no,"href","/docs/transformers/main/en/model_doc/swin#transformers.SwinForImageClassification"),c(at,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification"),c(at,"rel","nofollow"),c(rt,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb"),c(rt,"rel","nofollow"),c(io,"href","/docs/transformers/main/en/model_doc/swin#transformers.SwinForMaskedImageModeling"),c(it,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-pretraining"),c(it,"rel","nofollow"),c(be,"id","transformers.SwinConfig"),c(be,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(be,"href","#transformers.SwinConfig"),c(J,"class","relative group"),c(co,"href","/docs/transformers/main/en/model_doc/swin#transformers.SwinModel"),c(ct,"href","https://huggingface.co/microsoft/swin-tiny-patch4-window7-224"),c(ct,"rel","nofollow"),c(po,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),c(mo,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),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"),c($e,"id","transformers.SwinModel"),c($e,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c($e,"href","#transformers.SwinModel"),c(ee,"class","relative group"),c(ft,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(ft,"rel","nofollow"),c(ho,"href","/docs/transformers/main/en/model_doc/swin#transformers.SwinModel"),c(z,"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(Se,"id","transformers.SwinForMaskedImageModeling"),c(Se,"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(Se,"href","#transformers.SwinForMaskedImageModeling"),c(oe,"class","relative group"),c(bt,"href","https://arxiv.org/abs/2111.09886"),c(bt,"rel","nofollow"),c($t,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c($t,"rel","nofollow"),c(fo,"href","/docs/transformers/main/en/model_doc/swin#transformers.SwinForMaskedImageModeling"),c(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),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(Ie,"id","transformers.SwinForImageClassification"),c(Ie,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(Ie,"href","#transformers.SwinForImageClassification"),c(ne,"class","relative group"),c(Mt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(Mt,"rel","nofollow"),c(uo,"href","/docs/transformers/main/en/model_doc/swin#transformers.SwinForImageClassification"),c(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Ee,"id","transformers.TFSwinModel"),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.TFSwinModel"),c(re,"class","relative group"),c(Et,"href","https://www.tensorflow.org/api_docs/python/tf/keras/layers/Layer"),c(Et,"rel","nofollow"),c(go,"href","/docs/transformers/main/en/model_doc/swin#transformers.TFSwinModel"),c(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(V,"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.TFSwinForMaskedImageModeling"),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.TFSwinForMaskedImageModeling"),c(le,"class","relative group"),c(qt,"href","https://arxiv.org/abs/2111.09886"),c(qt,"rel","nofollow"),c(zt,"href","https://www.tensorflow.org/api_docs/python/tf/keras/layers/Layer"),c(zt,"rel","nofollow"),c(_o,"href","/docs/transformers/main/en/model_doc/swin#transformers.TFSwinForMaskedImageModeling"),c(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),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(Oe,"id","transformers.TFSwinForImageClassification"),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.TFSwinForImageClassification"),c(pe,"class","relative group"),c(Ht,"href","https://www.tensorflow.org/api_docs/python/tf/keras/layers/Layer"),c(Ht,"rel","nofollow"),c(wo,"href","/docs/transformers/main/en/model_doc/swin#transformers.TFSwinForImageClassification"),c(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),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")},m(t,m){e(document.head,d),_(t,b,m),_(t,f,m),e(f,h),e(h,w),T(s,w,null),e(f,p),e(f,F),e(F,vn),_(t,ks,m),_(t,Z,m),e(Z,he),e(he,Po),T(Ge,Po,null),e(Z,$n),e(Z,Co),e(Co,Tn),_(t,Ms,m),_(t,fe,m),e(fe,yn),e(fe,Je),e(Je,Sn),e(fe,kn),_(t,Fs,m),_(t,Jt,m),e(Jt,Mn),_(t,Is,m),_(t,Qt,m),e(Qt,Ao),e(Ao,Fn),_(t,xs,m),_(t,Xt,m),e(Xt,In),_(t,js,m),_(t,B,m),e(B,Qe),e(Qe,xn),e(Qe,eo),e(eo,jn),e(Qe,En),e(B,Pn),e(B,Xe),e(Xe,Cn),e(Xe,qo),e(qo,An),e(Xe,qn),e(B,zn),e(B,I),e(I,On),e(I,zo),e(zo,Nn),e(I,Dn),e(I,Oo),e(Oo,Ln),e(I,Hn),e(I,No),e(No,Wn),e(I,Vn),e(I,Do),e(Do,Un),e(I,Bn),e(I,Lo),e(Lo,Rn),e(I,Kn),e(I,Ho),e(Ho,Yn),e(I,Zn),e(I,Wo),e(Wo,Gn),e(I,Jn),_(t,Es,m),_(t,ue,m),_(t,Ps,m),_(t,ge,m),e(ge,Qn),e(ge,to),e(to,Xn),e(ge,ea),_(t,Cs,m),_(t,q,m),e(q,ta),e(q,et),e(et,oa),e(q,sa),e(q,tt),e(tt,na),e(q,aa),e(q,ot),e(ot,ra),e(q,ia),_(t,As,m),_(t,G,m),e(G,_e),e(_e,Vo),T(st,Vo,null),e(G,la),e(G,Uo),e(Uo,da),_(t,qs,m),_(t,oo,m),e(oo,ca),_(t,zs,m),T(nt,t,m),_(t,Os,m),_(t,so,m),e(so,R),e(R,no),e(no,pa),e(R,ma),e(R,at),e(at,ha),e(R,fa),e(R,rt),e(rt,ua),e(R,ga),_(t,Ns,m),_(t,ao,m),e(ao,_a),_(t,Ds,m),_(t,ro,m),e(ro,we),e(we,io),e(io,wa),e(we,ba),e(we,it),e(it,va),e(we,$a),_(t,Ls,m),_(t,lo,m),e(lo,Ta),_(t,Hs,m),_(t,J,m),e(J,be),e(be,Bo),T(lt,Bo,null),e(J,ya),e(J,Ro),e(Ro,Sa),_(t,Ws,m),_(t,E,m),T(dt,E,null),e(E,ka),e(E,Q),e(Q,Ma),e(Q,co),e(co,Fa),e(Q,Ia),e(Q,ct),e(ct,xa),e(Q,ja),e(E,Ea),e(E,X),e(X,Pa),e(X,po),e(po,Ca),e(X,Aa),e(X,mo),e(mo,qa),e(X,za),e(E,Oa),T(ve,E,null),_(t,Vs,m),_(t,ee,m),e(ee,$e),e($e,Ko),T(pt,Ko,null),e(ee,Na),e(ee,Yo),e(Yo,Da),_(t,Us,m),_(t,W,m),T(mt,W,null),e(W,La),e(W,ht),e(ht,Ha),e(ht,ft),e(ft,Wa),e(ht,Va),e(W,Ua),e(W,z),T(ut,z,null),e(z,Ba),e(z,te),e(te,Ra),e(te,ho),e(ho,Ka),e(te,Ya),e(te,Zo),e(Zo,Za),e(te,Ga),e(z,Ja),T(Te,z,null),e(z,Qa),T(ye,z,null),_(t,Bs,m),_(t,oe,m),e(oe,Se),e(Se,Go),T(gt,Go,null),e(oe,Xa),e(oe,Jo),e(Jo,er),_(t,Rs,m),_(t,j,m),T(_t,j,null),e(j,tr),e(j,wt),e(wt,or),e(wt,bt),e(bt,sr),e(wt,nr),e(j,ar),T(ke,j,null),e(j,rr),e(j,vt),e(vt,ir),e(vt,$t),e($t,lr),e(vt,dr),e(j,cr),e(j,O),T(Tt,O,null),e(O,pr),e(O,se),e(se,mr),e(se,fo),e(fo,hr),e(se,fr),e(se,Qo),e(Qo,ur),e(se,gr),e(O,_r),T(Me,O,null),e(O,wr),T(Fe,O,null),_(t,Ks,m),_(t,ne,m),e(ne,Ie),e(Ie,Xo),T(yt,Xo,null),e(ne,br),e(ne,es),e(es,vr),_(t,Ys,m),_(t,P,m),T(St,P,null),e(P,$r),e(P,ts),e(ts,Tr),e(P,yr),e(P,kt),e(kt,Sr),e(kt,Mt),e(Mt,kr),e(kt,Mr),e(P,Fr),e(P,N),T(Ft,N,null),e(N,Ir),e(N,ae),e(ae,xr),e(ae,uo),e(uo,jr),e(ae,Er),e(ae,os),e(os,Pr),e(ae,Cr),e(N,Ar),T(xe,N,null),e(N,qr),T(je,N,null),_(t,Zs,m),_(t,re,m),e(re,Ee),e(Ee,ss),T(It,ss,null),e(re,zr),e(re,ns),e(ns,Or),_(t,Gs,m),_(t,V,m),T(xt,V,null),e(V,Nr),e(V,jt),e(jt,Dr),e(jt,Et),e(Et,Lr),e(jt,Hr),e(V,Wr),e(V,D),T(Pt,D,null),e(D,Vr),e(D,ie),e(ie,Ur),e(ie,go),e(go,Br),e(ie,Rr),e(ie,as),e(as,Kr),e(ie,Yr),e(D,Zr),T(Pe,D,null),e(D,Gr),T(Ce,D,null),_(t,Js,m),_(t,le,m),e(le,Ae),e(Ae,rs),T(Ct,rs,null),e(le,Jr),e(le,is),e(is,Qr),_(t,Qs,m),_(t,U,m),T(At,U,null),e(U,Xr),e(U,de),e(de,ei),e(de,qt),e(qt,ti),e(de,oi),e(de,zt),e(zt,si),e(de,ni),e(U,ai),e(U,L),T(Ot,L,null),e(L,ri),e(L,ce),e(ce,ii),e(ce,_o),e(_o,li),e(ce,di),e(ce,ls),e(ls,ci),e(ce,pi),e(L,mi),T(qe,L,null),e(L,hi),T(ze,L,null),_(t,Xs,m),_(t,pe,m),e(pe,Oe),e(Oe,ds),T(Nt,ds,null),e(pe,fi),e(pe,cs),e(cs,ui),_(t,en,m),_(t,C,m),T(Dt,C,null),e(C,gi),e(C,ps),e(ps,_i),e(C,wi),e(C,Lt),e(Lt,bi),e(Lt,Ht),e(Ht,vi),e(Lt,$i),e(C,Ti),e(C,H),T(Wt,H,null),e(H,yi),e(H,me),e(me,Si),e(me,wo),e(wo,ki),e(me,Mi),e(me,ms),e(ms,Fi),e(me,Ii),e(H,xi),T(Ne,H,null),e(H,ji),T(De,H,null),tn=!0},p(t,[m]){const Vt={};m&2&&(Vt.$$scope={dirty:m,ctx:t}),ve.$set(Vt);const hs={};m&2&&(hs.$$scope={dirty:m,ctx:t}),Te.$set(hs);const fs={};m&2&&(fs.$$scope={dirty:m,ctx:t}),ye.$set(fs);const us={};m&2&&(us.$$scope={dirty:m,ctx:t}),ke.$set(us);const Ut={};m&2&&(Ut.$$scope={dirty:m,ctx:t}),Me.$set(Ut);const gs={};m&2&&(gs.$$scope={dirty:m,ctx:t}),Fe.$set(gs);const _s={};m&2&&(_s.$$scope={dirty:m,ctx:t}),xe.$set(_s);const ws={};m&2&&(ws.$$scope={dirty:m,ctx:t}),je.$set(ws);const Bt={};m&2&&(Bt.$$scope={dirty:m,ctx:t}),Pe.$set(Bt);const bs={};m&2&&(bs.$$scope={dirty:m,ctx:t}),Ce.$set(bs);const vs={};m&2&&(vs.$$scope={dirty:m,ctx:t}),qe.$set(vs);const $s={};m&2&&($s.$$scope={dirty:m,ctx:t}),ze.$set($s);const Ts={};m&2&&(Ts.$$scope={dirty:m,ctx:t}),Ne.$set(Ts);const ys={};m&2&&(ys.$$scope={dirty:m,ctx:t}),De.$set(ys)},i(t){tn||(y(s.$$.fragment,t),y(Ge.$$.fragment,t),y(st.$$.fragment,t),y(nt.$$.fragment,t),y(lt.$$.fragment,t),y(dt.$$.fragment,t),y(ve.$$.fragment,t),y(pt.$$.fragment,t),y(mt.$$.fragment,t),y(ut.$$.fragment,t),y(Te.$$.fragment,t),y(ye.$$.fragment,t),y(gt.$$.fragment,t),y(_t.$$.fragment,t),y(ke.$$.fragment,t),y(Tt.$$.fragment,t),y(Me.$$.fragment,t),y(Fe.$$.fragment,t),y(yt.$$.fragment,t),y(St.$$.fragment,t),y(Ft.$$.fragment,t),y(xe.$$.fragment,t),y(je.$$.fragment,t),y(It.$$.fragment,t),y(xt.$$.fragment,t),y(Pt.$$.fragment,t),y(Pe.$$.fragment,t),y(Ce.$$.fragment,t),y(Ct.$$.fragment,t),y(At.$$.fragment,t),y(Ot.$$.fragment,t),y(qe.$$.fragment,t),y(ze.$$.fragment,t),y(Nt.$$.fragment,t),y(Dt.$$.fragment,t),y(Wt.$$.fragment,t),y(Ne.$$.fragment,t),y(De.$$.fragment,t),tn=!0)},o(t){S(s.$$.fragment,t),S(Ge.$$.fragment,t),S(st.$$.fragment,t),S(nt.$$.fragment,t),S(lt.$$.fragment,t),S(dt.$$.fragment,t),S(ve.$$.fragment,t),S(pt.$$.fragment,t),S(mt.$$.fragment,t),S(ut.$$.fragment,t),S(Te.$$.fragment,t),S(ye.$$.fragment,t),S(gt.$$.fragment,t),S(_t.$$.fragment,t),S(ke.$$.fragment,t),S(Tt.$$.fragment,t),S(Me.$$.fragment,t),S(Fe.$$.fragment,t),S(yt.$$.fragment,t),S(St.$$.fragment,t),S(Ft.$$.fragment,t),S(xe.$$.fragment,t),S(je.$$.fragment,t),S(It.$$.fragment,t),S(xt.$$.fragment,t),S(Pt.$$.fragment,t),S(Pe.$$.fragment,t),S(Ce.$$.fragment,t),S(Ct.$$.fragment,t),S(At.$$.fragment,t),S(Ot.$$.fragment,t),S(qe.$$.fragment,t),S(ze.$$.fragment,t),S(Nt.$$.fragment,t),S(Dt.$$.fragment,t),S(Wt.$$.fragment,t),S(Ne.$$.fragment,t),S(De.$$.fragment,t),tn=!1},d(t){o(d),t&&o(b),t&&o(f),k(s),t&&o(ks),t&&o(Z),k(Ge),t&&o(Ms),t&&o(fe),t&&o(Fs),t&&o(Jt),t&&o(Is),t&&o(Qt),t&&o(xs),t&&o(Xt),t&&o(js),t&&o(B),t&&o(Es),t&&o(ue),t&&o(Ps),t&&o(ge),t&&o(Cs),t&&o(q),t&&o(As),t&&o(G),k(st),t&&o(qs),t&&o(oo),t&&o(zs),k(nt,t),t&&o(Os),t&&o(so),t&&o(Ns),t&&o(ao),t&&o(Ds),t&&o(ro),t&&o(Ls),t&&o(lo),t&&o(Hs),t&&o(J),k(lt),t&&o(Ws),t&&o(E),k(dt),k(ve),t&&o(Vs),t&&o(ee),k(pt),t&&o(Us),t&&o(W),k(mt),k(ut),k(Te),k(ye),t&&o(Bs),t&&o(oe),k(gt),t&&o(Rs),t&&o(j),k(_t),k(ke),k(Tt),k(Me),k(Fe),t&&o(Ks),t&&o(ne),k(yt),t&&o(Ys),t&&o(P),k(St),k(Ft),k(xe),k(je),t&&o(Zs),t&&o(re),k(It),t&&o(Gs),t&&o(V),k(xt),k(Pt),k(Pe),k(Ce),t&&o(Js),t&&o(le),k(Ct),t&&o(Qs),t&&o(U),k(At),k(Ot),k(qe),k(ze),t&&o(Xs),t&&o(pe),k(Nt),t&&o(en),t&&o(C),k(Dt),k(Wt),k(Ne),k(De)}}}const bd={local:"swin-transformer",sections:[{local:"overview",title:"Overview"},{local:"resources",title:"Resources"},{local:"transformers.SwinConfig",title:"SwinConfig"},{local:"transformers.SwinModel",title:"SwinModel"},{local:"transformers.SwinForMaskedImageModeling",title:"SwinForMaskedImageModeling"},{local:"transformers.SwinForImageClassification",title:"SwinForImageClassification"},{local:"transformers.TFSwinModel",title:"TFSwinModel"},{local:"transformers.TFSwinForMaskedImageModeling",title:"TFSwinForMaskedImageModeling"},{local:"transformers.TFSwinForImageClassification",title:"TFSwinForImageClassification"}],title:"Swin Transformer"};function vd(M){return od(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Id extends Jl{constructor(d){super();Ql(this,d,vd,wd,Xl,{})}}export{Id as default,bd as metadata};
