import{s as Ft,A as Wt,o as Ut,n as $e}from"../chunks/scheduler.01eeda35.js";import{S as Nt,i as kt,g as c,s as r,r as _,A as zt,h as m,f as n,c as l,j as me,u as b,x as p,k as W,y as h,a as o,v,d as $,t as w,w as y}from"../chunks/index.6dd51b66.js";import{T as it}from"../chunks/Tip.de9bae2b.js";import{D as ye}from"../chunks/Docstring.76e6b3cf.js";import{C as ct}from"../chunks/CodeBlock.864da1b0.js";import{E as dt}from"../chunks/ExampleCodeBlock.6a36fb6b.js";import{P as Ht}from"../chunks/PipelineTag.5efc345e.js";import{H as ve,E as Gt}from"../chunks/EditOnGithub.7faefd25.js";function At(M){let s,u="This model is in maintenance mode only, we don’t accept any new PRs changing its code.",d,i,f=`If you run into any issues running this model, please reinstall the last version that supported this model: v4.30.0.
You can do so by running the following command: <code>pip install -U transformers==4.30.0</code>.`;return{c(){s=c("p"),s.textContent=u,d=r(),i=c("p"),i.innerHTML=f},l(a){s=m(a,"P",{"data-svelte-h":!0}),p(s)!=="svelte-1dwyvn5"&&(s.textContent=u),d=l(a),i=m(a,"P",{"data-svelte-h":!0}),p(i)!=="svelte-4042uy"&&(i.innerHTML=f)},m(a,g){o(a,s,g),o(a,d,g),o(a,i,g)},p:$e,d(a){a&&(n(s),n(d),n(i))}}}function Lt(M){let s,u="Example:",d,i,f;return i=new ct({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFZhbk1vZGVsJTJDJTIwVmFuQ29uZmlnJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMFZBTiUyMHZhbi1iYXNlJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMFZhbkNvbmZpZygpJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMG1vZGVsJTIwZnJvbSUyMHRoZSUyMHZhbi1iYXNlJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBWYW5Nb2RlbChjb25maWd1cmF0aW9uKSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWc=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> VanModel, VanConfig

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a VAN van-base style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = VanConfig()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model from the van-base style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = VanModel(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(){s=c("p"),s.textContent=u,d=r(),_(i.$$.fragment)},l(a){s=m(a,"P",{"data-svelte-h":!0}),p(s)!=="svelte-11lpom8"&&(s.textContent=u),d=l(a),b(i.$$.fragment,a)},m(a,g){o(a,s,g),o(a,d,g),v(i,a,g),f=!0},p:$e,i(a){f||($(i.$$.fragment,a),f=!0)},o(a){w(i.$$.fragment,a),f=!1},d(a){a&&(n(s),n(d)),y(i,a)}}}function Pt(M){let s,u=`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(){s=c("p"),s.innerHTML=u},l(d){s=m(d,"P",{"data-svelte-h":!0}),p(s)!=="svelte-fincs2"&&(s.innerHTML=u)},m(d,i){o(d,s,i)},p:$e,d(d){d&&n(s)}}}function Rt(M){let s,u="Example:",d,i,f;return i=new ct({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFZhbk1vZGVsJTBBaW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGF0YXNldHMlMjBpbXBvcnQlMjBsb2FkX2RhdGFzZXQlMEElMEFkYXRhc2V0JTIwJTNEJTIwbG9hZF9kYXRhc2V0KCUyMmh1Z2dpbmdmYWNlJTJGY2F0cy1pbWFnZSUyMiUyQyUyMHRydXN0X3JlbW90ZV9jb2RlJTNEVHJ1ZSklMEFpbWFnZSUyMCUzRCUyMGRhdGFzZXQlNUIlMjJ0ZXN0JTIyJTVEJTVCJTIyaW1hZ2UlMjIlNUQlNUIwJTVEJTBBJTBBaW1hZ2VfcHJvY2Vzc29yJTIwJTNEJTIwQXV0b0ltYWdlUHJvY2Vzc29yLmZyb21fcHJldHJhaW5lZCglMjJWaXN1YWwtQXR0ZW50aW9uLU5ldHdvcmslMkZ2YW4tYmFzZSUyMiklMEFtb2RlbCUyMCUzRCUyMFZhbk1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJWaXN1YWwtQXR0ZW50aW9uLU5ldHdvcmslMkZ2YW4tYmFzZSUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjBpbWFnZV9wcm9jZXNzb3IoaW1hZ2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBJTBBbGFzdF9oaWRkZW5fc3RhdGVzJTIwJTNEJTIwb3V0cHV0cy5sYXN0X2hpZGRlbl9zdGF0ZSUwQWxpc3QobGFzdF9oaWRkZW5fc3RhdGVzLnNoYXBlKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, VanModel
<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;Visual-Attention-Network/van-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = VanModel.from_pretrained(<span class="hljs-string">&quot;Visual-Attention-Network/van-base&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">512</span>, <span class="hljs-number">7</span>, <span class="hljs-number">7</span>]`,wrap:!1}}),{c(){s=c("p"),s.textContent=u,d=r(),_(i.$$.fragment)},l(a){s=m(a,"P",{"data-svelte-h":!0}),p(s)!=="svelte-11lpom8"&&(s.textContent=u),d=l(a),b(i.$$.fragment,a)},m(a,g){o(a,s,g),o(a,d,g),v(i,a,g),f=!0},p:$e,i(a){f||($(i.$$.fragment,a),f=!0)},o(a){w(i.$$.fragment,a),f=!1},d(a){a&&(n(s),n(d)),y(i,a)}}}function Bt(M){let s,u=`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(){s=c("p"),s.innerHTML=u},l(d){s=m(d,"P",{"data-svelte-h":!0}),p(s)!=="svelte-fincs2"&&(s.innerHTML=u)},m(d,i){o(d,s,i)},p:$e,d(d){d&&n(s)}}}function Et(M){let s,u="Example:",d,i,f;return i=new ct({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9JbWFnZVByb2Nlc3NvciUyQyUyMFZhbkZvckltYWdlQ2xhc3NpZmljYXRpb24lMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBkYXRhc2V0cyUyMGltcG9ydCUyMGxvYWRfZGF0YXNldCUwQSUwQWRhdGFzZXQlMjAlM0QlMjBsb2FkX2RhdGFzZXQoJTIyaHVnZ2luZ2ZhY2UlMkZjYXRzLWltYWdlJTIyJTJDJTIwdHJ1c3RfcmVtb3RlX2NvZGUlM0RUcnVlKSUwQWltYWdlJTIwJTNEJTIwZGF0YXNldCU1QiUyMnRlc3QlMjIlNUQlNUIlMjJpbWFnZSUyMiU1RCU1QjAlNUQlMEElMEFpbWFnZV9wcm9jZXNzb3IlMjAlM0QlMjBBdXRvSW1hZ2VQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMlZpc3VhbC1BdHRlbnRpb24tTmV0d29yayUyRnZhbi1iYXNlJTIyKSUwQW1vZGVsJTIwJTNEJTIwVmFuRm9ySW1hZ2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyVmlzdWFsLUF0dGVudGlvbi1OZXR3b3JrJTJGdmFuLWJhc2UlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwaW1hZ2VfcHJvY2Vzc29yKGltYWdlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cyUwQSUwQSUyMyUyMG1vZGVsJTIwcHJlZGljdHMlMjBvbmUlMjBvZiUyMHRoZSUyMDEwMDAlMjBJbWFnZU5ldCUyMGNsYXNzZXMlMEFwcmVkaWN0ZWRfbGFiZWwlMjAlM0QlMjBsb2dpdHMuYXJnbWF4KC0xKS5pdGVtKCklMEFwcmludChtb2RlbC5jb25maWcuaWQybGFiZWwlNUJwcmVkaWN0ZWRfbGFiZWwlNUQp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, VanForImageClassification
<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;Visual-Attention-Network/van-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = VanForImageClassification.from_pretrained(<span class="hljs-string">&quot;Visual-Attention-Network/van-base&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`,wrap:!1}}),{c(){s=c("p"),s.textContent=u,d=r(),_(i.$$.fragment)},l(a){s=m(a,"P",{"data-svelte-h":!0}),p(s)!=="svelte-11lpom8"&&(s.textContent=u),d=l(a),b(i.$$.fragment,a)},m(a,g){o(a,s,g),o(a,d,g),v(i,a,g),f=!0},p:$e,i(a){f||($(i.$$.fragment,a),f=!0)},o(a){w(i.$$.fragment,a),f=!1},d(a){a&&(n(s),n(d)),y(i,a)}}}function Xt(M){let s,u,d,i,f,a,g,mt='<img alt="PyTorch" src="https://img.shields.io/badge/PyTorch-DE3412?style=flat&amp;logo=pytorch&amp;logoColor=white"/>',Me,N,Te,L,Ve,P,pt='The VAN model was proposed in <a href="https://arxiv.org/abs/2202.09741" rel="nofollow">Visual Attention Network</a> by Meng-Hao Guo, Cheng-Ze Lu, Zheng-Ning Liu, Ming-Ming Cheng, Shi-Min Hu.',Ce,R,ft="This paper introduces a new attention layer based on convolution operations able to capture both local and distant relationships. This is done by combining normal and large kernel convolution layers. The latter uses a dilated convolution to capture distant correlations.",xe,B,gt="The abstract from the paper is the following:",je,E,ht='<em>While originally designed for natural language processing tasks, the self-attention mechanism has recently taken various computer vision areas by storm. However, the 2D nature of images brings three challenges for applying self-attention in computer vision. (1) Treating images as 1D sequences neglects their 2D structures. (2) The quadratic complexity is too expensive for high-resolution images. (3) It only captures spatial adaptability but ignores channel adaptability. In this paper, we propose a novel large kernel attention (LKA) module to enable self-adaptive and long-range correlations in self-attention while avoiding the above issues. We further introduce a novel neural network based on LKA, namely Visual Attention Network (VAN). While extremely simple, VAN outperforms the state-of-the-art vision transformers and convolutional neural networks with a large margin in extensive experiments, including image classification, object detection, semantic segmentation, instance segmentation, etc. Code is available at <a href="https://github.com/Visual-Attention-Network/VAN-Classification" rel="nofollow">this https URL</a>.</em>',Je,X,ut="Tips:",Ie,Y,_t="<li>VAN does not have an embedding layer, thus the <code>hidden_states</code> will have a length equal to the number of stages.</li>",Ze,Q,bt='The figure below illustrates the architecture of a Visual Attention Layer. Taken from the <a href="https://arxiv.org/abs/2202.09741" rel="nofollow">original paper</a>.',Fe,S,vt,We,q,$t='This model was contributed by <a href="https://huggingface.co/Francesco" rel="nofollow">Francesco</a>. The original code can be found <a href="https://github.com/Visual-Attention-Network/VAN-Classification" rel="nofollow">here</a>.',Ue,D,Ne,O,wt="A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with VAN.",ke,K,ze,ee,yt='<li><a href="/docs/transformers/main/en/model_doc/van#transformers.VanForImageClassification">VanForImageClassification</a> is supported by this <a href="https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification" rel="nofollow">example script</a> and <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb" rel="nofollow">notebook</a>.</li> <li>See also: <a href="../tasks/image_classification">Image classification task guide</a></li>',He,te,Mt="If you’re interested in submitting a resource to be included here, please feel free to open a Pull Request and we’ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.",Ge,ne,Ae,T,ae,Qe,pe,Tt=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/van#transformers.VanModel">VanModel</a>. It is used to instantiate a VAN 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 VAN
<a href="https://huggingface.co/Visual-Attention-Network/van-base" rel="nofollow">Visual-Attention-Network/van-base</a> architecture.`,Se,fe,Vt=`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.`,qe,k,Le,se,Pe,j,oe,De,ge,Ct=`The bare VAN model outputting raw features without any specific head on top. Note, VAN does not have an embedding layer.
This model is 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.`,Oe,C,re,Ke,he,xt='The <a href="/docs/transformers/main/en/model_doc/van#transformers.VanModel">VanModel</a> forward method, overrides the <code>__call__</code> special method.',et,z,tt,H,Re,le,Be,V,ie,nt,ue,jt=`VAN Model with an image classification head on top (a linear layer on top of the pooled features), e.g. for
ImageNet.`,at,_e,Jt=`This model is 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.`,st,x,de,ot,be,It='The <a href="/docs/transformers/main/en/model_doc/van#transformers.VanForImageClassification">VanForImageClassification</a> forward method, overrides the <code>__call__</code> special method.',rt,G,lt,A,Ee,ce,Xe,we,Ye;return f=new ve({props:{title:"VAN",local:"van",headingTag:"h1"}}),N=new it({props:{warning:!0,$$slots:{default:[At]},$$scope:{ctx:M}}}),L=new ve({props:{title:"Overview",local:"overview",headingTag:"h2"}}),D=new ve({props:{title:"Resources",local:"resources",headingTag:"h2"}}),K=new Ht({props:{pipeline:"image-classification"}}),ne=new ve({props:{title:"VanConfig",local:"transformers.VanConfig",headingTag:"h2"}}),ae=new ye({props:{name:"class transformers.VanConfig",anchor:"transformers.VanConfig",parameters:[{name:"image_size",val:" = 224"},{name:"num_channels",val:" = 3"},{name:"patch_sizes",val:" = [7, 3, 3, 3]"},{name:"strides",val:" = [4, 2, 2, 2]"},{name:"hidden_sizes",val:" = [64, 128, 320, 512]"},{name:"depths",val:" = [3, 3, 12, 3]"},{name:"mlp_ratios",val:" = [8, 8, 4, 4]"},{name:"hidden_act",val:" = 'gelu'"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-06"},{name:"layer_scale_init_value",val:" = 0.01"},{name:"drop_path_rate",val:" = 0.0"},{name:"dropout_rate",val:" = 0.0"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.VanConfig.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.VanConfig.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.VanConfig.patch_sizes",description:`<strong>patch_sizes</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[7, 3, 3, 3]</code>) &#x2014;
Patch size to use in each stage&#x2019;s embedding layer.`,name:"patch_sizes"},{anchor:"transformers.VanConfig.strides",description:`<strong>strides</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[4, 2, 2, 2]</code>) &#x2014;
Stride size to use in each stage&#x2019;s embedding layer to downsample the input.`,name:"strides"},{anchor:"transformers.VanConfig.hidden_sizes",description:`<strong>hidden_sizes</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[64, 128, 320, 512]</code>) &#x2014;
Dimensionality (hidden size) at each stage.`,name:"hidden_sizes"},{anchor:"transformers.VanConfig.depths",description:`<strong>depths</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[3, 3, 12, 3]</code>) &#x2014;
Depth (number of layers) for each stage.`,name:"depths"},{anchor:"transformers.VanConfig.mlp_ratios",description:`<strong>mlp_ratios</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[8, 8, 4, 4]</code>) &#x2014;
The expansion ratio for mlp layer at each stage.`,name:"mlp_ratios"},{anchor:"transformers.VanConfig.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 each layer. 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.VanConfig.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.VanConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-06) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.VanConfig.layer_scale_init_value",description:`<strong>layer_scale_init_value</strong> (<code>float</code>, <em>optional</em>, defaults to 0.01) &#x2014;
The initial value for layer scaling.`,name:"layer_scale_init_value"},{anchor:"transformers.VanConfig.drop_path_rate",description:`<strong>drop_path_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout probability for stochastic depth.`,name:"drop_path_rate"},{anchor:"transformers.VanConfig.dropout_rate",description:`<strong>dropout_rate</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout probability for dropout.`,name:"dropout_rate"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/deprecated/van/configuration_van.py#L24"}}),k=new dt({props:{anchor:"transformers.VanConfig.example",$$slots:{default:[Lt]},$$scope:{ctx:M}}}),se=new ve({props:{title:"VanModel",local:"transformers.VanModel",headingTag:"h2"}}),oe=new ye({props:{name:"class transformers.VanModel",anchor:"transformers.VanModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.VanModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/van#transformers.VanConfig">VanConfig</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/deprecated/van/modeling_van.py#L409"}}),re=new ye({props:{name:"forward",anchor:"transformers.VanModel.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.FloatTensor]"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.VanModel.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/main/en/model_doc/vilt#transformers.ViltFeatureExtractor.__call__">ConvNextImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.VanModel.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 stages. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.VanModel.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/deprecated/van/modeling_van.py#L424",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.modeling_outputs.BaseModelOutputWithPoolingAndNoAttention</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/van#transformers.VanConfig"
>VanConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</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>) — Last layer hidden-state after a pooling operation on the spatial dimensions.</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, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, num_channels, height, width)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.modeling_outputs.BaseModelOutputWithPoolingAndNoAttention</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),z=new it({props:{$$slots:{default:[Pt]},$$scope:{ctx:M}}}),H=new dt({props:{anchor:"transformers.VanModel.forward.example",$$slots:{default:[Rt]},$$scope:{ctx:M}}}),le=new ve({props:{title:"VanForImageClassification",local:"transformers.VanForImageClassification",headingTag:"h2"}}),ie=new ye({props:{name:"class transformers.VanForImageClassification",anchor:"transformers.VanForImageClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.VanForImageClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/van#transformers.VanConfig">VanConfig</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/deprecated/van/modeling_van.py#L462"}}),de=new ye({props:{name:"forward",anchor:"transformers.VanForImageClassification.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.VanForImageClassification.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<a href="/docs/transformers/main/en/model_doc/vilt#transformers.ViltFeatureExtractor.__call__">ConvNextImageProcessor.<strong>call</strong>()</a> for details.`,name:"pixel_values"},{anchor:"transformers.VanForImageClassification.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 stages. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.VanForImageClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.VanForImageClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the image classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/deprecated/van/modeling_van.py#L481",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutputWithNoAttention"
>transformers.modeling_outputs.ImageClassifierOutputWithNoAttention</a> 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/van#transformers.VanConfig"
>VanConfig</a>) and inputs.</p>
<ul>
<li><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.</li>
<li><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).</li>
<li><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, if the model has an embedding layer, +
one for the output of each stage) of shape <code>(batch_size, num_channels, height, width)</code>. Hidden-states (also
called feature maps) of the model at the output of each stage.</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.ImageClassifierOutputWithNoAttention"
>transformers.modeling_outputs.ImageClassifierOutputWithNoAttention</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),G=new it({props:{$$slots:{default:[Bt]},$$scope:{ctx:M}}}),A=new dt({props:{anchor:"transformers.VanForImageClassification.forward.example",$$slots:{default:[Et]},$$scope:{ctx:M}}}),ce=new Gt({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/van.md"}}),{c(){s=c("meta"),u=r(),d=c("p"),i=r(),_(f.$$.fragment),a=r(),g=c("div"),g.innerHTML=mt,Me=r(),_(N.$$.fragment),Te=r(),_(L.$$.fragment),Ve=r(),P=c("p"),P.innerHTML=pt,Ce=r(),R=c("p"),R.textContent=ft,xe=r(),B=c("p"),B.textContent=gt,je=r(),E=c("p"),E.innerHTML=ht,Je=r(),X=c("p"),X.textContent=ut,Ie=r(),Y=c("ul"),Y.innerHTML=_t,Ze=r(),Q=c("p"),Q.innerHTML=bt,Fe=r(),S=c("img"),We=r(),q=c("p"),q.innerHTML=$t,Ue=r(),_(D.$$.fragment),Ne=r(),O=c("p"),O.textContent=wt,ke=r(),_(K.$$.fragment),ze=r(),ee=c("ul"),ee.innerHTML=yt,He=r(),te=c("p"),te.textContent=Mt,Ge=r(),_(ne.$$.fragment),Ae=r(),T=c("div"),_(ae.$$.fragment),Qe=r(),pe=c("p"),pe.innerHTML=Tt,Se=r(),fe=c("p"),fe.innerHTML=Vt,qe=r(),_(k.$$.fragment),Le=r(),_(se.$$.fragment),Pe=r(),j=c("div"),_(oe.$$.fragment),De=r(),ge=c("p"),ge.innerHTML=Ct,Oe=r(),C=c("div"),_(re.$$.fragment),Ke=r(),he=c("p"),he.innerHTML=xt,et=r(),_(z.$$.fragment),tt=r(),_(H.$$.fragment),Re=r(),_(le.$$.fragment),Be=r(),V=c("div"),_(ie.$$.fragment),nt=r(),ue=c("p"),ue.textContent=jt,at=r(),_e=c("p"),_e.innerHTML=Jt,st=r(),x=c("div"),_(de.$$.fragment),ot=r(),be=c("p"),be.innerHTML=It,rt=r(),_(G.$$.fragment),lt=r(),_(A.$$.fragment),Ee=r(),_(ce.$$.fragment),Xe=r(),we=c("p"),this.h()},l(e){const t=zt("svelte-u9bgzb",document.head);s=m(t,"META",{name:!0,content:!0}),t.forEach(n),u=l(e),d=m(e,"P",{}),me(d).forEach(n),i=l(e),b(f.$$.fragment,e),a=l(e),g=m(e,"DIV",{class:!0,"data-svelte-h":!0}),p(g)!=="svelte-13t8s2t"&&(g.innerHTML=mt),Me=l(e),b(N.$$.fragment,e),Te=l(e),b(L.$$.fragment,e),Ve=l(e),P=m(e,"P",{"data-svelte-h":!0}),p(P)!=="svelte-19tgy2r"&&(P.innerHTML=pt),Ce=l(e),R=m(e,"P",{"data-svelte-h":!0}),p(R)!=="svelte-1k14mfv"&&(R.textContent=ft),xe=l(e),B=m(e,"P",{"data-svelte-h":!0}),p(B)!=="svelte-vfdo9a"&&(B.textContent=gt),je=l(e),E=m(e,"P",{"data-svelte-h":!0}),p(E)!=="svelte-eh9hlc"&&(E.innerHTML=ht),Je=l(e),X=m(e,"P",{"data-svelte-h":!0}),p(X)!=="svelte-axv494"&&(X.textContent=ut),Ie=l(e),Y=m(e,"UL",{"data-svelte-h":!0}),p(Y)!=="svelte-159tyma"&&(Y.innerHTML=_t),Ze=l(e),Q=m(e,"P",{"data-svelte-h":!0}),p(Q)!=="svelte-zo4dsx"&&(Q.innerHTML=bt),Fe=l(e),S=m(e,"IMG",{width:!0,src:!0}),We=l(e),q=m(e,"P",{"data-svelte-h":!0}),p(q)!=="svelte-10esb2x"&&(q.innerHTML=$t),Ue=l(e),b(D.$$.fragment,e),Ne=l(e),O=m(e,"P",{"data-svelte-h":!0}),p(O)!=="svelte-1gzppm8"&&(O.textContent=wt),ke=l(e),b(K.$$.fragment,e),ze=l(e),ee=m(e,"UL",{"data-svelte-h":!0}),p(ee)!=="svelte-11iwm6a"&&(ee.innerHTML=yt),He=l(e),te=m(e,"P",{"data-svelte-h":!0}),p(te)!=="svelte-1xesile"&&(te.textContent=Mt),Ge=l(e),b(ne.$$.fragment,e),Ae=l(e),T=m(e,"DIV",{class:!0});var J=me(T);b(ae.$$.fragment,J),Qe=l(J),pe=m(J,"P",{"data-svelte-h":!0}),p(pe)!=="svelte-1nc1yro"&&(pe.innerHTML=Tt),Se=l(J),fe=m(J,"P",{"data-svelte-h":!0}),p(fe)!=="svelte-o55m63"&&(fe.innerHTML=Vt),qe=l(J),b(k.$$.fragment,J),J.forEach(n),Le=l(e),b(se.$$.fragment,e),Pe=l(e),j=m(e,"DIV",{class:!0});var U=me(j);b(oe.$$.fragment,U),De=l(U),ge=m(U,"P",{"data-svelte-h":!0}),p(ge)!=="svelte-16mr62j"&&(ge.innerHTML=Ct),Oe=l(U),C=m(U,"DIV",{class:!0});var I=me(C);b(re.$$.fragment,I),Ke=l(I),he=m(I,"P",{"data-svelte-h":!0}),p(he)!=="svelte-1rzddh6"&&(he.innerHTML=xt),et=l(I),b(z.$$.fragment,I),tt=l(I),b(H.$$.fragment,I),I.forEach(n),U.forEach(n),Re=l(e),b(le.$$.fragment,e),Be=l(e),V=m(e,"DIV",{class:!0});var Z=me(V);b(ie.$$.fragment,Z),nt=l(Z),ue=m(Z,"P",{"data-svelte-h":!0}),p(ue)!=="svelte-lxjyb1"&&(ue.textContent=jt),at=l(Z),_e=m(Z,"P",{"data-svelte-h":!0}),p(_e)!=="svelte-1gjh92c"&&(_e.innerHTML=Jt),st=l(Z),x=m(Z,"DIV",{class:!0});var F=me(x);b(de.$$.fragment,F),ot=l(F),be=m(F,"P",{"data-svelte-h":!0}),p(be)!=="svelte-14chz9u"&&(be.innerHTML=It),rt=l(F),b(G.$$.fragment,F),lt=l(F),b(A.$$.fragment,F),F.forEach(n),Z.forEach(n),Ee=l(e),b(ce.$$.fragment,e),Xe=l(e),we=m(e,"P",{}),me(we).forEach(n),this.h()},h(){W(s,"name","hf:doc:metadata"),W(s,"content",Yt),W(g,"class","flex flex-wrap space-x-1"),W(S,"width","600"),Wt(S.src,vt="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/van_architecture.png")||W(S,"src",vt),W(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(V,"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,t){h(document.head,s),o(e,u,t),o(e,d,t),o(e,i,t),v(f,e,t),o(e,a,t),o(e,g,t),o(e,Me,t),v(N,e,t),o(e,Te,t),v(L,e,t),o(e,Ve,t),o(e,P,t),o(e,Ce,t),o(e,R,t),o(e,xe,t),o(e,B,t),o(e,je,t),o(e,E,t),o(e,Je,t),o(e,X,t),o(e,Ie,t),o(e,Y,t),o(e,Ze,t),o(e,Q,t),o(e,Fe,t),o(e,S,t),o(e,We,t),o(e,q,t),o(e,Ue,t),v(D,e,t),o(e,Ne,t),o(e,O,t),o(e,ke,t),v(K,e,t),o(e,ze,t),o(e,ee,t),o(e,He,t),o(e,te,t),o(e,Ge,t),v(ne,e,t),o(e,Ae,t),o(e,T,t),v(ae,T,null),h(T,Qe),h(T,pe),h(T,Se),h(T,fe),h(T,qe),v(k,T,null),o(e,Le,t),v(se,e,t),o(e,Pe,t),o(e,j,t),v(oe,j,null),h(j,De),h(j,ge),h(j,Oe),h(j,C),v(re,C,null),h(C,Ke),h(C,he),h(C,et),v(z,C,null),h(C,tt),v(H,C,null),o(e,Re,t),v(le,e,t),o(e,Be,t),o(e,V,t),v(ie,V,null),h(V,nt),h(V,ue),h(V,at),h(V,_e),h(V,st),h(V,x),v(de,x,null),h(x,ot),h(x,be),h(x,rt),v(G,x,null),h(x,lt),v(A,x,null),o(e,Ee,t),v(ce,e,t),o(e,Xe,t),o(e,we,t),Ye=!0},p(e,[t]){const J={};t&2&&(J.$$scope={dirty:t,ctx:e}),N.$set(J);const U={};t&2&&(U.$$scope={dirty:t,ctx:e}),k.$set(U);const I={};t&2&&(I.$$scope={dirty:t,ctx:e}),z.$set(I);const Z={};t&2&&(Z.$$scope={dirty:t,ctx:e}),H.$set(Z);const F={};t&2&&(F.$$scope={dirty:t,ctx:e}),G.$set(F);const Zt={};t&2&&(Zt.$$scope={dirty:t,ctx:e}),A.$set(Zt)},i(e){Ye||($(f.$$.fragment,e),$(N.$$.fragment,e),$(L.$$.fragment,e),$(D.$$.fragment,e),$(K.$$.fragment,e),$(ne.$$.fragment,e),$(ae.$$.fragment,e),$(k.$$.fragment,e),$(se.$$.fragment,e),$(oe.$$.fragment,e),$(re.$$.fragment,e),$(z.$$.fragment,e),$(H.$$.fragment,e),$(le.$$.fragment,e),$(ie.$$.fragment,e),$(de.$$.fragment,e),$(G.$$.fragment,e),$(A.$$.fragment,e),$(ce.$$.fragment,e),Ye=!0)},o(e){w(f.$$.fragment,e),w(N.$$.fragment,e),w(L.$$.fragment,e),w(D.$$.fragment,e),w(K.$$.fragment,e),w(ne.$$.fragment,e),w(ae.$$.fragment,e),w(k.$$.fragment,e),w(se.$$.fragment,e),w(oe.$$.fragment,e),w(re.$$.fragment,e),w(z.$$.fragment,e),w(H.$$.fragment,e),w(le.$$.fragment,e),w(ie.$$.fragment,e),w(de.$$.fragment,e),w(G.$$.fragment,e),w(A.$$.fragment,e),w(ce.$$.fragment,e),Ye=!1},d(e){e&&(n(u),n(d),n(i),n(a),n(g),n(Me),n(Te),n(Ve),n(P),n(Ce),n(R),n(xe),n(B),n(je),n(E),n(Je),n(X),n(Ie),n(Y),n(Ze),n(Q),n(Fe),n(S),n(We),n(q),n(Ue),n(Ne),n(O),n(ke),n(ze),n(ee),n(He),n(te),n(Ge),n(Ae),n(T),n(Le),n(Pe),n(j),n(Re),n(Be),n(V),n(Ee),n(Xe),n(we)),n(s),y(f,e),y(N,e),y(L,e),y(D,e),y(K,e),y(ne,e),y(ae),y(k),y(se,e),y(oe),y(re),y(z),y(H),y(le,e),y(ie),y(de),y(G),y(A),y(ce,e)}}}const Yt='{"title":"VAN","local":"van","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Resources","local":"resources","sections":[],"depth":2},{"title":"VanConfig","local":"transformers.VanConfig","sections":[],"depth":2},{"title":"VanModel","local":"transformers.VanModel","sections":[],"depth":2},{"title":"VanForImageClassification","local":"transformers.VanForImageClassification","sections":[],"depth":2}],"depth":1}';function Qt(M){return Ut(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class an extends Nt{constructor(s){super(),kt(this,s,Qt,Xt,Ft,{})}}export{an as component};
