import{S as nd,i as ad,s as rd,e as n,k as u,w as b,t as r,M as id,c as a,d as o,m as g,a as l,x as $,h as i,b as c,N as ld,G as e,g as _,y as T,q as y,o as S,B as k,v as dd,L as Gt}from"../../chunks/vendor-hf-doc-builder.js";import{T as Yt}from"../../chunks/Tip-hf-doc-builder.js";import{D as A}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Jt}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Y}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Zt}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as cd}from"../../chunks/PipelineTag-hf-doc-builder.js";function pd(M){let d,v,f,m,w;return m=new Jt({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"),v=r("Example:"),f=u(),b(m.$$.fragment)},l(s){d=a(s,"P",{});var p=l(d);v=i(p,"Example:"),p.forEach(o),f=g(s),$(m.$$.fragment,s)},m(s,p){_(s,d,p),e(d,v),_(s,f,p),T(m,s,p),w=!0},p:Gt,i(s){w||(y(m.$$.fragment,s),w=!0)},o(s){S(m.$$.fragment,s),w=!1},d(s){s&&o(d),s&&o(f),k(m,s)}}}function hd(M){let d,v,f,m,w;return{c(){d=n("p"),v=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),m=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);v=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);m=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,v),e(d,f),e(f,m),e(d,w)},d(s){s&&o(d)}}}function md(M){let d,v,f,m,w;return m=new Jt({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"),v=r("Example:"),f=u(),b(m.$$.fragment)},l(s){d=a(s,"P",{});var p=l(d);v=i(p,"Example:"),p.forEach(o),f=g(s),$(m.$$.fragment,s)},m(s,p){_(s,d,p),e(d,v),_(s,f,p),T(m,s,p),w=!0},p:Gt,i(s){w||(y(m.$$.fragment,s),w=!0)},o(s){S(m.$$.fragment,s),w=!1},d(s){s&&o(d),s&&o(f),k(m,s)}}}function fd(M){let d,v,f,m,w;return{c(){d=n("p"),v=r("Note that we provide a script to pre-train this model on custom data in our "),f=n("a"),m=r(`examples
directory`),w=r("."),this.h()},l(s){d=a(s,"P",{});var p=l(d);v=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);m=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,v),e(d,f),e(f,m),e(d,w)},d(s){s&&o(d)}}}function ud(M){let d,v,f,m,w;return{c(){d=n("p"),v=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),m=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);v=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);m=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,v),e(d,f),e(f,m),e(d,w)},d(s){s&&o(d)}}}function gd(M){let d,v,f,m,w;return m=new Jt({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.reconstruction
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.reconstruction
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(reconstructed_pixel_values.shape)
[<span class="hljs-number">1</span>, <span class="hljs-number">3</span>, <span class="hljs-number">192</span>, <span class="hljs-number">192</span>]`}}),{c(){d=n("p"),v=r("Examples:"),f=u(),b(m.$$.fragment)},l(s){d=a(s,"P",{});var p=l(d);v=i(p,"Examples:"),p.forEach(o),f=g(s),$(m.$$.fragment,s)},m(s,p){_(s,d,p),e(d,v),_(s,f,p),T(m,s,p),w=!0},p:Gt,i(s){w||(y(m.$$.fragment,s),w=!0)},o(s){S(m.$$.fragment,s),w=!1},d(s){s&&o(d),s&&o(f),k(m,s)}}}function _d(M){let d,v,f,m,w;return{c(){d=n("p"),v=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),m=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);v=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);m=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,v),e(d,f),e(f,m),e(d,w)},d(s){s&&o(d)}}}function wd(M){let d,v,f,m,w;return m=new Jt({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"),v=r("Example:"),f=u(),b(m.$$.fragment)},l(s){d=a(s,"P",{});var p=l(d);v=i(p,"Example:"),p.forEach(o),f=g(s),$(m.$$.fragment,s)},m(s,p){_(s,d,p),e(d,v),_(s,f,p),T(m,s,p),w=!0},p:Gt,i(s){w||(y(m.$$.fragment,s),w=!0)},o(s){S(m.$$.fragment,s),w=!1},d(s){s&&o(d),s&&o(f),k(m,s)}}}function vd(M){let d,v,f,m,w;return{c(){d=n("p"),v=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),m=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);v=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);m=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,v),e(d,f),e(f,m),e(d,w)},d(s){s&&o(d)}}}function bd(M){let d,v,f,m,w;return m=new Jt({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"),v=r("Example:"),f=u(),b(m.$$.fragment)},l(s){d=a(s,"P",{});var p=l(d);v=i(p,"Example:"),p.forEach(o),f=g(s),$(m.$$.fragment,s)},m(s,p){_(s,d,p),e(d,v),_(s,f,p),T(m,s,p),w=!0},p:Gt,i(s){w||(y(m.$$.fragment,s),w=!0)},o(s){S(m.$$.fragment,s),w=!1},d(s){s&&o(d),s&&o(f),k(m,s)}}}function $d(M){let d,v,f,m,w;return{c(){d=n("p"),v=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),m=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);v=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);m=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,v),e(d,f),e(f,m),e(d,w)},d(s){s&&o(d)}}}function Td(M){let d,v,f,m,w;return m=new Jt({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.reconstruction
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.reconstruction
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(reconstructed_pixel_values.shape)
[<span class="hljs-number">1</span>, <span class="hljs-number">3</span>, <span class="hljs-number">224</span>, <span class="hljs-number">224</span>]`}}),{c(){d=n("p"),v=r("Examples:"),f=u(),b(m.$$.fragment)},l(s){d=a(s,"P",{});var p=l(d);v=i(p,"Examples:"),p.forEach(o),f=g(s),$(m.$$.fragment,s)},m(s,p){_(s,d,p),e(d,v),_(s,f,p),T(m,s,p),w=!0},p:Gt,i(s){w||(y(m.$$.fragment,s),w=!0)},o(s){S(m.$$.fragment,s),w=!1},d(s){s&&o(d),s&&o(f),k(m,s)}}}function yd(M){let d,v,f,m,w;return{c(){d=n("p"),v=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),m=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);v=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);m=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,v),e(d,f),e(f,m),e(d,w)},d(s){s&&o(d)}}}function Sd(M){let d,v,f,m,w;return m=new Jt({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"),v=r("Example:"),f=u(),b(m.$$.fragment)},l(s){d=a(s,"P",{});var p=l(d);v=i(p,"Example:"),p.forEach(o),f=g(s),$(m.$$.fragment,s)},m(s,p){_(s,d,p),e(d,v),_(s,f,p),T(m,s,p),w=!0},p:Gt,i(s){w||(y(m.$$.fragment,s),w=!0)},o(s){S(m.$$.fragment,s),w=!1},d(s){s&&o(d),s&&o(f),k(m,s)}}}function kd(M){let d,v,f,m,w,s,p,F,yn,Fs,Z,me,Ao,Je,Sn,qo,kn,Is,fe,Mn,Qe,Fn,In,xs,Qt,xn,js,Xt,zo,jn,Es,eo,En,Ps,B,Xe,Pn,to,Cn,An,qn,et,zn,Oo,On,Nn,Dn,I,Ln,No,Hn,Wn,Do,Vn,Un,Lo,Bn,Rn,Ho,Kn,Yn,Wo,Zn,Gn,Vo,Jn,Qn,Uo,Xn,ea,Cs,ue,Ni,As,ge,ta,oo,oa,sa,qs,q,na,tt,aa,ra,ot,ia,la,st,da,ca,zs,G,_e,Bo,nt,pa,Ro,ha,Os,so,ma,Ns,at,Ds,we,R,no,fa,ua,rt,ga,_a,it,wa,va,ba,ao,$a,ro,Ta,Ls,io,ya,Hs,lo,ve,co,Sa,ka,lt,Ma,Fa,Ws,po,Ia,Vs,J,be,Ko,dt,xa,Yo,ja,Us,E,ct,Ea,Q,Pa,ho,Ca,Aa,pt,qa,za,Oa,X,Na,mo,Da,La,fo,Ha,Wa,Va,$e,Bs,ee,Te,Zo,ht,Ua,Go,Ba,Rs,W,mt,Ra,ft,Ka,ut,Ya,Za,Ga,z,gt,Ja,te,Qa,uo,Xa,er,Jo,tr,or,sr,ye,nr,Se,Ks,oe,ke,Qo,_t,ar,Xo,rr,Ys,j,wt,ir,vt,lr,bt,dr,cr,pr,Me,hr,$t,mr,Tt,fr,ur,gr,O,yt,_r,se,wr,go,vr,br,es,$r,Tr,yr,Fe,Sr,Ie,Zs,ne,xe,ts,St,kr,os,Mr,Gs,P,kt,Fr,ss,Ir,xr,Mt,jr,Ft,Er,Pr,Cr,N,It,Ar,ae,qr,_o,zr,Or,ns,Nr,Dr,Lr,je,Hr,Ee,Js,re,Pe,as,xt,Wr,rs,Vr,Qs,V,jt,Ur,Et,Br,Pt,Rr,Kr,Yr,D,Ct,Zr,ie,Gr,wo,Jr,Qr,is,Xr,ei,ti,Ce,oi,Ae,Xs,le,qe,ls,At,si,ds,ni,en,U,qt,ai,de,ri,zt,ii,li,Ot,di,ci,pi,L,Nt,hi,ce,mi,vo,fi,ui,cs,gi,_i,wi,ze,vi,Oe,tn,pe,Ne,ps,Dt,bi,hs,$i,on,C,Lt,Ti,ms,yi,Si,Ht,ki,Wt,Mi,Fi,Ii,H,Vt,xi,he,ji,bo,Ei,Pi,fs,Ci,Ai,qi,De,zi,Le,sn;return s=new Y({}),Je=new Y({}),nt=new Y({}),at=new cd({props:{pipeline:"image-classification"}}),dt=new Y({}),ct=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:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-05"},{name:"encoder_stride",val:" = 32"},{name:"out_features",val:" = None"},{name:"out_indices",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.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). If unset and <code>out_indices</code> is set, will default to the
corresponding stages. If unset and <code>out_indices</code> is unset, will default to the last stage.`,name:"out_features"},{anchor:"transformers.SwinConfig.out_indices",description:`<strong>out_indices</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
If used as backbone, list of indices of features to output. Can be any of 0, 1, 2, etc. (depending on how
many stages the model has). If unset and <code>out_features</code> is set, will default to the corresponding stages.
If unset and <code>out_features</code> is unset, will default to the last stage.`,name:"out_indices"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/swin/configuration_swin.py#L38"}}),$e=new Zt({props:{anchor:"transformers.SwinConfig.example",$$slots:{default:[pd]},$$scope:{ctx:M}}}),ht=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/v4.29.0/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/v4.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/swin/modeling_swin.py#L946"}}),gt=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/v4.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__call__">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/v4.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.SwinModel.forward.bool_masked_pos",description:`<strong>bool_masked_pos</strong> (<code>torch.BoolTensor</code> of shape <code>(batch_size, num_patches)</code>, <em>optional</em>) &#x2014;
Boolean masked positions. Indicates which patches are masked (1) and which aren&#x2019;t (0).`,name:"bool_masked_pos"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/swin/modeling_swin.py#L973",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/v4.29.0/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>
`}}),ye=new Yt({props:{$$slots:{default:[hd]},$$scope:{ctx:M}}}),Se=new Zt({props:{anchor:"transformers.SwinModel.forward.example",$$slots:{default:[md]},$$scope:{ctx:M}}}),_t=new Y({}),wt=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/v4.29.0/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/v4.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/swin/modeling_swin.py#L1055"}}),Me=new Yt({props:{$$slots:{default:[fd]},$$scope:{ctx:M}}}),yt=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/v4.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__call__">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/v4.29.0/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/v4.29.0/src/transformers/models/swin/modeling_swin.py#L1072",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/v4.29.0/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>reconstruction</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) \u2014 Reconstructed pixel values.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each stage) of
shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each stage) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
<li>
<p><strong>reshaped_hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each stage) of
shape <code>(batch_size, hidden_size, height, width)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs reshaped to
include the spatial dimensions.</p>
</li>
</ul>
`,returnType:`
<p><code>transformers.models.swin.modeling_swin.SwinMaskedImageModelingOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Fe=new Yt({props:{$$slots:{default:[ud]},$$scope:{ctx:M}}}),Ie=new Zt({props:{anchor:"transformers.SwinForMaskedImageModeling.forward.example",$$slots:{default:[gd]},$$scope:{ctx:M}}}),St=new Y({}),kt=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/v4.29.0/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/v4.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/swin/modeling_swin.py#L1166"}}),It=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/v4.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__call__">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/v4.29.0/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/v4.29.0/src/transformers/models/swin/modeling_swin.py#L1181",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/v4.29.0/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>
`}}),je=new Yt({props:{$$slots:{default:[_d]},$$scope:{ctx:M}}}),Ee=new Zt({props:{anchor:"transformers.SwinForImageClassification.forward.example",$$slots:{default:[wd]},$$scope:{ctx:M}}}),xt=new Y({}),jt=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/v4.29.0/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/v4.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/swin/modeling_tf_swin.py#L1194"}}),Ct=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/v4.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__call__">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/v4.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.TFSwinModel.call.bool_masked_pos",description:`<strong>bool_masked_pos</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, num_patches)</code>, <em>optional</em>) &#x2014;
Boolean masked positions. Indicates which patches are masked (1) and which aren&#x2019;t (0).`,name:"bool_masked_pos"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/swin/modeling_tf_swin.py#L1202",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/v4.29.0/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>
`}}),Ce=new Yt({props:{$$slots:{default:[vd]},$$scope:{ctx:M}}}),Ae=new Zt({props:{anchor:"transformers.TFSwinModel.call.example",$$slots:{default:[bd]},$$scope:{ctx:M}}}),At=new Y({}),qt=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/v4.29.0/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/v4.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/swin/modeling_tf_swin.py#L1307"}}),Nt=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/v4.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__call__">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/v4.29.0/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/v4.29.0/src/transformers/models/swin/modeling_tf_swin.py#L1315",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/v4.29.0/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>reconstruction</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>
`}}),ze=new Yt({props:{$$slots:{default:[$d]},$$scope:{ctx:M}}}),Oe=new Zt({props:{anchor:"transformers.TFSwinForMaskedImageModeling.call.example",$$slots:{default:[Td]},$$scope:{ctx:M}}}),Dt=new Y({}),Lt=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/v4.29.0/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/v4.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/swin/modeling_tf_swin.py#L1428"}}),Vt=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/v4.29.0/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.29.0/en/model_doc/dpt#transformers.DPTFeatureExtractor.__call__">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/v4.29.0/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/v4.29.0/src/transformers/models/swin/modeling_tf_swin.py#L1442",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/v4.29.0/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>
`}}),De=new Yt({props:{$$slots:{default:[yd]},$$scope:{ctx:M}}}),Le=new Zt({props:{anchor:"transformers.TFSwinForImageClassification.call.example",$$slots:{default:[Sd]},$$scope:{ctx:M}}}),{c(){d=n("meta"),v=u(),f=n("h1"),m=n("a"),w=n("span"),b(s.$$.fragment),p=u(),F=n("span"),yn=r("Swin Transformer"),Fs=u(),Z=n("h2"),me=n("a"),Ao=n("span"),b(Je.$$.fragment),Sn=u(),qo=n("span"),kn=r("Overview"),Is=u(),fe=n("p"),Mn=r("The Swin Transformer was proposed in "),Qe=n("a"),Fn=r("Swin Transformer: Hierarchical Vision Transformer using Shifted Windows"),In=r(`
by Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, Baining Guo.`),xs=u(),Qt=n("p"),xn=r("The abstract from the paper is the following:"),js=u(),Xt=n("p"),zo=n("em"),jn=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.`),Es=u(),eo=n("p"),En=r("Tips:"),Ps=u(),B=n("ul"),Xe=n("li"),Pn=r("One can use the "),to=n("a"),Cn=r("AutoImageProcessor"),An=r(" API to prepare images for the model."),qn=u(),et=n("li"),zn=r("Swin pads the inputs supporting any input height and width (if divisible by "),Oo=n("code"),On=r("32"),Nn=r(")."),Dn=u(),I=n("li"),Ln=r("Swin can be used as a "),No=n("em"),Hn=r("backbone"),Wn=r(". When "),Do=n("code"),Vn=r("output_hidden_states = True"),Un=r(", it will output both "),Lo=n("code"),Bn=r("hidden_states"),Rn=r(" and "),Ho=n("code"),Kn=r("reshaped_hidden_states"),Yn=r(". The "),Wo=n("code"),Zn=r("reshaped_hidden_states"),Gn=r(" have a shape of "),Vo=n("code"),Jn=r("(batch, num_channels, height, width)"),Qn=r(" rather than "),Uo=n("code"),Xn=r("(batch_size, sequence_length, num_channels)"),ea=r("."),Cs=u(),ue=n("img"),As=u(),ge=n("small"),ta=r("Swin Transformer architecture. Taken from the "),oo=n("a"),oa=r("original paper"),sa=r("."),qs=u(),q=n("p"),na=r("This model was contributed by "),tt=n("a"),aa=r("novice03"),ra=r(". The Tensorflow version of this model was contributed by "),ot=n("a"),ia=r("amyeroberts"),la=r(". The original code can be found "),st=n("a"),da=r("here"),ca=r("."),zs=u(),G=n("h2"),_e=n("a"),Bo=n("span"),b(nt.$$.fragment),pa=u(),Ro=n("span"),ha=r("Resources"),Os=u(),so=n("p"),ma=r("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with Swin Transformer."),Ns=u(),b(at.$$.fragment),Ds=u(),we=n("ul"),R=n("li"),no=n("a"),fa=r("SwinForImageClassification"),ua=r(" is supported by this "),rt=n("a"),ga=r("example script"),_a=r(" and "),it=n("a"),wa=r("notebook"),va=r("."),ba=u(),ao=n("li"),$a=r("See also: "),ro=n("a"),Ta=r("Image classification task guide"),Ls=u(),io=n("p"),ya=r("Besides that:"),Hs=u(),lo=n("ul"),ve=n("li"),co=n("a"),Sa=r("SwinForMaskedImageModeling"),ka=r(" is supported by this "),lt=n("a"),Ma=r("example script"),Fa=r("."),Ws=u(),po=n("p"),Ia=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."),Vs=u(),J=n("h2"),be=n("a"),Ko=n("span"),b(dt.$$.fragment),xa=u(),Yo=n("span"),ja=r("SwinConfig"),Us=u(),E=n("div"),b(ct.$$.fragment),Ea=u(),Q=n("p"),Pa=r("This is the configuration class to store the configuration of a "),ho=n("a"),Ca=r("SwinModel"),Aa=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
`),pt=n("a"),qa=r("microsoft/swin-tiny-patch4-window7-224"),za=r(`
architecture.`),Oa=u(),X=n("p"),Na=r("Configuration objects inherit from "),mo=n("a"),Da=r("PretrainedConfig"),La=r(` and can be used to control the model outputs. Read the
documentation from `),fo=n("a"),Ha=r("PretrainedConfig"),Wa=r(" for more information."),Va=u(),b($e.$$.fragment),Bs=u(),ee=n("h2"),Te=n("a"),Zo=n("span"),b(ht.$$.fragment),Ua=u(),Go=n("span"),Ba=r("SwinModel"),Rs=u(),W=n("div"),b(mt.$$.fragment),Ra=u(),ft=n("p"),Ka=r(`The bare Swin Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),ut=n("a"),Ya=r("torch.nn.Module"),Za=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.`),Ga=u(),z=n("div"),b(gt.$$.fragment),Ja=u(),te=n("p"),Qa=r("The "),uo=n("a"),Xa=r("SwinModel"),er=r(" forward method, overrides the "),Jo=n("code"),tr=r("__call__"),or=r(" special method."),sr=u(),b(ye.$$.fragment),nr=u(),b(Se.$$.fragment),Ks=u(),oe=n("h2"),ke=n("a"),Qo=n("span"),b(_t.$$.fragment),ar=u(),Xo=n("span"),rr=r("SwinForMaskedImageModeling"),Ys=u(),j=n("div"),b(wt.$$.fragment),ir=u(),vt=n("p"),lr=r("Swin Model with a decoder on top for masked image modeling, as proposed in "),bt=n("a"),dr=r("SimMIM"),cr=r("."),pr=u(),b(Me.$$.fragment),hr=u(),$t=n("p"),mr=r("This model is a PyTorch "),Tt=n("a"),fr=r("torch.nn.Module"),ur=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.`),gr=u(),O=n("div"),b(yt.$$.fragment),_r=u(),se=n("p"),wr=r("The "),go=n("a"),vr=r("SwinForMaskedImageModeling"),br=r(" forward method, overrides the "),es=n("code"),$r=r("__call__"),Tr=r(" special method."),yr=u(),b(Fe.$$.fragment),Sr=u(),b(Ie.$$.fragment),Zs=u(),ne=n("h2"),xe=n("a"),ts=n("span"),b(St.$$.fragment),kr=u(),os=n("span"),Mr=r("SwinForImageClassification"),Gs=u(),P=n("div"),b(kt.$$.fragment),Fr=u(),ss=n("p"),Ir=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.`),xr=u(),Mt=n("p"),jr=r("This model is a PyTorch "),Ft=n("a"),Er=r("torch.nn.Module"),Pr=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(),N=n("div"),b(It.$$.fragment),Ar=u(),ae=n("p"),qr=r("The "),_o=n("a"),zr=r("SwinForImageClassification"),Or=r(" forward method, overrides the "),ns=n("code"),Nr=r("__call__"),Dr=r(" special method."),Lr=u(),b(je.$$.fragment),Hr=u(),b(Ee.$$.fragment),Js=u(),re=n("h2"),Pe=n("a"),as=n("span"),b(xt.$$.fragment),Wr=u(),rs=n("span"),Vr=r("TFSwinModel"),Qs=u(),V=n("div"),b(jt.$$.fragment),Ur=u(),Et=n("p"),Br=r(`The bare Swin Model transformer outputting raw hidden-states without any specific head on top.
This model is a Tensorflow
`),Pt=n("a"),Rr=r("tf.keras.layers.Layer"),Kr=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.`),Yr=u(),D=n("div"),b(Ct.$$.fragment),Zr=u(),ie=n("p"),Gr=r("The "),wo=n("a"),Jr=r("TFSwinModel"),Qr=r(" forward method, overrides the "),is=n("code"),Xr=r("__call__"),ei=r(" special method."),ti=u(),b(Ce.$$.fragment),oi=u(),b(Ae.$$.fragment),Xs=u(),le=n("h2"),qe=n("a"),ls=n("span"),b(At.$$.fragment),si=u(),ds=n("span"),ni=r("TFSwinForMaskedImageModeling"),en=u(),U=n("div"),b(qt.$$.fragment),ai=u(),de=n("p"),ri=r("Swin Model with a decoder on top for masked image modeling, as proposed in "),zt=n("a"),ii=r("SimMIM"),li=r(`.
This model is a Tensorflow
`),Ot=n("a"),di=r("tf.keras.layers.Layer"),ci=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.`),pi=u(),L=n("div"),b(Nt.$$.fragment),hi=u(),ce=n("p"),mi=r("The "),vo=n("a"),fi=r("TFSwinForMaskedImageModeling"),ui=r(" forward method, overrides the "),cs=n("code"),gi=r("__call__"),_i=r(" special method."),wi=u(),b(ze.$$.fragment),vi=u(),b(Oe.$$.fragment),tn=u(),pe=n("h2"),Ne=n("a"),ps=n("span"),b(Dt.$$.fragment),bi=u(),hs=n("span"),$i=r("TFSwinForImageClassification"),on=u(),C=n("div"),b(Lt.$$.fragment),Ti=u(),ms=n("p"),yi=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.`),Si=u(),Ht=n("p"),ki=r(`This model is a Tensorflow
`),Wt=n("a"),Mi=r("tf.keras.layers.Layer"),Fi=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.`),Ii=u(),H=n("div"),b(Vt.$$.fragment),xi=u(),he=n("p"),ji=r("The "),bo=n("a"),Ei=r("TFSwinForImageClassification"),Pi=r(" forward method, overrides the "),fs=n("code"),Ci=r("__call__"),Ai=r(" special method."),qi=u(),b(De.$$.fragment),zi=u(),b(Le.$$.fragment),this.h()},l(t){const h=id('[data-svelte="svelte-1phssyn"]',document.head);d=a(h,"META",{name:!0,content:!0}),h.forEach(o),v=g(t),f=a(t,"H1",{class:!0});var Ut=l(f);m=a(Ut,"A",{id:!0,class:!0,href:!0});var us=l(m);w=a(us,"SPAN",{});var gs=l(w);$(s.$$.fragment,gs),gs.forEach(o),us.forEach(o),p=g(Ut),F=a(Ut,"SPAN",{});var _s=l(F);yn=i(_s,"Swin Transformer"),_s.forEach(o),Ut.forEach(o),Fs=g(t),Z=a(t,"H2",{class:!0});var Bt=l(Z);me=a(Bt,"A",{id:!0,class:!0,href:!0});var ws=l(me);Ao=a(ws,"SPAN",{});var vs=l(Ao);$(Je.$$.fragment,vs),vs.forEach(o),ws.forEach(o),Sn=g(Bt),qo=a(Bt,"SPAN",{});var bs=l(qo);kn=i(bs,"Overview"),bs.forEach(o),Bt.forEach(o),Is=g(t),fe=a(t,"P",{});var Rt=l(fe);Mn=i(Rt,"The Swin Transformer was proposed in "),Qe=a(Rt,"A",{href:!0,rel:!0});var $s=l(Qe);Fn=i($s,"Swin Transformer: Hierarchical Vision Transformer using Shifted Windows"),$s.forEach(o),In=i(Rt,`
by Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, Baining Guo.`),Rt.forEach(o),xs=g(t),Qt=a(t,"P",{});var Ts=l(Qt);xn=i(Ts,"The abstract from the paper is the following:"),Ts.forEach(o),js=g(t),Xt=a(t,"P",{});var ys=l(Xt);zo=a(ys,"EM",{});var Ss=l(zo);jn=i(Ss,`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.`),Ss.forEach(o),ys.forEach(o),Es=g(t),eo=a(t,"P",{});var ks=l(eo);En=i(ks,"Tips:"),ks.forEach(o),Ps=g(t),B=a(t,"UL",{});var $o=l(B);Xe=a($o,"LI",{});var nn=l(Xe);Pn=i(nn,"One can use the "),to=a(nn,"A",{href:!0});var Di=l(to);Cn=i(Di,"AutoImageProcessor"),Di.forEach(o),An=i(nn," API to prepare images for the model."),nn.forEach(o),qn=g($o),et=a($o,"LI",{});var an=l(et);zn=i(an,"Swin pads the inputs supporting any input height and width (if divisible by "),Oo=a(an,"CODE",{});var Li=l(Oo);On=i(Li,"32"),Li.forEach(o),Nn=i(an,")."),an.forEach(o),Dn=g($o),I=a($o,"LI",{});var x=l(I);Ln=i(x,"Swin can be used as a "),No=a(x,"EM",{});var Hi=l(No);Hn=i(Hi,"backbone"),Hi.forEach(o),Wn=i(x,". When "),Do=a(x,"CODE",{});var Wi=l(Do);Vn=i(Wi,"output_hidden_states = True"),Wi.forEach(o),Un=i(x,", it will output both "),Lo=a(x,"CODE",{});var Vi=l(Lo);Bn=i(Vi,"hidden_states"),Vi.forEach(o),Rn=i(x," and "),Ho=a(x,"CODE",{});var Ui=l(Ho);Kn=i(Ui,"reshaped_hidden_states"),Ui.forEach(o),Yn=i(x,". The "),Wo=a(x,"CODE",{});var Bi=l(Wo);Zn=i(Bi,"reshaped_hidden_states"),Bi.forEach(o),Gn=i(x," have a shape of "),Vo=a(x,"CODE",{});var Ri=l(Vo);Jn=i(Ri,"(batch, num_channels, height, width)"),Ri.forEach(o),Qn=i(x," rather than "),Uo=a(x,"CODE",{});var Ki=l(Uo);Xn=i(Ki,"(batch_size, sequence_length, num_channels)"),Ki.forEach(o),ea=i(x,"."),x.forEach(o),$o.forEach(o),Cs=g(t),ue=a(t,"IMG",{src:!0,alt:!0,width:!0}),As=g(t),ge=a(t,"SMALL",{});var rn=l(ge);ta=i(rn,"Swin Transformer architecture. Taken from the "),oo=a(rn,"A",{href:!0});var Yi=l(oo);oa=i(Yi,"original paper"),Yi.forEach(o),sa=i(rn,"."),rn.forEach(o),qs=g(t),q=a(t,"P",{});var He=l(q);na=i(He,"This model was contributed by "),tt=a(He,"A",{href:!0,rel:!0});var Zi=l(tt);aa=i(Zi,"novice03"),Zi.forEach(o),ra=i(He,". The Tensorflow version of this model was contributed by "),ot=a(He,"A",{href:!0,rel:!0});var Gi=l(ot);ia=i(Gi,"amyeroberts"),Gi.forEach(o),la=i(He,". The original code can be found "),st=a(He,"A",{href:!0,rel:!0});var Ji=l(st);da=i(Ji,"here"),Ji.forEach(o),ca=i(He,"."),He.forEach(o),zs=g(t),G=a(t,"H2",{class:!0});var ln=l(G);_e=a(ln,"A",{id:!0,class:!0,href:!0});var Qi=l(_e);Bo=a(Qi,"SPAN",{});var Xi=l(Bo);$(nt.$$.fragment,Xi),Xi.forEach(o),Qi.forEach(o),pa=g(ln),Ro=a(ln,"SPAN",{});var el=l(Ro);ha=i(el,"Resources"),el.forEach(o),ln.forEach(o),Os=g(t),so=a(t,"P",{});var tl=l(so);ma=i(tl,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with Swin Transformer."),tl.forEach(o),Ns=g(t),$(at.$$.fragment,t),Ds=g(t),we=a(t,"UL",{});var dn=l(we);R=a(dn,"LI",{});var Kt=l(R);no=a(Kt,"A",{href:!0});var ol=l(no);fa=i(ol,"SwinForImageClassification"),ol.forEach(o),ua=i(Kt," is supported by this "),rt=a(Kt,"A",{href:!0,rel:!0});var sl=l(rt);ga=i(sl,"example script"),sl.forEach(o),_a=i(Kt," and "),it=a(Kt,"A",{href:!0,rel:!0});var nl=l(it);wa=i(nl,"notebook"),nl.forEach(o),va=i(Kt,"."),Kt.forEach(o),ba=g(dn),ao=a(dn,"LI",{});var Oi=l(ao);$a=i(Oi,"See also: "),ro=a(Oi,"A",{href:!0});var al=l(ro);Ta=i(al,"Image classification task guide"),al.forEach(o),Oi.forEach(o),dn.forEach(o),Ls=g(t),io=a(t,"P",{});var rl=l(io);ya=i(rl,"Besides that:"),rl.forEach(o),Hs=g(t),lo=a(t,"UL",{});var il=l(lo);ve=a(il,"LI",{});var Ms=l(ve);co=a(Ms,"A",{href:!0});var ll=l(co);Sa=i(ll,"SwinForMaskedImageModeling"),ll.forEach(o),ka=i(Ms," is supported by this "),lt=a(Ms,"A",{href:!0,rel:!0});var dl=l(lt);Ma=i(dl,"example script"),dl.forEach(o),Fa=i(Ms,"."),Ms.forEach(o),il.forEach(o),Ws=g(t),po=a(t,"P",{});var cl=l(po);Ia=i(cl,"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."),cl.forEach(o),Vs=g(t),J=a(t,"H2",{class:!0});var cn=l(J);be=a(cn,"A",{id:!0,class:!0,href:!0});var pl=l(be);Ko=a(pl,"SPAN",{});var hl=l(Ko);$(dt.$$.fragment,hl),hl.forEach(o),pl.forEach(o),xa=g(cn),Yo=a(cn,"SPAN",{});var ml=l(Yo);ja=i(ml,"SwinConfig"),ml.forEach(o),cn.forEach(o),Us=g(t),E=a(t,"DIV",{class:!0});var We=l(E);$(ct.$$.fragment,We),Ea=g(We),Q=a(We,"P",{});var To=l(Q);Pa=i(To,"This is the configuration class to store the configuration of a "),ho=a(To,"A",{href:!0});var fl=l(ho);Ca=i(fl,"SwinModel"),fl.forEach(o),Aa=i(To,`. 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
`),pt=a(To,"A",{href:!0,rel:!0});var ul=l(pt);qa=i(ul,"microsoft/swin-tiny-patch4-window7-224"),ul.forEach(o),za=i(To,`
architecture.`),To.forEach(o),Oa=g(We),X=a(We,"P",{});var yo=l(X);Na=i(yo,"Configuration objects inherit from "),mo=a(yo,"A",{href:!0});var gl=l(mo);Da=i(gl,"PretrainedConfig"),gl.forEach(o),La=i(yo,` and can be used to control the model outputs. Read the
documentation from `),fo=a(yo,"A",{href:!0});var _l=l(fo);Ha=i(_l,"PretrainedConfig"),_l.forEach(o),Wa=i(yo," for more information."),yo.forEach(o),Va=g(We),$($e.$$.fragment,We),We.forEach(o),Bs=g(t),ee=a(t,"H2",{class:!0});var pn=l(ee);Te=a(pn,"A",{id:!0,class:!0,href:!0});var wl=l(Te);Zo=a(wl,"SPAN",{});var vl=l(Zo);$(ht.$$.fragment,vl),vl.forEach(o),wl.forEach(o),Ua=g(pn),Go=a(pn,"SPAN",{});var bl=l(Go);Ba=i(bl,"SwinModel"),bl.forEach(o),pn.forEach(o),Rs=g(t),W=a(t,"DIV",{class:!0});var So=l(W);$(mt.$$.fragment,So),Ra=g(So),ft=a(So,"P",{});var hn=l(ft);Ka=i(hn,`The bare Swin Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),ut=a(hn,"A",{href:!0,rel:!0});var $l=l(ut);Ya=i($l,"torch.nn.Module"),$l.forEach(o),Za=i(hn,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),hn.forEach(o),Ga=g(So),z=a(So,"DIV",{class:!0});var Ve=l(z);$(gt.$$.fragment,Ve),Ja=g(Ve),te=a(Ve,"P",{});var ko=l(te);Qa=i(ko,"The "),uo=a(ko,"A",{href:!0});var Tl=l(uo);Xa=i(Tl,"SwinModel"),Tl.forEach(o),er=i(ko," forward method, overrides the "),Jo=a(ko,"CODE",{});var yl=l(Jo);tr=i(yl,"__call__"),yl.forEach(o),or=i(ko," special method."),ko.forEach(o),sr=g(Ve),$(ye.$$.fragment,Ve),nr=g(Ve),$(Se.$$.fragment,Ve),Ve.forEach(o),So.forEach(o),Ks=g(t),oe=a(t,"H2",{class:!0});var mn=l(oe);ke=a(mn,"A",{id:!0,class:!0,href:!0});var Sl=l(ke);Qo=a(Sl,"SPAN",{});var kl=l(Qo);$(_t.$$.fragment,kl),kl.forEach(o),Sl.forEach(o),ar=g(mn),Xo=a(mn,"SPAN",{});var Ml=l(Xo);rr=i(Ml,"SwinForMaskedImageModeling"),Ml.forEach(o),mn.forEach(o),Ys=g(t),j=a(t,"DIV",{class:!0});var K=l(j);$(wt.$$.fragment,K),ir=g(K),vt=a(K,"P",{});var fn=l(vt);lr=i(fn,"Swin Model with a decoder on top for masked image modeling, as proposed in "),bt=a(fn,"A",{href:!0,rel:!0});var Fl=l(bt);dr=i(Fl,"SimMIM"),Fl.forEach(o),cr=i(fn,"."),fn.forEach(o),pr=g(K),$(Me.$$.fragment,K),hr=g(K),$t=a(K,"P",{});var un=l($t);mr=i(un,"This model is a PyTorch "),Tt=a(un,"A",{href:!0,rel:!0});var Il=l(Tt);fr=i(Il,"torch.nn.Module"),Il.forEach(o),ur=i(un,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),un.forEach(o),gr=g(K),O=a(K,"DIV",{class:!0});var Ue=l(O);$(yt.$$.fragment,Ue),_r=g(Ue),se=a(Ue,"P",{});var Mo=l(se);wr=i(Mo,"The "),go=a(Mo,"A",{href:!0});var xl=l(go);vr=i(xl,"SwinForMaskedImageModeling"),xl.forEach(o),br=i(Mo," forward method, overrides the "),es=a(Mo,"CODE",{});var jl=l(es);$r=i(jl,"__call__"),jl.forEach(o),Tr=i(Mo," special method."),Mo.forEach(o),yr=g(Ue),$(Fe.$$.fragment,Ue),Sr=g(Ue),$(Ie.$$.fragment,Ue),Ue.forEach(o),K.forEach(o),Zs=g(t),ne=a(t,"H2",{class:!0});var gn=l(ne);xe=a(gn,"A",{id:!0,class:!0,href:!0});var El=l(xe);ts=a(El,"SPAN",{});var Pl=l(ts);$(St.$$.fragment,Pl),Pl.forEach(o),El.forEach(o),kr=g(gn),os=a(gn,"SPAN",{});var Cl=l(os);Mr=i(Cl,"SwinForImageClassification"),Cl.forEach(o),gn.forEach(o),Gs=g(t),P=a(t,"DIV",{class:!0});var Be=l(P);$(kt.$$.fragment,Be),Fr=g(Be),ss=a(Be,"P",{});var Al=l(ss);Ir=i(Al,`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.`),Al.forEach(o),xr=g(Be),Mt=a(Be,"P",{});var _n=l(Mt);jr=i(_n,"This model is a PyTorch "),Ft=a(_n,"A",{href:!0,rel:!0});var ql=l(Ft);Er=i(ql,"torch.nn.Module"),ql.forEach(o),Pr=i(_n,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),_n.forEach(o),Cr=g(Be),N=a(Be,"DIV",{class:!0});var Re=l(N);$(It.$$.fragment,Re),Ar=g(Re),ae=a(Re,"P",{});var Fo=l(ae);qr=i(Fo,"The "),_o=a(Fo,"A",{href:!0});var zl=l(_o);zr=i(zl,"SwinForImageClassification"),zl.forEach(o),Or=i(Fo," forward method, overrides the "),ns=a(Fo,"CODE",{});var Ol=l(ns);Nr=i(Ol,"__call__"),Ol.forEach(o),Dr=i(Fo," special method."),Fo.forEach(o),Lr=g(Re),$(je.$$.fragment,Re),Hr=g(Re),$(Ee.$$.fragment,Re),Re.forEach(o),Be.forEach(o),Js=g(t),re=a(t,"H2",{class:!0});var wn=l(re);Pe=a(wn,"A",{id:!0,class:!0,href:!0});var Nl=l(Pe);as=a(Nl,"SPAN",{});var Dl=l(as);$(xt.$$.fragment,Dl),Dl.forEach(o),Nl.forEach(o),Wr=g(wn),rs=a(wn,"SPAN",{});var Ll=l(rs);Vr=i(Ll,"TFSwinModel"),Ll.forEach(o),wn.forEach(o),Qs=g(t),V=a(t,"DIV",{class:!0});var Io=l(V);$(jt.$$.fragment,Io),Ur=g(Io),Et=a(Io,"P",{});var vn=l(Et);Br=i(vn,`The bare Swin Model transformer outputting raw hidden-states without any specific head on top.
This model is a Tensorflow
`),Pt=a(vn,"A",{href:!0,rel:!0});var Hl=l(Pt);Rr=i(Hl,"tf.keras.layers.Layer"),Hl.forEach(o),Kr=i(vn,` sub-class. Use it as a
regular Tensorflow Module and refer to the Tensorflow documentation for all matter related to general usage and
behavior.`),vn.forEach(o),Yr=g(Io),D=a(Io,"DIV",{class:!0});var Ke=l(D);$(Ct.$$.fragment,Ke),Zr=g(Ke),ie=a(Ke,"P",{});var xo=l(ie);Gr=i(xo,"The "),wo=a(xo,"A",{href:!0});var Wl=l(wo);Jr=i(Wl,"TFSwinModel"),Wl.forEach(o),Qr=i(xo," forward method, overrides the "),is=a(xo,"CODE",{});var Vl=l(is);Xr=i(Vl,"__call__"),Vl.forEach(o),ei=i(xo," special method."),xo.forEach(o),ti=g(Ke),$(Ce.$$.fragment,Ke),oi=g(Ke),$(Ae.$$.fragment,Ke),Ke.forEach(o),Io.forEach(o),Xs=g(t),le=a(t,"H2",{class:!0});var bn=l(le);qe=a(bn,"A",{id:!0,class:!0,href:!0});var Ul=l(qe);ls=a(Ul,"SPAN",{});var Bl=l(ls);$(At.$$.fragment,Bl),Bl.forEach(o),Ul.forEach(o),si=g(bn),ds=a(bn,"SPAN",{});var Rl=l(ds);ni=i(Rl,"TFSwinForMaskedImageModeling"),Rl.forEach(o),bn.forEach(o),en=g(t),U=a(t,"DIV",{class:!0});var jo=l(U);$(qt.$$.fragment,jo),ai=g(jo),de=a(jo,"P",{});var Eo=l(de);ri=i(Eo,"Swin Model with a decoder on top for masked image modeling, as proposed in "),zt=a(Eo,"A",{href:!0,rel:!0});var Kl=l(zt);ii=i(Kl,"SimMIM"),Kl.forEach(o),li=i(Eo,`.
This model is a Tensorflow
`),Ot=a(Eo,"A",{href:!0,rel:!0});var Yl=l(Ot);di=i(Yl,"tf.keras.layers.Layer"),Yl.forEach(o),ci=i(Eo,` sub-class. Use it as a
regular Tensorflow Module and refer to the Tensorflow documentation for all matter related to general usage and
behavior.`),Eo.forEach(o),pi=g(jo),L=a(jo,"DIV",{class:!0});var Ye=l(L);$(Nt.$$.fragment,Ye),hi=g(Ye),ce=a(Ye,"P",{});var Po=l(ce);mi=i(Po,"The "),vo=a(Po,"A",{href:!0});var Zl=l(vo);fi=i(Zl,"TFSwinForMaskedImageModeling"),Zl.forEach(o),ui=i(Po," forward method, overrides the "),cs=a(Po,"CODE",{});var Gl=l(cs);gi=i(Gl,"__call__"),Gl.forEach(o),_i=i(Po," special method."),Po.forEach(o),wi=g(Ye),$(ze.$$.fragment,Ye),vi=g(Ye),$(Oe.$$.fragment,Ye),Ye.forEach(o),jo.forEach(o),tn=g(t),pe=a(t,"H2",{class:!0});var $n=l(pe);Ne=a($n,"A",{id:!0,class:!0,href:!0});var Jl=l(Ne);ps=a(Jl,"SPAN",{});var Ql=l(ps);$(Dt.$$.fragment,Ql),Ql.forEach(o),Jl.forEach(o),bi=g($n),hs=a($n,"SPAN",{});var Xl=l(hs);$i=i(Xl,"TFSwinForImageClassification"),Xl.forEach(o),$n.forEach(o),on=g(t),C=a(t,"DIV",{class:!0});var Ze=l(C);$(Lt.$$.fragment,Ze),Ti=g(Ze),ms=a(Ze,"P",{});var ed=l(ms);yi=i(ed,`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.`),ed.forEach(o),Si=g(Ze),Ht=a(Ze,"P",{});var Tn=l(Ht);ki=i(Tn,`This model is a Tensorflow
`),Wt=a(Tn,"A",{href:!0,rel:!0});var td=l(Wt);Mi=i(td,"tf.keras.layers.Layer"),td.forEach(o),Fi=i(Tn,` sub-class. Use it as a
regular Tensorflow Module and refer to the Tensorflow documentation for all matter related to general usage and
behavior.`),Tn.forEach(o),Ii=g(Ze),H=a(Ze,"DIV",{class:!0});var Ge=l(H);$(Vt.$$.fragment,Ge),xi=g(Ge),he=a(Ge,"P",{});var Co=l(he);ji=i(Co,"The "),bo=a(Co,"A",{href:!0});var od=l(bo);Ei=i(od,"TFSwinForImageClassification"),od.forEach(o),Pi=i(Co," forward method, overrides the "),fs=a(Co,"CODE",{});var sd=l(fs);Ci=i(sd,"__call__"),sd.forEach(o),Ai=i(Co," special method."),Co.forEach(o),qi=g(Ge),$(De.$$.fragment,Ge),zi=g(Ge),$(Le.$$.fragment,Ge),Ge.forEach(o),Ze.forEach(o),this.h()},h(){c(d,"name","hf:doc:metadata"),c(d,"content",JSON.stringify(Md)),c(m,"id","swin-transformer"),c(m,"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(m,"href","#swin-transformer"),c(f,"class","relative group"),c(me,"id","overview"),c(me,"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(me,"href","#overview"),c(Z,"class","relative group"),c(Qe,"href","https://arxiv.org/abs/2103.14030"),c(Qe,"rel","nofollow"),c(to,"href","/docs/transformers/v4.29.0/en/model_doc/auto#transformers.AutoImageProcessor"),ld(ue.src,Ni="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/swin_transformer_architecture.png")||c(ue,"src",Ni),c(ue,"alt","drawing"),c(ue,"width","600"),c(oo,"href","https://arxiv.org/abs/2102.03334"),c(tt,"href","https://huggingface.co/novice03"),c(tt,"rel","nofollow"),c(ot,"href","https://huggingface.co/amyeroberts"),c(ot,"rel","nofollow"),c(st,"href","https://github.com/microsoft/Swin-Transformer"),c(st,"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/v4.29.0/en/model_doc/swin#transformers.SwinForImageClassification"),c(rt,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification"),c(rt,"rel","nofollow"),c(it,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb"),c(it,"rel","nofollow"),c(ro,"href","../tasks/image_classification"),c(co,"href","/docs/transformers/v4.29.0/en/model_doc/swin#transformers.SwinForMaskedImageModeling"),c(lt,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-pretraining"),c(lt,"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(ho,"href","/docs/transformers/v4.29.0/en/model_doc/swin#transformers.SwinModel"),c(pt,"href","https://huggingface.co/microsoft/swin-tiny-patch4-window7-224"),c(pt,"rel","nofollow"),c(mo,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),c(fo,"href","/docs/transformers/v4.29.0/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(Te,"id","transformers.SwinModel"),c(Te,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(Te,"href","#transformers.SwinModel"),c(ee,"class","relative group"),c(ut,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(ut,"rel","nofollow"),c(uo,"href","/docs/transformers/v4.29.0/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(ke,"id","transformers.SwinForMaskedImageModeling"),c(ke,"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(ke,"href","#transformers.SwinForMaskedImageModeling"),c(oe,"class","relative group"),c(bt,"href","https://arxiv.org/abs/2111.09886"),c(bt,"rel","nofollow"),c(Tt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(Tt,"rel","nofollow"),c(go,"href","/docs/transformers/v4.29.0/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(xe,"id","transformers.SwinForImageClassification"),c(xe,"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(xe,"href","#transformers.SwinForImageClassification"),c(ne,"class","relative group"),c(Ft,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(Ft,"rel","nofollow"),c(_o,"href","/docs/transformers/v4.29.0/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(Pe,"id","transformers.TFSwinModel"),c(Pe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(Pe,"href","#transformers.TFSwinModel"),c(re,"class","relative group"),c(Pt,"href","https://www.tensorflow.org/api_docs/python/tf/keras/layers/Layer"),c(Pt,"rel","nofollow"),c(wo,"href","/docs/transformers/v4.29.0/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(qe,"id","transformers.TFSwinForMaskedImageModeling"),c(qe,"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(qe,"href","#transformers.TFSwinForMaskedImageModeling"),c(le,"class","relative group"),c(zt,"href","https://arxiv.org/abs/2111.09886"),c(zt,"rel","nofollow"),c(Ot,"href","https://www.tensorflow.org/api_docs/python/tf/keras/layers/Layer"),c(Ot,"rel","nofollow"),c(vo,"href","/docs/transformers/v4.29.0/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(Ne,"id","transformers.TFSwinForImageClassification"),c(Ne,"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(Ne,"href","#transformers.TFSwinForImageClassification"),c(pe,"class","relative group"),c(Wt,"href","https://www.tensorflow.org/api_docs/python/tf/keras/layers/Layer"),c(Wt,"rel","nofollow"),c(bo,"href","/docs/transformers/v4.29.0/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,h){e(document.head,d),_(t,v,h),_(t,f,h),e(f,m),e(m,w),T(s,w,null),e(f,p),e(f,F),e(F,yn),_(t,Fs,h),_(t,Z,h),e(Z,me),e(me,Ao),T(Je,Ao,null),e(Z,Sn),e(Z,qo),e(qo,kn),_(t,Is,h),_(t,fe,h),e(fe,Mn),e(fe,Qe),e(Qe,Fn),e(fe,In),_(t,xs,h),_(t,Qt,h),e(Qt,xn),_(t,js,h),_(t,Xt,h),e(Xt,zo),e(zo,jn),_(t,Es,h),_(t,eo,h),e(eo,En),_(t,Ps,h),_(t,B,h),e(B,Xe),e(Xe,Pn),e(Xe,to),e(to,Cn),e(Xe,An),e(B,qn),e(B,et),e(et,zn),e(et,Oo),e(Oo,On),e(et,Nn),e(B,Dn),e(B,I),e(I,Ln),e(I,No),e(No,Hn),e(I,Wn),e(I,Do),e(Do,Vn),e(I,Un),e(I,Lo),e(Lo,Bn),e(I,Rn),e(I,Ho),e(Ho,Kn),e(I,Yn),e(I,Wo),e(Wo,Zn),e(I,Gn),e(I,Vo),e(Vo,Jn),e(I,Qn),e(I,Uo),e(Uo,Xn),e(I,ea),_(t,Cs,h),_(t,ue,h),_(t,As,h),_(t,ge,h),e(ge,ta),e(ge,oo),e(oo,oa),e(ge,sa),_(t,qs,h),_(t,q,h),e(q,na),e(q,tt),e(tt,aa),e(q,ra),e(q,ot),e(ot,ia),e(q,la),e(q,st),e(st,da),e(q,ca),_(t,zs,h),_(t,G,h),e(G,_e),e(_e,Bo),T(nt,Bo,null),e(G,pa),e(G,Ro),e(Ro,ha),_(t,Os,h),_(t,so,h),e(so,ma),_(t,Ns,h),T(at,t,h),_(t,Ds,h),_(t,we,h),e(we,R),e(R,no),e(no,fa),e(R,ua),e(R,rt),e(rt,ga),e(R,_a),e(R,it),e(it,wa),e(R,va),e(we,ba),e(we,ao),e(ao,$a),e(ao,ro),e(ro,Ta),_(t,Ls,h),_(t,io,h),e(io,ya),_(t,Hs,h),_(t,lo,h),e(lo,ve),e(ve,co),e(co,Sa),e(ve,ka),e(ve,lt),e(lt,Ma),e(ve,Fa),_(t,Ws,h),_(t,po,h),e(po,Ia),_(t,Vs,h),_(t,J,h),e(J,be),e(be,Ko),T(dt,Ko,null),e(J,xa),e(J,Yo),e(Yo,ja),_(t,Us,h),_(t,E,h),T(ct,E,null),e(E,Ea),e(E,Q),e(Q,Pa),e(Q,ho),e(ho,Ca),e(Q,Aa),e(Q,pt),e(pt,qa),e(Q,za),e(E,Oa),e(E,X),e(X,Na),e(X,mo),e(mo,Da),e(X,La),e(X,fo),e(fo,Ha),e(X,Wa),e(E,Va),T($e,E,null),_(t,Bs,h),_(t,ee,h),e(ee,Te),e(Te,Zo),T(ht,Zo,null),e(ee,Ua),e(ee,Go),e(Go,Ba),_(t,Rs,h),_(t,W,h),T(mt,W,null),e(W,Ra),e(W,ft),e(ft,Ka),e(ft,ut),e(ut,Ya),e(ft,Za),e(W,Ga),e(W,z),T(gt,z,null),e(z,Ja),e(z,te),e(te,Qa),e(te,uo),e(uo,Xa),e(te,er),e(te,Jo),e(Jo,tr),e(te,or),e(z,sr),T(ye,z,null),e(z,nr),T(Se,z,null),_(t,Ks,h),_(t,oe,h),e(oe,ke),e(ke,Qo),T(_t,Qo,null),e(oe,ar),e(oe,Xo),e(Xo,rr),_(t,Ys,h),_(t,j,h),T(wt,j,null),e(j,ir),e(j,vt),e(vt,lr),e(vt,bt),e(bt,dr),e(vt,cr),e(j,pr),T(Me,j,null),e(j,hr),e(j,$t),e($t,mr),e($t,Tt),e(Tt,fr),e($t,ur),e(j,gr),e(j,O),T(yt,O,null),e(O,_r),e(O,se),e(se,wr),e(se,go),e(go,vr),e(se,br),e(se,es),e(es,$r),e(se,Tr),e(O,yr),T(Fe,O,null),e(O,Sr),T(Ie,O,null),_(t,Zs,h),_(t,ne,h),e(ne,xe),e(xe,ts),T(St,ts,null),e(ne,kr),e(ne,os),e(os,Mr),_(t,Gs,h),_(t,P,h),T(kt,P,null),e(P,Fr),e(P,ss),e(ss,Ir),e(P,xr),e(P,Mt),e(Mt,jr),e(Mt,Ft),e(Ft,Er),e(Mt,Pr),e(P,Cr),e(P,N),T(It,N,null),e(N,Ar),e(N,ae),e(ae,qr),e(ae,_o),e(_o,zr),e(ae,Or),e(ae,ns),e(ns,Nr),e(ae,Dr),e(N,Lr),T(je,N,null),e(N,Hr),T(Ee,N,null),_(t,Js,h),_(t,re,h),e(re,Pe),e(Pe,as),T(xt,as,null),e(re,Wr),e(re,rs),e(rs,Vr),_(t,Qs,h),_(t,V,h),T(jt,V,null),e(V,Ur),e(V,Et),e(Et,Br),e(Et,Pt),e(Pt,Rr),e(Et,Kr),e(V,Yr),e(V,D),T(Ct,D,null),e(D,Zr),e(D,ie),e(ie,Gr),e(ie,wo),e(wo,Jr),e(ie,Qr),e(ie,is),e(is,Xr),e(ie,ei),e(D,ti),T(Ce,D,null),e(D,oi),T(Ae,D,null),_(t,Xs,h),_(t,le,h),e(le,qe),e(qe,ls),T(At,ls,null),e(le,si),e(le,ds),e(ds,ni),_(t,en,h),_(t,U,h),T(qt,U,null),e(U,ai),e(U,de),e(de,ri),e(de,zt),e(zt,ii),e(de,li),e(de,Ot),e(Ot,di),e(de,ci),e(U,pi),e(U,L),T(Nt,L,null),e(L,hi),e(L,ce),e(ce,mi),e(ce,vo),e(vo,fi),e(ce,ui),e(ce,cs),e(cs,gi),e(ce,_i),e(L,wi),T(ze,L,null),e(L,vi),T(Oe,L,null),_(t,tn,h),_(t,pe,h),e(pe,Ne),e(Ne,ps),T(Dt,ps,null),e(pe,bi),e(pe,hs),e(hs,$i),_(t,on,h),_(t,C,h),T(Lt,C,null),e(C,Ti),e(C,ms),e(ms,yi),e(C,Si),e(C,Ht),e(Ht,ki),e(Ht,Wt),e(Wt,Mi),e(Ht,Fi),e(C,Ii),e(C,H),T(Vt,H,null),e(H,xi),e(H,he),e(he,ji),e(he,bo),e(bo,Ei),e(he,Pi),e(he,fs),e(fs,Ci),e(he,Ai),e(H,qi),T(De,H,null),e(H,zi),T(Le,H,null),sn=!0},p(t,[h]){const Ut={};h&2&&(Ut.$$scope={dirty:h,ctx:t}),$e.$set(Ut);const us={};h&2&&(us.$$scope={dirty:h,ctx:t}),ye.$set(us);const gs={};h&2&&(gs.$$scope={dirty:h,ctx:t}),Se.$set(gs);const _s={};h&2&&(_s.$$scope={dirty:h,ctx:t}),Me.$set(_s);const Bt={};h&2&&(Bt.$$scope={dirty:h,ctx:t}),Fe.$set(Bt);const ws={};h&2&&(ws.$$scope={dirty:h,ctx:t}),Ie.$set(ws);const vs={};h&2&&(vs.$$scope={dirty:h,ctx:t}),je.$set(vs);const bs={};h&2&&(bs.$$scope={dirty:h,ctx:t}),Ee.$set(bs);const Rt={};h&2&&(Rt.$$scope={dirty:h,ctx:t}),Ce.$set(Rt);const $s={};h&2&&($s.$$scope={dirty:h,ctx:t}),Ae.$set($s);const Ts={};h&2&&(Ts.$$scope={dirty:h,ctx:t}),ze.$set(Ts);const ys={};h&2&&(ys.$$scope={dirty:h,ctx:t}),Oe.$set(ys);const Ss={};h&2&&(Ss.$$scope={dirty:h,ctx:t}),De.$set(Ss);const ks={};h&2&&(ks.$$scope={dirty:h,ctx:t}),Le.$set(ks)},i(t){sn||(y(s.$$.fragment,t),y(Je.$$.fragment,t),y(nt.$$.fragment,t),y(at.$$.fragment,t),y(dt.$$.fragment,t),y(ct.$$.fragment,t),y($e.$$.fragment,t),y(ht.$$.fragment,t),y(mt.$$.fragment,t),y(gt.$$.fragment,t),y(ye.$$.fragment,t),y(Se.$$.fragment,t),y(_t.$$.fragment,t),y(wt.$$.fragment,t),y(Me.$$.fragment,t),y(yt.$$.fragment,t),y(Fe.$$.fragment,t),y(Ie.$$.fragment,t),y(St.$$.fragment,t),y(kt.$$.fragment,t),y(It.$$.fragment,t),y(je.$$.fragment,t),y(Ee.$$.fragment,t),y(xt.$$.fragment,t),y(jt.$$.fragment,t),y(Ct.$$.fragment,t),y(Ce.$$.fragment,t),y(Ae.$$.fragment,t),y(At.$$.fragment,t),y(qt.$$.fragment,t),y(Nt.$$.fragment,t),y(ze.$$.fragment,t),y(Oe.$$.fragment,t),y(Dt.$$.fragment,t),y(Lt.$$.fragment,t),y(Vt.$$.fragment,t),y(De.$$.fragment,t),y(Le.$$.fragment,t),sn=!0)},o(t){S(s.$$.fragment,t),S(Je.$$.fragment,t),S(nt.$$.fragment,t),S(at.$$.fragment,t),S(dt.$$.fragment,t),S(ct.$$.fragment,t),S($e.$$.fragment,t),S(ht.$$.fragment,t),S(mt.$$.fragment,t),S(gt.$$.fragment,t),S(ye.$$.fragment,t),S(Se.$$.fragment,t),S(_t.$$.fragment,t),S(wt.$$.fragment,t),S(Me.$$.fragment,t),S(yt.$$.fragment,t),S(Fe.$$.fragment,t),S(Ie.$$.fragment,t),S(St.$$.fragment,t),S(kt.$$.fragment,t),S(It.$$.fragment,t),S(je.$$.fragment,t),S(Ee.$$.fragment,t),S(xt.$$.fragment,t),S(jt.$$.fragment,t),S(Ct.$$.fragment,t),S(Ce.$$.fragment,t),S(Ae.$$.fragment,t),S(At.$$.fragment,t),S(qt.$$.fragment,t),S(Nt.$$.fragment,t),S(ze.$$.fragment,t),S(Oe.$$.fragment,t),S(Dt.$$.fragment,t),S(Lt.$$.fragment,t),S(Vt.$$.fragment,t),S(De.$$.fragment,t),S(Le.$$.fragment,t),sn=!1},d(t){o(d),t&&o(v),t&&o(f),k(s),t&&o(Fs),t&&o(Z),k(Je),t&&o(Is),t&&o(fe),t&&o(xs),t&&o(Qt),t&&o(js),t&&o(Xt),t&&o(Es),t&&o(eo),t&&o(Ps),t&&o(B),t&&o(Cs),t&&o(ue),t&&o(As),t&&o(ge),t&&o(qs),t&&o(q),t&&o(zs),t&&o(G),k(nt),t&&o(Os),t&&o(so),t&&o(Ns),k(at,t),t&&o(Ds),t&&o(we),t&&o(Ls),t&&o(io),t&&o(Hs),t&&o(lo),t&&o(Ws),t&&o(po),t&&o(Vs),t&&o(J),k(dt),t&&o(Us),t&&o(E),k(ct),k($e),t&&o(Bs),t&&o(ee),k(ht),t&&o(Rs),t&&o(W),k(mt),k(gt),k(ye),k(Se),t&&o(Ks),t&&o(oe),k(_t),t&&o(Ys),t&&o(j),k(wt),k(Me),k(yt),k(Fe),k(Ie),t&&o(Zs),t&&o(ne),k(St),t&&o(Gs),t&&o(P),k(kt),k(It),k(je),k(Ee),t&&o(Js),t&&o(re),k(xt),t&&o(Qs),t&&o(V),k(jt),k(Ct),k(Ce),k(Ae),t&&o(Xs),t&&o(le),k(At),t&&o(en),t&&o(U),k(qt),k(Nt),k(ze),k(Oe),t&&o(tn),t&&o(pe),k(Dt),t&&o(on),t&&o(C),k(Lt),k(Vt),k(De),k(Le)}}}const Md={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 Fd(M){return dd(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class qd extends nd{constructor(d){super();ad(this,d,Fd,kd,rd,{})}}export{qd as default,Md as metadata};
