import{s as Ht,o as Pt,n as q}from"../chunks/scheduler.18a86fab.js";import{S as Lt,i as St,g as m,s as r,r as g,A as Yt,h as p,f as a,c as l,j as V,u as _,x as h,k as G,y as i,a as d,v as b,d as M,t as y,w}from"../chunks/index.98837b22.js";import{T as Ye}from"../chunks/Tip.77304350.js";import{D as pe}from"../chunks/Docstring.6758ea23.js";import{C as qe}from"../chunks/CodeBlock.8d0c2e8a.js";import{E as Xe}from"../chunks/ExampleCodeBlock.0c42463f.js";import{H as xe}from"../chunks/Heading.7e7e0c5b.js";import{E as Xt}from"../chunks/index.499f366c.js";function qt($){let t,f="Example:",s,c,u;return c=new qe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEZvY2FsTmV0Q29uZmlnJTJDJTIwRm9jYWxOZXRNb2RlbCUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBGb2NhbE5ldCUyMG1pY3Jvc29mdCUyRmZvY2FsbmV0LXRpbnklMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwRm9jYWxOZXRDb25maWcoKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBtb2RlbCUyMCh3aXRoJTIwcmFuZG9tJTIwd2VpZ2h0cyklMjBmcm9tJTIwdGhlJTIwbWljcm9zb2Z0JTJGZm9jYWxuZXQtdGlueSUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsJTIwJTNEJTIwRm9jYWxOZXRNb2RlbChjb25maWd1cmF0aW9uKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWc=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> FocalNetConfig, FocalNetModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a FocalNet microsoft/focalnet-tiny style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = FocalNetConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the microsoft/focalnet-tiny style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FocalNetModel(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`,wrap:!1}}),{c(){t=m("p"),t.textContent=f,s=r(),g(c.$$.fragment)},l(o){t=p(o,"P",{"data-svelte-h":!0}),h(t)!=="svelte-11lpom8"&&(t.textContent=f),s=l(o),_(c.$$.fragment,o)},m(o,F){d(o,t,F),d(o,s,F),b(c,o,F),u=!0},p:q,i(o){u||(M(c.$$.fragment,o),u=!0)},o(o){y(c.$$.fragment,o),u=!1},d(o){o&&(a(t),a(s)),w(c,o)}}}function Qt($){let t,f=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){t=m("p"),t.innerHTML=f},l(s){t=p(s,"P",{"data-svelte-h":!0}),h(t)!=="svelte-fincs2"&&(t.innerHTML=f)},m(s,c){d(s,t,c)},p:q,d(s){s&&a(t)}}}function At($){let t,f="Example:",s,c,u;return c=new qe({props:{code:"",highlighted:"",wrap:!1}}),{c(){t=m("p"),t.textContent=f,s=r(),g(c.$$.fragment)},l(o){t=p(o,"P",{"data-svelte-h":!0}),h(t)!=="svelte-11lpom8"&&(t.textContent=f),s=l(o),_(c.$$.fragment,o)},m(o,F){d(o,t,F),d(o,s,F),b(c,o,F),u=!0},p:q,i(o){u||(M(c.$$.fragment,o),u=!0)},o(o){y(c.$$.fragment,o),u=!1},d(o){o&&(a(t),a(s)),w(c,o)}}}function Dt($){let t,f=`Note that we provide a script to pre-train this model on custom data in our <a href="https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-pretraining" rel="nofollow">examples
directory</a>.`;return{c(){t=m("p"),t.innerHTML=f},l(s){t=p(s,"P",{"data-svelte-h":!0}),h(t)!=="svelte-7i3y9o"&&(t.innerHTML=f)},m(s,c){d(s,t,c)},p:q,d(s){s&&a(t)}}}function Ot($){let t,f=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){t=m("p"),t.innerHTML=f},l(s){t=p(s,"P",{"data-svelte-h":!0}),h(t)!=="svelte-fincs2"&&(t.innerHTML=f)},m(s,c){d(s,t,c)},p:q,d(s){s&&a(t)}}}function Kt($){let t,f="Examples:",s,c,u;return c=new qe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMEZvY2FsTmV0Q29uZmlnJTJDJTIwRm9jYWxOZXRGb3JNYXNrZWRJbWFnZU1vZGVsaW5nJTBBaW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjByZXF1ZXN0cyUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHAlM0ElMkYlMkZpbWFnZXMuY29jb2RhdGFzZXQub3JnJTJGdmFsMjAxNyUyRjAwMDAwMDAzOTc2OS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEElMEFpbWFnZV9wcm9jZXNzb3IlMjAlM0QlMjBBdXRvSW1hZ2VQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMm1pY3Jvc29mdCUyRmZvY2FsbmV0LWJhc2Utc2ltbWltLXdpbmRvdzYtMTkyJTIyKSUwQWNvbmZpZyUyMCUzRCUyMEZvY2FsTmV0Q29uZmlnKCklMEFtb2RlbCUyMCUzRCUyMEZvY2FsTmV0Rm9yTWFza2VkSW1hZ2VNb2RlbGluZyhjb25maWcpJTBBJTBBbnVtX3BhdGNoZXMlMjAlM0QlMjAobW9kZWwuY29uZmlnLmltYWdlX3NpemUlMjAlMkYlMkYlMjBtb2RlbC5jb25maWcucGF0Y2hfc2l6ZSklMjAqKiUyMDIlMEFwaXhlbF92YWx1ZXMlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IoaW1hZ2VzJTNEaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKS5waXhlbF92YWx1ZXMlMEElMjMlMjBjcmVhdGUlMjByYW5kb20lMjBib29sZWFuJTIwbWFzayUyMG9mJTIwc2hhcGUlMjAoYmF0Y2hfc2l6ZSUyQyUyMG51bV9wYXRjaGVzKSUwQWJvb2xfbWFza2VkX3BvcyUyMCUzRCUyMHRvcmNoLnJhbmRpbnQobG93JTNEMCUyQyUyMGhpZ2glM0QyJTJDJTIwc2l6ZSUzRCgxJTJDJTIwbnVtX3BhdGNoZXMpKS5ib29sKCklMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwocGl4ZWxfdmFsdWVzJTJDJTIwYm9vbF9tYXNrZWRfcG9zJTNEYm9vbF9tYXNrZWRfcG9zKSUwQWxvc3MlMkMlMjByZWNvbnN0cnVjdGVkX3BpeGVsX3ZhbHVlcyUyMCUzRCUyMG91dHB1dHMubG9zcyUyQyUyMG91dHB1dHMubG9naXRzJTBBbGlzdChyZWNvbnN0cnVjdGVkX3BpeGVsX3ZhbHVlcy5zaGFwZSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, FocalNetConfig, FocalNetForMaskedImageModeling
<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/focalnet-base-simmim-window6-192&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>config = FocalNetConfig()
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FocalNetForMaskedImageModeling(config)

<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>]`,wrap:!1}}),{c(){t=m("p"),t.textContent=f,s=r(),g(c.$$.fragment)},l(o){t=p(o,"P",{"data-svelte-h":!0}),h(t)!=="svelte-kvfsh7"&&(t.textContent=f),s=l(o),_(c.$$.fragment,o)},m(o,F){d(o,t,F),d(o,s,F),b(c,o,F),u=!0},p:q,i(o){u||(M(c.$$.fragment,o),u=!0)},o(o){y(c.$$.fragment,o),u=!1},d(o){o&&(a(t),a(s)),w(c,o)}}}function eo($){let t,f=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){t=m("p"),t.innerHTML=f},l(s){t=p(s,"P",{"data-svelte-h":!0}),h(t)!=="svelte-fincs2"&&(t.innerHTML=f)},m(s,c){d(s,t,c)},p:q,d(s){s&&a(t)}}}function to($){let t,f="Example:",s,c,u;return c=new qe({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMEZvY2FsTmV0Rm9ySW1hZ2VDbGFzc2lmaWNhdGlvbiUwQWltcG9ydCUyMHRvcmNoJTBBZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBZGF0YXNldCUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJodWdnaW5nZmFjZSUyRmNhdHMtaW1hZ2UlMjIlMkMlMjB0cnVzdF9yZW1vdGVfY29kZSUzRFRydWUpJTBBaW1hZ2UlMjAlM0QlMjBkYXRhc2V0JTVCJTIydGVzdCUyMiU1RCU1QiUyMmltYWdlJTIyJTVEJTVCMCU1RCUwQSUwQWltYWdlX3Byb2Nlc3NvciUyMCUzRCUyMEF1dG9JbWFnZVByb2Nlc3Nvci5mcm9tX3ByZXRyYWluZWQoJTIybWljcm9zb2Z0JTJGZm9jYWxuZXQtdGlueSUyMiklMEFtb2RlbCUyMCUzRCUyMEZvY2FsTmV0Rm9ySW1hZ2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIybWljcm9zb2Z0JTJGZm9jYWxuZXQtdGlueSUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IoaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRzJTBBJTBBJTIzJTIwbW9kZWwlMjBwcmVkaWN0cyUyMG9uZSUyMG9mJTIwdGhlJTIwMTAwMCUyMEltYWdlTmV0JTIwY2xhc3NlcyUwQXByZWRpY3RlZF9sYWJlbCUyMCUzRCUyMGxvZ2l0cy5hcmdtYXgoLTEpLml0ZW0oKSUwQXByaW50KG1vZGVsLmNvbmZpZy5pZDJsYWJlbCU1QnByZWRpY3RlZF9sYWJlbCU1RCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, FocalNetForImageClassification
<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>, trust_remote_code=<span class="hljs-literal">True</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/focalnet-tiny&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FocalNetForImageClassification.from_pretrained(<span class="hljs-string">&quot;microsoft/focalnet-tiny&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])
...`,wrap:!1}}),{c(){t=m("p"),t.textContent=f,s=r(),g(c.$$.fragment)},l(o){t=p(o,"P",{"data-svelte-h":!0}),h(t)!=="svelte-11lpom8"&&(t.textContent=f),s=l(o),_(c.$$.fragment,o)},m(o,F){d(o,t,F),d(o,s,F),b(c,o,F),u=!0},p:q,i(o){u||(M(c.$$.fragment,o),u=!0)},o(o){y(c.$$.fragment,o),u=!1},d(o){o&&(a(t),a(s)),w(c,o)}}}function oo($){let t,f,s,c,u,o,F,wt='<img alt="PyTorch" src="https://img.shields.io/badge/PyTorch-DE3412?style=flat&amp;logo=pytorch&amp;logoColor=white"/>',ke,Q,Ue,A,Ft=`The FocalNet model was proposed in <a href="https://arxiv.org/abs/2203.11926" rel="nofollow">Focal Modulation Networks</a> by Jianwei Yang, Chunyuan Li, Xiyang Dai, Lu Yuan, Jianfeng Gao.
FocalNets completely replace self-attention (used in models like <a href="vit">ViT</a> and <a href="swin">Swin</a>) by a focal modulation mechanism for modeling token interactions in vision.
The authors claim that FocalNets outperform self-attention based models with similar computational costs on the tasks of image classification, object detection, and segmentation.`,ze,D,vt="The abstract from the paper is the following:",Ie,O,$t=`<em>We propose focal modulation networks (FocalNets in short), where self-attention (SA) is completely replaced by a focal modulation mechanism for modeling token interactions in vision. Focal modulation comprises three components: (i) hierarchical contextualization, implemented using a stack of depth-wise convolutional layers, to encode visual contexts from short to long ranges, (ii) gated aggregation to selectively gather contexts for each query token based on its
content, and (iii) element-wise modulation or affine transformation to inject the aggregated context into the query. Extensive experiments show FocalNets outperform the state-of-the-art SA counterparts (e.g., Swin and Focal Transformers) with similar computational costs on the tasks of image classification, object detection, and segmentation. Specifically, FocalNets with tiny and base size achieve 82.3% and 83.9% top-1 accuracy on ImageNet-1K. After pretrained on ImageNet-22K in 224 resolution, it attains 86.5% and 87.3% top-1 accuracy when finetuned with resolution 224 and 384, respectively. When transferred to downstream tasks, FocalNets exhibit clear superiority. For object detection with Mask R-CNN, FocalNet base trained with 1\\times outperforms the Swin counterpart by 2.1 points and already surpasses Swin trained with 3\\times schedule (49.0 v.s. 48.5). For semantic segmentation with UPerNet, FocalNet base at single-scale outperforms Swin by 2.4, and beats Swin at multi-scale (50.5 v.s. 49.7). Using large FocalNet and Mask2former, we achieve 58.5 mIoU for ADE20K semantic segmentation, and 57.9 PQ for COCO Panoptic Segmentation. Using huge FocalNet and DINO, we achieved 64.3 and 64.4 mAP on COCO minival and test-dev, respectively, establishing new SoTA on top of much larger attention-based models like Swinv2-G and BEIT-3.</em>`,Ze,K,Tt=`This model was contributed by <a href="https://huggingface.co/nielsr" rel="nofollow">nielsr</a>.
The original code can be found <a href="https://github.com/microsoft/FocalNet" rel="nofollow">here</a>.`,We,ee,Je,x,te,Qe,fe,Nt=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/focalnet#transformers.FocalNetModel">FocalNetModel</a>. It is used to instantiate a
FocalNet 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 FocalNet
<a href="https://huggingface.co/microsoft/focalnet-tiny" rel="nofollow">microsoft/focalnet-tiny</a> architecture.`,Ae,he,Ct=`Configuration objects inherit from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,De,B,Re,oe,Ge,N,ne,Oe,ue,xt="The bare Focalnet Model outputting raw hidden-states without any specific head on top.",Ke,ge,jt=`This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,et,_e,kt=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,tt,U,ae,ot,be,Ut='The <a href="/docs/transformers/main/en/model_doc/focalnet#transformers.FocalNetModel">FocalNetModel</a> forward method, overrides the <code>__call__</code> special method.',nt,E,at,H,Ve,se,Be,v,re,st,Me,zt="FocalNet Model with a decoder on top for masked image modeling.",rt,ye,It='This follows the same implementation as in <a href="https://arxiv.org/abs/2111.09886" rel="nofollow">SimMIM</a>.',lt,P,it,we,Zt=`This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,ct,Fe,Wt=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,dt,z,le,mt,ve,Jt='The <a href="/docs/transformers/main/en/model_doc/focalnet#transformers.FocalNetForMaskedImageModeling">FocalNetForMaskedImageModeling</a> forward method, overrides the <code>__call__</code> special method.',pt,L,ft,S,Ee,ie,He,C,ce,ht,$e,Rt=`FocalNet Model with an image classification head on top (a linear layer on top of the pooled output) e.g. for
ImageNet.`,ut,Te,Gt=`This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,gt,Ne,Vt=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,_t,I,de,bt,Ce,Bt='The <a href="/docs/transformers/main/en/model_doc/focalnet#transformers.FocalNetForImageClassification">FocalNetForImageClassification</a> forward method, overrides the <code>__call__</code> special method.',Mt,Y,yt,X,Pe,me,Le,je,Se;return u=new xe({props:{title:"FocalNet",local:"focalnet",headingTag:"h1"}}),Q=new xe({props:{title:"Overview",local:"overview",headingTag:"h2"}}),ee=new xe({props:{title:"FocalNetConfig",local:"transformers.FocalNetConfig",headingTag:"h2"}}),te=new pe({props:{name:"class transformers.FocalNetConfig",anchor:"transformers.FocalNetConfig",parameters:[{name:"image_size",val:" = 224"},{name:"patch_size",val:" = 4"},{name:"num_channels",val:" = 3"},{name:"embed_dim",val:" = 96"},{name:"use_conv_embed",val:" = False"},{name:"hidden_sizes",val:" = [192, 384, 768, 768]"},{name:"depths",val:" = [2, 2, 6, 2]"},{name:"focal_levels",val:" = [2, 2, 2, 2]"},{name:"focal_windows",val:" = [3, 3, 3, 3]"},{name:"hidden_act",val:" = 'gelu'"},{name:"mlp_ratio",val:" = 4.0"},{name:"hidden_dropout_prob",val:" = 0.0"},{name:"drop_path_rate",val:" = 0.1"},{name:"use_layerscale",val:" = False"},{name:"layerscale_value",val:" = 0.0001"},{name:"use_post_layernorm",val:" = False"},{name:"use_post_layernorm_in_modulation",val:" = False"},{name:"normalize_modulator",val:" = False"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-05"},{name:"encoder_stride",val:" = 32"},{name:"out_features",val:" = None"},{name:"out_indices",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.FocalNetConfig.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.FocalNetConfig.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
The size (resolution) of each patch in the embeddings layer.`,name:"patch_size"},{anchor:"transformers.FocalNetConfig.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.FocalNetConfig.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.FocalNetConfig.use_conv_embed",description:`<strong>use_conv_embed</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use convolutional embedding. The authors noted that using convolutional embedding usually
improve the performance, but it&#x2019;s not used by default.`,name:"use_conv_embed"},{anchor:"transformers.FocalNetConfig.hidden_sizes",description:`<strong>hidden_sizes</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[192, 384, 768, 768]</code>) &#x2014;
Dimensionality (hidden size) at each stage.`,name:"hidden_sizes"},{anchor:"transformers.FocalNetConfig.depths",description:`<strong>depths</strong> (<code>list(int)</code>, <em>optional</em>, defaults to <code>[2, 2, 6, 2]</code>) &#x2014;
Depth (number of layers) of each stage in the encoder.`,name:"depths"},{anchor:"transformers.FocalNetConfig.focal_levels",description:`<strong>focal_levels</strong> (<code>list(int)</code>, <em>optional</em>, defaults to <code>[2, 2, 2, 2]</code>) &#x2014;
Number of focal levels in each layer of the respective stages in the encoder.`,name:"focal_levels"},{anchor:"transformers.FocalNetConfig.focal_windows",description:`<strong>focal_windows</strong> (<code>list(int)</code>, <em>optional</em>, defaults to <code>[3, 3, 3, 3]</code>) &#x2014;
Focal window size in each layer of the respective stages in the encoder.`,name:"focal_windows"},{anchor:"transformers.FocalNetConfig.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.FocalNetConfig.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.FocalNetConfig.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.FocalNetConfig.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.FocalNetConfig.use_layerscale",description:`<strong>use_layerscale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use layer scale in the encoder.`,name:"use_layerscale"},{anchor:"transformers.FocalNetConfig.layerscale_value",description:`<strong>layerscale_value</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0001) &#x2014;
The initial value of the layer scale.`,name:"layerscale_value"},{anchor:"transformers.FocalNetConfig.use_post_layernorm",description:`<strong>use_post_layernorm</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use post layer normalization in the encoder.`,name:"use_post_layernorm"},{anchor:"transformers.FocalNetConfig.use_post_layernorm_in_modulation",description:`<strong>use_post_layernorm_in_modulation</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use post layer normalization in the modulation layer.`,name:"use_post_layernorm_in_modulation"},{anchor:"transformers.FocalNetConfig.normalize_modulator",description:`<strong>normalize_modulator</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to normalize the modulator.`,name:"normalize_modulator"},{anchor:"transformers.FocalNetConfig.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.FocalNetConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-05) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.FocalNetConfig.encoder_stride",description:`<strong>encoder_stride</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
Factor to increase the spatial resolution by in the decoder head for masked image modeling.`,name:"encoder_stride"},{anchor:"transformers.FocalNetConfig.out_features",description:`<strong>out_features</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
If used as backbone, list of features to output. Can be any of <code>&quot;stem&quot;</code>, <code>&quot;stage1&quot;</code>, <code>&quot;stage2&quot;</code>, etc.
(depending on how many stages the model has). If unset and <code>out_indices</code> is set, will default to the
corresponding stages. If unset and <code>out_indices</code> is unset, will default to the last stage. Must be in the
same order as defined in the <code>stage_names</code> attribute.`,name:"out_features"},{anchor:"transformers.FocalNetConfig.out_indices",description:`<strong>out_indices</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
If used as backbone, list of indices of features to output. Can be any of 0, 1, 2, etc. (depending on how
many stages the model has). If unset and <code>out_features</code> is set, will default to the corresponding stages.
If unset and <code>out_features</code> is unset, will default to the last stage. Must be in the
same order as defined in the <code>stage_names</code> attribute.`,name:"out_indices"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/focalnet/configuration_focalnet.py#L25"}}),B=new Xe({props:{anchor:"transformers.FocalNetConfig.example",$$slots:{default:[qt]},$$scope:{ctx:$}}}),oe=new xe({props:{title:"FocalNetModel",local:"transformers.FocalNetModel",headingTag:"h2"}}),ne=new pe({props:{name:"class transformers.FocalNetModel",anchor:"transformers.FocalNetModel",parameters:[{name:"config",val:""},{name:"add_pooling_layer",val:" = True"},{name:"use_mask_token",val:" = False"}],parametersDescription:[{anchor:"transformers.FocalNetModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/focalnet#transformers.FocalNetModel">FocalNetModel</a>) &#x2014;
Model configuration class with all the parameters of the model. Initializing with a config file does not
load the weights associated with the model, only the configuration. Check out the
<a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"},{anchor:"transformers.FocalNetModel.add_pooling_layer",description:`<strong>add_pooling_layer</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to add a pooling layer`,name:"add_pooling_layer"},{anchor:"transformers.FocalNetModel.use_mask_token",description:`<strong>use_mask_token</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to use a mask token for masked image modeling.`,name:"use_mask_token"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/focalnet/modeling_focalnet.py#L634"}}),ae=new pe({props:{name:"forward",anchor:"transformers.FocalNetModel.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"bool_masked_pos",val:": typing.Optional[torch.BoolTensor] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.FocalNetModel.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, image_size, image_size)</code>, <em>optional</em>) &#x2014;
The tensors corresponding to the input images. Pixel values can be obtained using
<code>{image_processor_class}</code>. See <code>{image_processor_class}.__call__</code> for details (<code>{processor_class}</code> uses
<code>{image_processor_class}</code> for processing images).`,name:"pixel_values"},{anchor:"transformers.FocalNetModel.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"},{anchor:"transformers.FocalNetModel.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.FocalNetModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/focalnet/modeling_focalnet.py#L660",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.focalnet.modeling_focalnet.FocalNetModelOutput</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/focalnet#transformers.FocalNetConfig"
>FocalNetConfig</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>) — 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) — 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>) — 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>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>) — 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:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.focalnet.modeling_focalnet.FocalNetModelOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),E=new Ye({props:{$$slots:{default:[Qt]},$$scope:{ctx:$}}}),H=new Xe({props:{anchor:"transformers.FocalNetModel.forward.example",$$slots:{default:[At]},$$scope:{ctx:$}}}),se=new xe({props:{title:"FocalNetForMaskedImageModeling",local:"transformers.FocalNetForMaskedImageModeling",headingTag:"h2"}}),re=new pe({props:{name:"class transformers.FocalNetForMaskedImageModeling",anchor:"transformers.FocalNetForMaskedImageModeling",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.FocalNetForMaskedImageModeling.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/focalnet#transformers.FocalNetForMaskedImageModeling">FocalNetForMaskedImageModeling</a>) &#x2014;
Model configuration class with all the parameters of the model. Initializing with a config file does not
load the weights associated with the model, only the configuration. Check out the
<a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/focalnet/modeling_focalnet.py#L710"}}),P=new Ye({props:{$$slots:{default:[Dt]},$$scope:{ctx:$}}}),le=new pe({props:{name:"forward",anchor:"transformers.FocalNetForMaskedImageModeling.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"bool_masked_pos",val:": typing.Optional[torch.BoolTensor] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.FocalNetForMaskedImageModeling.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, image_size, image_size)</code>, <em>optional</em>) &#x2014;
The tensors corresponding to the input images. Pixel values can be obtained using
<code>{image_processor_class}</code>. See <code>{image_processor_class}.__call__</code> for details (<code>{processor_class}</code> uses
<code>{image_processor_class}</code> for processing images).`,name:"pixel_values"},{anchor:"transformers.FocalNetForMaskedImageModeling.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"},{anchor:"transformers.FocalNetForMaskedImageModeling.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.FocalNetForMaskedImageModeling.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/focalnet/modeling_focalnet.py#L742",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.focalnet.modeling_focalnet.FocalNetMaskedImageModelingOutput</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/focalnet#transformers.FocalNetConfig"
>FocalNetConfig</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) — Masked image modeling (MLM) loss.</p>
</li>
<li>
<p><strong>reconstruction</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) — 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>) — 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>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>) — 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:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.focalnet.modeling_focalnet.FocalNetMaskedImageModelingOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),L=new Ye({props:{$$slots:{default:[Ot]},$$scope:{ctx:$}}}),S=new Xe({props:{anchor:"transformers.FocalNetForMaskedImageModeling.forward.example",$$slots:{default:[Kt]},$$scope:{ctx:$}}}),ie=new xe({props:{title:"FocalNetForImageClassification",local:"transformers.FocalNetForImageClassification",headingTag:"h2"}}),ce=new pe({props:{name:"class transformers.FocalNetForImageClassification",anchor:"transformers.FocalNetForImageClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.FocalNetForImageClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/focalnet#transformers.FocalNetForImageClassification">FocalNetForImageClassification</a>) &#x2014;
Model configuration class with all the parameters of the model. Initializing with a config file does not
load the weights associated with the model, only the configuration. Check out the
<a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/focalnet/modeling_focalnet.py#L822"}}),de=new pe({props:{name:"forward",anchor:"transformers.FocalNetForImageClassification.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.FocalNetForImageClassification.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, image_size, image_size)</code>, <em>optional</em>) &#x2014;
The tensors corresponding to the input images. Pixel values can be obtained using
<code>{image_processor_class}</code>. See <code>{image_processor_class}.__call__</code> for details (<code>{processor_class}</code> uses
<code>{image_processor_class}</code> for processing images).`,name:"pixel_values"},{anchor:"transformers.FocalNetForImageClassification.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"},{anchor:"transformers.FocalNetForImageClassification.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.FocalNetForImageClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/focalnet/modeling_focalnet.py#L844",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.models.focalnet.modeling_focalnet.FocalNetImageClassifierOutput</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/focalnet#transformers.FocalNetConfig"
>FocalNetConfig</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) — 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>) — 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>) — 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>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>) — 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:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.models.focalnet.modeling_focalnet.FocalNetImageClassifierOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Y=new Ye({props:{$$slots:{default:[eo]},$$scope:{ctx:$}}}),X=new Xe({props:{anchor:"transformers.FocalNetForImageClassification.forward.example",$$slots:{default:[to]},$$scope:{ctx:$}}}),me=new Xt({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/focalnet.md"}}),{c(){t=m("meta"),f=r(),s=m("p"),c=r(),g(u.$$.fragment),o=r(),F=m("div"),F.innerHTML=wt,ke=r(),g(Q.$$.fragment),Ue=r(),A=m("p"),A.innerHTML=Ft,ze=r(),D=m("p"),D.textContent=vt,Ie=r(),O=m("p"),O.innerHTML=$t,Ze=r(),K=m("p"),K.innerHTML=Tt,We=r(),g(ee.$$.fragment),Je=r(),x=m("div"),g(te.$$.fragment),Qe=r(),fe=m("p"),fe.innerHTML=Nt,Ae=r(),he=m("p"),he.innerHTML=Ct,De=r(),g(B.$$.fragment),Re=r(),g(oe.$$.fragment),Ge=r(),N=m("div"),g(ne.$$.fragment),Oe=r(),ue=m("p"),ue.textContent=xt,Ke=r(),ge=m("p"),ge.innerHTML=jt,et=r(),_e=m("p"),_e.innerHTML=kt,tt=r(),U=m("div"),g(ae.$$.fragment),ot=r(),be=m("p"),be.innerHTML=Ut,nt=r(),g(E.$$.fragment),at=r(),g(H.$$.fragment),Ve=r(),g(se.$$.fragment),Be=r(),v=m("div"),g(re.$$.fragment),st=r(),Me=m("p"),Me.textContent=zt,rt=r(),ye=m("p"),ye.innerHTML=It,lt=r(),g(P.$$.fragment),it=r(),we=m("p"),we.innerHTML=Zt,ct=r(),Fe=m("p"),Fe.innerHTML=Wt,dt=r(),z=m("div"),g(le.$$.fragment),mt=r(),ve=m("p"),ve.innerHTML=Jt,pt=r(),g(L.$$.fragment),ft=r(),g(S.$$.fragment),Ee=r(),g(ie.$$.fragment),He=r(),C=m("div"),g(ce.$$.fragment),ht=r(),$e=m("p"),$e.textContent=Rt,ut=r(),Te=m("p"),Te.innerHTML=Gt,gt=r(),Ne=m("p"),Ne.innerHTML=Vt,_t=r(),I=m("div"),g(de.$$.fragment),bt=r(),Ce=m("p"),Ce.innerHTML=Bt,Mt=r(),g(Y.$$.fragment),yt=r(),g(X.$$.fragment),Pe=r(),g(me.$$.fragment),Le=r(),je=m("p"),this.h()},l(e){const n=Yt("svelte-u9bgzb",document.head);t=p(n,"META",{name:!0,content:!0}),n.forEach(a),f=l(e),s=p(e,"P",{}),V(s).forEach(a),c=l(e),_(u.$$.fragment,e),o=l(e),F=p(e,"DIV",{class:!0,"data-svelte-h":!0}),h(F)!=="svelte-13t8s2t"&&(F.innerHTML=wt),ke=l(e),_(Q.$$.fragment,e),Ue=l(e),A=p(e,"P",{"data-svelte-h":!0}),h(A)!=="svelte-84c53e"&&(A.innerHTML=Ft),ze=l(e),D=p(e,"P",{"data-svelte-h":!0}),h(D)!=="svelte-vfdo9a"&&(D.textContent=vt),Ie=l(e),O=p(e,"P",{"data-svelte-h":!0}),h(O)!=="svelte-1uz33aa"&&(O.innerHTML=$t),Ze=l(e),K=p(e,"P",{"data-svelte-h":!0}),h(K)!=="svelte-dxae3d"&&(K.innerHTML=Tt),We=l(e),_(ee.$$.fragment,e),Je=l(e),x=p(e,"DIV",{class:!0});var Z=V(x);_(te.$$.fragment,Z),Qe=l(Z),fe=p(Z,"P",{"data-svelte-h":!0}),h(fe)!=="svelte-1pfic19"&&(fe.innerHTML=Nt),Ae=l(Z),he=p(Z,"P",{"data-svelte-h":!0}),h(he)!=="svelte-o55m63"&&(he.innerHTML=Ct),De=l(Z),_(B.$$.fragment,Z),Z.forEach(a),Re=l(e),_(oe.$$.fragment,e),Ge=l(e),N=p(e,"DIV",{class:!0});var j=V(N);_(ne.$$.fragment,j),Oe=l(j),ue=p(j,"P",{"data-svelte-h":!0}),h(ue)!=="svelte-17st2w4"&&(ue.textContent=xt),Ke=l(j),ge=p(j,"P",{"data-svelte-h":!0}),h(ge)!=="svelte-6pahdo"&&(ge.innerHTML=jt),et=l(j),_e=p(j,"P",{"data-svelte-h":!0}),h(_e)!=="svelte-hswkmf"&&(_e.innerHTML=kt),tt=l(j),U=p(j,"DIV",{class:!0});var W=V(U);_(ae.$$.fragment,W),ot=l(W),be=p(W,"P",{"data-svelte-h":!0}),h(be)!=="svelte-7tya37"&&(be.innerHTML=Ut),nt=l(W),_(E.$$.fragment,W),at=l(W),_(H.$$.fragment,W),W.forEach(a),j.forEach(a),Ve=l(e),_(se.$$.fragment,e),Be=l(e),v=p(e,"DIV",{class:!0});var T=V(v);_(re.$$.fragment,T),st=l(T),Me=p(T,"P",{"data-svelte-h":!0}),h(Me)!=="svelte-1082wlw"&&(Me.textContent=zt),rt=l(T),ye=p(T,"P",{"data-svelte-h":!0}),h(ye)!=="svelte-muou64"&&(ye.innerHTML=It),lt=l(T),_(P.$$.fragment,T),it=l(T),we=p(T,"P",{"data-svelte-h":!0}),h(we)!=="svelte-6pahdo"&&(we.innerHTML=Zt),ct=l(T),Fe=p(T,"P",{"data-svelte-h":!0}),h(Fe)!=="svelte-hswkmf"&&(Fe.innerHTML=Wt),dt=l(T),z=p(T,"DIV",{class:!0});var J=V(z);_(le.$$.fragment,J),mt=l(J),ve=p(J,"P",{"data-svelte-h":!0}),h(ve)!=="svelte-zo6p8f"&&(ve.innerHTML=Jt),pt=l(J),_(L.$$.fragment,J),ft=l(J),_(S.$$.fragment,J),J.forEach(a),T.forEach(a),Ee=l(e),_(ie.$$.fragment,e),He=l(e),C=p(e,"DIV",{class:!0});var k=V(C);_(ce.$$.fragment,k),ht=l(k),$e=p(k,"P",{"data-svelte-h":!0}),h($e)!=="svelte-mhgt84"&&($e.textContent=Rt),ut=l(k),Te=p(k,"P",{"data-svelte-h":!0}),h(Te)!=="svelte-6pahdo"&&(Te.innerHTML=Gt),gt=l(k),Ne=p(k,"P",{"data-svelte-h":!0}),h(Ne)!=="svelte-hswkmf"&&(Ne.innerHTML=Vt),_t=l(k),I=p(k,"DIV",{class:!0});var R=V(I);_(de.$$.fragment,R),bt=l(R),Ce=p(R,"P",{"data-svelte-h":!0}),h(Ce)!=="svelte-3q1uz3"&&(Ce.innerHTML=Bt),Mt=l(R),_(Y.$$.fragment,R),yt=l(R),_(X.$$.fragment,R),R.forEach(a),k.forEach(a),Pe=l(e),_(me.$$.fragment,e),Le=l(e),je=p(e,"P",{}),V(je).forEach(a),this.h()},h(){G(t,"name","hf:doc:metadata"),G(t,"content",no),G(F,"class","flex flex-wrap space-x-1"),G(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,n){i(document.head,t),d(e,f,n),d(e,s,n),d(e,c,n),b(u,e,n),d(e,o,n),d(e,F,n),d(e,ke,n),b(Q,e,n),d(e,Ue,n),d(e,A,n),d(e,ze,n),d(e,D,n),d(e,Ie,n),d(e,O,n),d(e,Ze,n),d(e,K,n),d(e,We,n),b(ee,e,n),d(e,Je,n),d(e,x,n),b(te,x,null),i(x,Qe),i(x,fe),i(x,Ae),i(x,he),i(x,De),b(B,x,null),d(e,Re,n),b(oe,e,n),d(e,Ge,n),d(e,N,n),b(ne,N,null),i(N,Oe),i(N,ue),i(N,Ke),i(N,ge),i(N,et),i(N,_e),i(N,tt),i(N,U),b(ae,U,null),i(U,ot),i(U,be),i(U,nt),b(E,U,null),i(U,at),b(H,U,null),d(e,Ve,n),b(se,e,n),d(e,Be,n),d(e,v,n),b(re,v,null),i(v,st),i(v,Me),i(v,rt),i(v,ye),i(v,lt),b(P,v,null),i(v,it),i(v,we),i(v,ct),i(v,Fe),i(v,dt),i(v,z),b(le,z,null),i(z,mt),i(z,ve),i(z,pt),b(L,z,null),i(z,ft),b(S,z,null),d(e,Ee,n),b(ie,e,n),d(e,He,n),d(e,C,n),b(ce,C,null),i(C,ht),i(C,$e),i(C,ut),i(C,Te),i(C,gt),i(C,Ne),i(C,_t),i(C,I),b(de,I,null),i(I,bt),i(I,Ce),i(I,Mt),b(Y,I,null),i(I,yt),b(X,I,null),d(e,Pe,n),b(me,e,n),d(e,Le,n),d(e,je,n),Se=!0},p(e,[n]){const Z={};n&2&&(Z.$$scope={dirty:n,ctx:e}),B.$set(Z);const j={};n&2&&(j.$$scope={dirty:n,ctx:e}),E.$set(j);const W={};n&2&&(W.$$scope={dirty:n,ctx:e}),H.$set(W);const T={};n&2&&(T.$$scope={dirty:n,ctx:e}),P.$set(T);const J={};n&2&&(J.$$scope={dirty:n,ctx:e}),L.$set(J);const k={};n&2&&(k.$$scope={dirty:n,ctx:e}),S.$set(k);const R={};n&2&&(R.$$scope={dirty:n,ctx:e}),Y.$set(R);const Et={};n&2&&(Et.$$scope={dirty:n,ctx:e}),X.$set(Et)},i(e){Se||(M(u.$$.fragment,e),M(Q.$$.fragment,e),M(ee.$$.fragment,e),M(te.$$.fragment,e),M(B.$$.fragment,e),M(oe.$$.fragment,e),M(ne.$$.fragment,e),M(ae.$$.fragment,e),M(E.$$.fragment,e),M(H.$$.fragment,e),M(se.$$.fragment,e),M(re.$$.fragment,e),M(P.$$.fragment,e),M(le.$$.fragment,e),M(L.$$.fragment,e),M(S.$$.fragment,e),M(ie.$$.fragment,e),M(ce.$$.fragment,e),M(de.$$.fragment,e),M(Y.$$.fragment,e),M(X.$$.fragment,e),M(me.$$.fragment,e),Se=!0)},o(e){y(u.$$.fragment,e),y(Q.$$.fragment,e),y(ee.$$.fragment,e),y(te.$$.fragment,e),y(B.$$.fragment,e),y(oe.$$.fragment,e),y(ne.$$.fragment,e),y(ae.$$.fragment,e),y(E.$$.fragment,e),y(H.$$.fragment,e),y(se.$$.fragment,e),y(re.$$.fragment,e),y(P.$$.fragment,e),y(le.$$.fragment,e),y(L.$$.fragment,e),y(S.$$.fragment,e),y(ie.$$.fragment,e),y(ce.$$.fragment,e),y(de.$$.fragment,e),y(Y.$$.fragment,e),y(X.$$.fragment,e),y(me.$$.fragment,e),Se=!1},d(e){e&&(a(f),a(s),a(c),a(o),a(F),a(ke),a(Ue),a(A),a(ze),a(D),a(Ie),a(O),a(Ze),a(K),a(We),a(Je),a(x),a(Re),a(Ge),a(N),a(Ve),a(Be),a(v),a(Ee),a(He),a(C),a(Pe),a(Le),a(je)),a(t),w(u,e),w(Q,e),w(ee,e),w(te),w(B),w(oe,e),w(ne),w(ae),w(E),w(H),w(se,e),w(re),w(P),w(le),w(L),w(S),w(ie,e),w(ce),w(de),w(Y),w(X),w(me,e)}}}const no='{"title":"FocalNet","local":"focalnet","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"FocalNetConfig","local":"transformers.FocalNetConfig","sections":[],"depth":2},{"title":"FocalNetModel","local":"transformers.FocalNetModel","sections":[],"depth":2},{"title":"FocalNetForMaskedImageModeling","local":"transformers.FocalNetForMaskedImageModeling","sections":[],"depth":2},{"title":"FocalNetForImageClassification","local":"transformers.FocalNetForImageClassification","sections":[],"depth":2}],"depth":1}';function ao($){return Pt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ho extends Lt{constructor(t){super(),St(this,t,ao,oo,Ht,{})}}export{ho as component};
