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.logits
list(reconstructed_pixel_values.shape)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, SwinForMaskedImageModeling
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests

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

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;microsoft/swin-base-simmim-window6-192&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = SwinForMaskedImageModeling.from_pretrained(<span class="hljs-string">&quot;microsoft/swin-base-simmim-window6-192&quot;</span>)

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

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(pixel_values, bool_masked_pos=bool_masked_pos)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss, reconstructed_pixel_values = outputs.loss, outputs.logits
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(reconstructed_pixel_values.shape)
[<span class="hljs-number">1</span>, <span class="hljs-number">3</span>, <span class="hljs-number">192</span>, <span class="hljs-number">192</span>]`}}),{c(){d=n("p"),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.logits
list(reconstructed_pixel_values.shape)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, TFSwinForMaskedImageModeling
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests

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

<span class="hljs-meta">&gt;&gt;&gt; </span>image_processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;microsoft/swin-tiny-patch4-window7-224&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFSwinForMaskedImageModeling.from_pretrained(<span class="hljs-string">&quot;microsoft/swin-tiny-patch4-window7-224&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>num_patches = (model.config.image_size // model.config.patch_size) ** <span class="hljs-number">2</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pixel_values = image_processor(images=image, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>).pixel_values
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># create random boolean mask of shape (batch_size, num_patches)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>bool_masked_pos = tf.random.uniform((<span class="hljs-number">1</span>, num_patches)) &gt;= <span class="hljs-number">0.5</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(pixel_values, bool_masked_pos=bool_masked_pos)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss, reconstructed_pixel_values = outputs.loss, outputs.logits
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">list</span>(reconstructed_pixel_values.shape)
[<span class="hljs-number">1</span>, <span class="hljs-number">3</span>, <span class="hljs-number">224</span>, <span class="hljs-number">224</span>]`}}),{c(){d=n("p"),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,Es,Xt,zo,En,js,eo,jn,Cs,B,Xe,Cn,to,Pn,An,qn,et,zn,Oo,On,Nn,Ln,I,Dn,No,Hn,Vn,Lo,Wn,Un,Do,Bn,Rn,Ho,Kn,Yn,Vo,Zn,Gn,Wo,Jn,Qn,Uo,Xn,ea,Ps,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,Ls,we,R,no,fa,ua,rt,ga,_a,it,wa,va,ba,ao,$a,ro,Ta,Ds,io,ya,Hs,lo,ve,co,Sa,ka,lt,Ma,Fa,Vs,po,Ia,Ws,J,be,Ko,dt,xa,Yo,Ea,Us,j,ct,ja,Q,Ca,ho,Pa,Aa,pt,qa,za,Oa,X,Na,mo,La,Da,fo,Ha,Va,Wa,$e,Bs,ee,Te,Zo,ht,Ua,Go,Ba,Rs,V,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,E,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,C,kt,Fr,ss,Ir,xr,Mt,Er,Ft,jr,Cr,Pr,N,It,Ar,ae,qr,_o,zr,Or,ns,Nr,Lr,Dr,Ee,Hr,je,Js,re,Ce,as,xt,Vr,rs,Wr,Qs,W,Et,Ur,jt,Br,Ct,Rr,Kr,Yr,L,Pt,Zr,ie,Gr,wo,Jr,Qr,is,Xr,ei,ti,Pe,oi,Ae,Xs,le,qe,ls,At,si,ds,ni,en,U,qt,ai,de,ri,zt,ii,li,Ot,di,ci,pi,D,Nt,hi,ce,mi,vo,fi,ui,cs,gi,_i,wi,ze,vi,Oe,tn,pe,Ne,ps,Lt,bi,hs,$i,on,P,Dt,Ti,ms,yi,Si,Ht,ki,Vt,Mi,Fi,Ii,H,Wt,xi,he,Ei,bo,ji,Ci,fs,Pi,Ai,qi,Le,zi,De,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:"**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). Will default to the last stage if unset.`,name:"out_features"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/swin/configuration_swin.py#L37"}}),$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.27.1/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.27.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/swin/modeling_swin.py#L935"}}),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.27.1/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.27.1/en/model_doc/videomae#transformers.VideoMAEFeatureExtractor.__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.27.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/swin/modeling_swin.py#L962",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.27.1/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.27.1/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.27.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/swin/modeling_swin.py#L1040"}}),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.27.1/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.27.1/en/model_doc/videomae#transformers.VideoMAEFeatureExtractor.__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.27.1/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.27.1/src/transformers/models/swin/modeling_swin.py#L1057",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.27.1/en/model_doc/swin#transformers.SwinConfig"
>SwinConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>bool_masked_pos</code> is provided) \u2014 Masked image modeling (MLM) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) \u2014 Reconstructed pixel values.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each stage) of
shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each stage) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
<li>
<p><strong>reshaped_hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each stage) of
shape <code>(batch_size, hidden_size, height, width)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs reshaped to
include the spatial dimensions.</p>
</li>
</ul>
`,returnType:`
<p><code>transformers.models.swin.modeling_swin.SwinMaskedImageModelingOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),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.27.1/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.27.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/swin/modeling_swin.py#L1151"}}),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.27.1/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.27.1/en/model_doc/videomae#transformers.VideoMAEFeatureExtractor.__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.27.1/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.27.1/src/transformers/models/swin/modeling_swin.py#L1166",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.27.1/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>
`}}),Ee=new Yt({props:{$$slots:{default:[_d]},$$scope:{ctx:M}}}),je=new Zt({props:{anchor:"transformers.SwinForImageClassification.forward.example",$$slots:{default:[wd]},$$scope:{ctx:M}}}),xt=new Y({}),Et=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.27.1/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.27.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/swin/modeling_tf_swin.py#L1184"}}),Pt=new A({props:{name:"call",anchor:"transformers.TFSwinModel.call",parameters:[{name:"pixel_values",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"bool_masked_pos",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"head_mask",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"training",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TFSwinModel.call.pixel_values",description:`<strong>pixel_values</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/v4.27.1/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.27.1/en/model_doc/videomae#transformers.VideoMAEFeatureExtractor.__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.27.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/swin/modeling_tf_swin.py#L1192",returnDescription:`
<p>A <code>transformers.models.swin.modeling_tf_swin.TFSwinModelOutput</code> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/v4.27.1/en/model_doc/swin#transformers.SwinConfig"
>SwinConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, hidden_size)</code>, <em>optional</em>, returned when <code>add_pooling_layer=True</code> is passed) \u2014 Average pooling of the last layer hidden-state.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each stage) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each stage) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
<li>
<p><strong>reshaped_hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each stage) of shape
<code>(batch_size, hidden_size, height, width)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs reshaped to
include the spatial dimensions.</p>
</li>
</ul>
`,returnType:`
<p><code>transformers.models.swin.modeling_tf_swin.TFSwinModelOutput</code> or <code>tuple(tf.Tensor)</code></p>
`}}),Pe=new 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.27.1/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.27.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/swin/modeling_tf_swin.py#L1293"}}),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.27.1/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.27.1/en/model_doc/videomae#transformers.VideoMAEFeatureExtractor.__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.27.1/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.27.1/src/transformers/models/swin/modeling_tf_swin.py#L1301",returnDescription:`
<p>A <code>transformers.models.swin.modeling_tf_swin.TFSwinMaskedImageModelingOutput</code> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/v4.27.1/en/model_doc/swin#transformers.SwinConfig"
>SwinConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>bool_masked_pos</code> is provided) \u2014 Masked image modeling (MLM) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) \u2014 Reconstructed pixel values.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each stage) of shape
<code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for each stage) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
<li>
<p><strong>reshaped_hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each stage) of shape
<code>(batch_size, hidden_size, height, width)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs reshaped to
include the spatial dimensions.</p>
</li>
</ul>
`,returnType:`
<p><code>transformers.models.swin.modeling_tf_swin.TFSwinMaskedImageModelingOutput</code> or <code>tuple(tf.Tensor)</code></p>
`}}),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}}}),Lt=new Y({}),Dt=new A({props:{name:"class transformers.TFSwinForImageClassification",anchor:"transformers.TFSwinForImageClassification",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFSwinForImageClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.27.1/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.27.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.27.1/src/transformers/models/swin/modeling_tf_swin.py#L1414"}}),Wt=new A({props:{name:"call",anchor:"transformers.TFSwinForImageClassification.call",parameters:[{name:"pixel_values",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"head_mask",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"labels",val:": typing.Optional[tensorflow.python.framework.ops.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"training",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TFSwinForImageClassification.call.pixel_values",description:`<strong>pixel_values</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/v4.27.1/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/v4.27.1/en/model_doc/videomae#transformers.VideoMAEFeatureExtractor.__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.27.1/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.27.1/src/transformers/models/swin/modeling_tf_swin.py#L1428",returnDescription:`
<p>A <code>transformers.models.swin.modeling_tf_swin.TFSwinImageClassifierOutput</code> or a tuple of <code>tf.Tensor</code> (if
<code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the
configuration (<a
  href="/docs/transformers/v4.27.1/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>
`}}),Le=new Yt({props:{$$slots:{default:[yd]},$$scope:{ctx:M}}}),De=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:"),Es=u(),Xt=n("p"),zo=n("em"),En=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.`),js=u(),eo=n("p"),jn=r("Tips:"),Cs=u(),B=n("ul"),Xe=n("li"),Cn=r("One can use the "),to=n("a"),Pn=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(")."),Ln=u(),I=n("li"),Dn=r("Swin can be used as a "),No=n("em"),Hn=r("backbone"),Vn=r(". When "),Lo=n("code"),Wn=r("output_hidden_states = True"),Un=r(", it will output both "),Do=n("code"),Bn=r("hidden_states"),Rn=r(" and "),Ho=n("code"),Kn=r("reshaped_hidden_states"),Yn=r(". The "),Vo=n("code"),Zn=r("reshaped_hidden_states"),Gn=r(" have a shape of "),Wo=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("."),Ps=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),Ls=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"),Ds=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("."),Vs=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."),Ws=u(),J=n("h2"),be=n("a"),Ko=n("span"),b(dt.$$.fragment),xa=u(),Yo=n("span"),Ea=r("SwinConfig"),Us=u(),j=n("div"),b(ct.$$.fragment),ja=u(),Q=n("p"),Ca=r("This is the configuration class to store the configuration of a "),ho=n("a"),Pa=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"),La=r("PretrainedConfig"),Da=r(` and can be used to control the model outputs. Read the
documentation from `),fo=n("a"),Ha=r("PretrainedConfig"),Va=r(" for more information."),Wa=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(),V=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(),E=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(),C=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"),Er=r("This model is a PyTorch "),Ft=n("a"),jr=r("torch.nn.Module"),Cr=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.`),Pr=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__"),Lr=r(" special method."),Dr=u(),b(Ee.$$.fragment),Hr=u(),b(je.$$.fragment),Js=u(),re=n("h2"),Ce=n("a"),as=n("span"),b(xt.$$.fragment),Vr=u(),rs=n("span"),Wr=r("TFSwinModel"),Qs=u(),W=n("div"),b(Et.$$.fragment),Ur=u(),jt=n("p"),Br=r(`The bare Swin Model transformer outputting raw hidden-states without any specific head on top.
This model is a Tensorflow
`),Ct=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(),L=n("div"),b(Pt.$$.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(Pe.$$.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(),D=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(Lt.$$.fragment),bi=u(),hs=n("span"),$i=r("TFSwinForImageClassification"),on=u(),P=n("div"),b(Dt.$$.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
`),Vt=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(Wt.$$.fragment),xi=u(),he=n("p"),Ei=r("The "),bo=n("a"),ji=r("TFSwinForImageClassification"),Ci=r(" forward method, overrides the "),fs=n("code"),Pi=r("__call__"),Ai=r(" special method."),qi=u(),b(Le.$$.fragment),zi=u(),b(De.$$.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),Es=g(t),Xt=a(t,"P",{});var ys=l(Xt);zo=a(ys,"EM",{});var Ss=l(zo);En=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),js=g(t),eo=a(t,"P",{});var ks=l(eo);jn=i(ks,"Tips:"),ks.forEach(o),Cs=g(t),B=a(t,"UL",{});var $o=l(B);Xe=a($o,"LI",{});var nn=l(Xe);Cn=i(nn,"One can use the "),to=a(nn,"A",{href:!0});var Li=l(to);Pn=i(Li,"AutoImageProcessor"),Li.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 Di=l(Oo);On=i(Di,"32"),Di.forEach(o),Nn=i(an,")."),an.forEach(o),Ln=g($o),I=a($o,"LI",{});var x=l(I);Dn=i(x,"Swin can be used as a "),No=a(x,"EM",{});var Hi=l(No);Hn=i(Hi,"backbone"),Hi.forEach(o),Vn=i(x,". When "),Lo=a(x,"CODE",{});var Vi=l(Lo);Wn=i(Vi,"output_hidden_states = True"),Vi.forEach(o),Un=i(x,", it will output both "),Do=a(x,"CODE",{});var Wi=l(Do);Bn=i(Wi,"hidden_states"),Wi.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 "),Vo=a(x,"CODE",{});var Bi=l(Vo);Zn=i(Bi,"reshaped_hidden_states"),Bi.forEach(o),Gn=i(x," have a shape of "),Wo=a(x,"CODE",{});var Ri=l(Wo);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),Ps=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),Ls=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),Ds=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),Vs=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),Ws=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);Ea=i(ml,"SwinConfig"),ml.forEach(o),cn.forEach(o),Us=g(t),j=a(t,"DIV",{class:!0});var Ve=l(j);$(ct.$$.fragment,Ve),ja=g(Ve),Q=a(Ve,"P",{});var To=l(Q);Ca=i(To,"This is the configuration class to store the configuration of a "),ho=a(To,"A",{href:!0});var fl=l(ho);Pa=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(Ve),X=a(Ve,"P",{});var yo=l(X);Na=i(yo,"Configuration objects inherit from "),mo=a(yo,"A",{href:!0});var gl=l(mo);La=i(gl,"PretrainedConfig"),gl.forEach(o),Da=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),Va=i(yo," for more information."),yo.forEach(o),Wa=g(Ve),$($e.$$.fragment,Ve),Ve.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),V=a(t,"DIV",{class:!0});var So=l(V);$(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 We=l(z);$(gt.$$.fragment,We),Ja=g(We),te=a(We,"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(We),$(ye.$$.fragment,We),nr=g(We),$(Se.$$.fragment,We),We.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),E=a(t,"DIV",{class:!0});var K=l(E);$(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 El=l(es);$r=i(El,"__call__"),El.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 jl=l(xe);ts=a(jl,"SPAN",{});var Cl=l(ts);$(St.$$.fragment,Cl),Cl.forEach(o),jl.forEach(o),kr=g(gn),os=a(gn,"SPAN",{});var Pl=l(os);Mr=i(Pl,"SwinForImageClassification"),Pl.forEach(o),gn.forEach(o),Gs=g(t),C=a(t,"DIV",{class:!0});var Be=l(C);$(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);Er=i(_n,"This model is a PyTorch "),Ft=a(_n,"A",{href:!0,rel:!0});var ql=l(Ft);jr=i(ql,"torch.nn.Module"),ql.forEach(o),Cr=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),Pr=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),Lr=i(Fo," special method."),Fo.forEach(o),Dr=g(Re),$(Ee.$$.fragment,Re),Hr=g(Re),$(je.$$.fragment,Re),Re.forEach(o),Be.forEach(o),Js=g(t),re=a(t,"H2",{class:!0});var wn=l(re);Ce=a(wn,"A",{id:!0,class:!0,href:!0});var Nl=l(Ce);as=a(Nl,"SPAN",{});var Ll=l(as);$(xt.$$.fragment,Ll),Ll.forEach(o),Nl.forEach(o),Vr=g(wn),rs=a(wn,"SPAN",{});var Dl=l(rs);Wr=i(Dl,"TFSwinModel"),Dl.forEach(o),wn.forEach(o),Qs=g(t),W=a(t,"DIV",{class:!0});var Io=l(W);$(Et.$$.fragment,Io),Ur=g(Io),jt=a(Io,"P",{});var vn=l(jt);Br=i(vn,`The bare Swin Model transformer outputting raw hidden-states without any specific head on top.
This model is a Tensorflow
`),Ct=a(vn,"A",{href:!0,rel:!0});var Hl=l(Ct);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),L=a(Io,"DIV",{class:!0});var Ke=l(L);$(Pt.$$.fragment,Ke),Zr=g(Ke),ie=a(Ke,"P",{});var xo=l(ie);Gr=i(xo,"The "),wo=a(xo,"A",{href:!0});var Vl=l(wo);Jr=i(Vl,"TFSwinModel"),Vl.forEach(o),Qr=i(xo," forward method, overrides the "),is=a(xo,"CODE",{});var Wl=l(is);Xr=i(Wl,"__call__"),Wl.forEach(o),ei=i(xo," special method."),xo.forEach(o),ti=g(Ke),$(Pe.$$.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 Eo=l(U);$(qt.$$.fragment,Eo),ai=g(Eo),de=a(Eo,"P",{});var jo=l(de);ri=i(jo,"Swin Model with a decoder on top for masked image modeling, as proposed in "),zt=a(jo,"A",{href:!0,rel:!0});var Kl=l(zt);ii=i(Kl,"SimMIM"),Kl.forEach(o),li=i(jo,`.
This model is a Tensorflow
`),Ot=a(jo,"A",{href:!0,rel:!0});var Yl=l(Ot);di=i(Yl,"tf.keras.layers.Layer"),Yl.forEach(o),ci=i(jo,` sub-class. Use it as a
regular Tensorflow Module and refer to the Tensorflow documentation for all matter related to general usage and
behavior.`),jo.forEach(o),pi=g(Eo),D=a(Eo,"DIV",{class:!0});var Ye=l(D);$(Nt.$$.fragment,Ye),hi=g(Ye),ce=a(Ye,"P",{});var Co=l(ce);mi=i(Co,"The "),vo=a(Co,"A",{href:!0});var Zl=l(vo);fi=i(Zl,"TFSwinForMaskedImageModeling"),Zl.forEach(o),ui=i(Co," forward method, overrides the "),cs=a(Co,"CODE",{});var Gl=l(cs);gi=i(Gl,"__call__"),Gl.forEach(o),_i=i(Co," special method."),Co.forEach(o),wi=g(Ye),$(ze.$$.fragment,Ye),vi=g(Ye),$(Oe.$$.fragment,Ye),Ye.forEach(o),Eo.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);$(Lt.$$.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),P=a(t,"DIV",{class:!0});var Ze=l(P);$(Dt.$$.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
`),Vt=a(Tn,"A",{href:!0,rel:!0});var td=l(Vt);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);$(Wt.$$.fragment,Ge),xi=g(Ge),he=a(Ge,"P",{});var Po=l(he);Ei=i(Po,"The "),bo=a(Po,"A",{href:!0});var od=l(bo);ji=i(od,"TFSwinForImageClassification"),od.forEach(o),Ci=i(Po," forward method, overrides the "),fs=a(Po,"CODE",{});var sd=l(fs);Pi=i(sd,"__call__"),sd.forEach(o),Ai=i(Po," special method."),Po.forEach(o),qi=g(Ge),$(Le.$$.fragment,Ge),zi=g(Ge),$(De.$$.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.27.1/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.27.1/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.27.1/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.27.1/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.27.1/en/main_classes/configuration#transformers.PretrainedConfig"),c(fo,"href","/docs/transformers/v4.27.1/en/main_classes/configuration#transformers.PretrainedConfig"),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(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.27.1/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(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(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.27.1/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(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(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.27.1/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(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Ce,"id","transformers.TFSwinModel"),c(Ce,"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(Ce,"href","#transformers.TFSwinModel"),c(re,"class","relative group"),c(Ct,"href","https://www.tensorflow.org/api_docs/python/tf/keras/layers/Layer"),c(Ct,"rel","nofollow"),c(wo,"href","/docs/transformers/v4.27.1/en/model_doc/swin#transformers.TFSwinModel"),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(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(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.27.1/en/model_doc/swin#transformers.TFSwinForMaskedImageModeling"),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(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(Vt,"href","https://www.tensorflow.org/api_docs/python/tf/keras/layers/Layer"),c(Vt,"rel","nofollow"),c(bo,"href","/docs/transformers/v4.27.1/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(P,"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,Es,h),_(t,Xt,h),e(Xt,zo),e(zo,En),_(t,js,h),_(t,eo,h),e(eo,jn),_(t,Cs,h),_(t,B,h),e(B,Xe),e(Xe,Cn),e(Xe,to),e(to,Pn),e(Xe,An),e(B,qn),e(B,et),e(et,zn),e(et,Oo),e(Oo,On),e(et,Nn),e(B,Ln),e(B,I),e(I,Dn),e(I,No),e(No,Hn),e(I,Vn),e(I,Lo),e(Lo,Wn),e(I,Un),e(I,Do),e(Do,Bn),e(I,Rn),e(I,Ho),e(Ho,Kn),e(I,Yn),e(I,Vo),e(Vo,Zn),e(I,Gn),e(I,Wo),e(Wo,Jn),e(I,Qn),e(I,Uo),e(Uo,Xn),e(I,ea),_(t,Ps,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,Ls,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,Ds,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,Vs,h),_(t,po,h),e(po,Ia),_(t,Ws,h),_(t,J,h),e(J,be),e(be,Ko),T(dt,Ko,null),e(J,xa),e(J,Yo),e(Yo,Ea),_(t,Us,h),_(t,j,h),T(ct,j,null),e(j,ja),e(j,Q),e(Q,Ca),e(Q,ho),e(ho,Pa),e(Q,Aa),e(Q,pt),e(pt,qa),e(Q,za),e(j,Oa),e(j,X),e(X,Na),e(X,mo),e(mo,La),e(X,Da),e(X,fo),e(fo,Ha),e(X,Va),e(j,Wa),T($e,j,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,V,h),T(mt,V,null),e(V,Ra),e(V,ft),e(ft,Ka),e(ft,ut),e(ut,Ya),e(ft,Za),e(V,Ga),e(V,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,E,h),T(wt,E,null),e(E,ir),e(E,vt),e(vt,lr),e(vt,bt),e(bt,dr),e(vt,cr),e(E,pr),T(Me,E,null),e(E,hr),e(E,$t),e($t,mr),e($t,Tt),e(Tt,fr),e($t,ur),e(E,gr),e(E,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,C,h),T(kt,C,null),e(C,Fr),e(C,ss),e(ss,Ir),e(C,xr),e(C,Mt),e(Mt,Er),e(Mt,Ft),e(Ft,jr),e(Mt,Cr),e(C,Pr),e(C,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,Lr),e(N,Dr),T(Ee,N,null),e(N,Hr),T(je,N,null),_(t,Js,h),_(t,re,h),e(re,Ce),e(Ce,as),T(xt,as,null),e(re,Vr),e(re,rs),e(rs,Wr),_(t,Qs,h),_(t,W,h),T(Et,W,null),e(W,Ur),e(W,jt),e(jt,Br),e(jt,Ct),e(Ct,Rr),e(jt,Kr),e(W,Yr),e(W,L),T(Pt,L,null),e(L,Zr),e(L,ie),e(ie,Gr),e(ie,wo),e(wo,Jr),e(ie,Qr),e(ie,is),e(is,Xr),e(ie,ei),e(L,ti),T(Pe,L,null),e(L,oi),T(Ae,L,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,D),T(Nt,D,null),e(D,hi),e(D,ce),e(ce,mi),e(ce,vo),e(vo,fi),e(ce,ui),e(ce,cs),e(cs,gi),e(ce,_i),e(D,wi),T(ze,D,null),e(D,vi),T(Oe,D,null),_(t,tn,h),_(t,pe,h),e(pe,Ne),e(Ne,ps),T(Lt,ps,null),e(pe,bi),e(pe,hs),e(hs,$i),_(t,on,h),_(t,P,h),T(Dt,P,null),e(P,Ti),e(P,ms),e(ms,yi),e(P,Si),e(P,Ht),e(Ht,ki),e(Ht,Vt),e(Vt,Mi),e(Ht,Fi),e(P,Ii),e(P,H),T(Wt,H,null),e(H,xi),e(H,he),e(he,Ei),e(he,bo),e(bo,ji),e(he,Ci),e(he,fs),e(fs,Pi),e(he,Ai),e(H,qi),T(Le,H,null),e(H,zi),T(De,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}),Ee.$set(vs);const bs={};h&2&&(bs.$$scope={dirty:h,ctx:t}),je.$set(bs);const Rt={};h&2&&(Rt.$$scope={dirty:h,ctx:t}),Pe.$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}),Le.$set(Ss);const ks={};h&2&&(ks.$$scope={dirty:h,ctx:t}),De.$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(Ee.$$.fragment,t),y(je.$$.fragment,t),y(xt.$$.fragment,t),y(Et.$$.fragment,t),y(Pt.$$.fragment,t),y(Pe.$$.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(Lt.$$.fragment,t),y(Dt.$$.fragment,t),y(Wt.$$.fragment,t),y(Le.$$.fragment,t),y(De.$$.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(Ee.$$.fragment,t),S(je.$$.fragment,t),S(xt.$$.fragment,t),S(Et.$$.fragment,t),S(Pt.$$.fragment,t),S(Pe.$$.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(Lt.$$.fragment,t),S(Dt.$$.fragment,t),S(Wt.$$.fragment,t),S(Le.$$.fragment,t),S(De.$$.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(Es),t&&o(Xt),t&&o(js),t&&o(eo),t&&o(Cs),t&&o(B),t&&o(Ps),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(Ls),t&&o(we),t&&o(Ds),t&&o(io),t&&o(Hs),t&&o(lo),t&&o(Vs),t&&o(po),t&&o(Ws),t&&o(J),k(dt),t&&o(Us),t&&o(j),k(ct),k($e),t&&o(Bs),t&&o(ee),k(ht),t&&o(Rs),t&&o(V),k(mt),k(gt),k(ye),k(Se),t&&o(Ks),t&&o(oe),k(_t),t&&o(Ys),t&&o(E),k(wt),k(Me),k(yt),k(Fe),k(Ie),t&&o(Zs),t&&o(ne),k(St),t&&o(Gs),t&&o(C),k(kt),k(It),k(Ee),k(je),t&&o(Js),t&&o(re),k(xt),t&&o(Qs),t&&o(W),k(Et),k(Pt),k(Pe),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(Lt),t&&o(on),t&&o(P),k(Dt),k(Wt),k(Le),k(De)}}}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};
