import{S as Ts,i as As,s as Es,e as s,k as m,w,t as a,M as Cs,c as r,d as o,m as f,a as i,x as $,h as n,b as d,N as xs,G as t,g as h,y,q as D,o as T,B as A,v as ks,L as wn}from"../../chunks/vendor-hf-doc-builder.js";import{T as Ds}from"../../chunks/Tip-hf-doc-builder.js";import{D as Ft}from"../../chunks/Docstring-hf-doc-builder.js";import{C as $n}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as dt}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as vn}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";import{P as Ps}from"../../chunks/PipelineTag-hf-doc-builder.js";function Is(P){let p,v,_,u,b;return u=new $n({props:{code:`from transformers import DinatConfig, DinatModel

# Initializing a Dinat shi-labs/dinat-mini-in1k-224 style configuration
configuration = DinatConfig()

# Initializing a model (with random weights) from the shi-labs/dinat-mini-in1k-224 style configuration
model = DinatModel(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> DinatConfig, DinatModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Dinat shi-labs/dinat-mini-in1k-224 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = DinatConfig()

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

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

image_processor = AutoImageProcessor.from_pretrained("shi-labs/dinat-mini-in1k-224")
model = DinatModel.from_pretrained("shi-labs/dinat-mini-in1k-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, DinatModel
<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;shi-labs/dinat-mini-in1k-224&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = DinatModel.from_pretrained(<span class="hljs-string">&quot;shi-labs/dinat-mini-in1k-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">7</span>, <span class="hljs-number">7</span>, <span class="hljs-number">512</span>]`}}),{c(){p=s("p"),v=a("Example:"),_=m(),w(u.$$.fragment)},l(l){p=r(l,"P",{});var g=i(p);v=n(g,"Example:"),g.forEach(o),_=f(l),$(u.$$.fragment,l)},m(l,g){h(l,p,g),t(p,v),h(l,_,g),y(u,l,g),b=!0},p:wn,i(l){b||(D(u.$$.fragment,l),b=!0)},o(l){T(u.$$.fragment,l),b=!1},d(l){l&&o(p),l&&o(_),A(u,l)}}}function Ms(P){let p,v,_,u,b;return{c(){p=s("p"),v=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=s("code"),u=a("Module"),b=a(`
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(l){p=r(l,"P",{});var g=i(p);v=n(g,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=r(g,"CODE",{});var j=i(_);u=n(j,"Module"),j.forEach(o),b=n(g,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),g.forEach(o)},m(l,g){h(l,p,g),t(p,v),t(p,_),t(_,u),t(p,b)},d(l){l&&o(p)}}}function qs(P){let p,v,_,u,b;return u=new $n({props:{code:`from transformers import AutoImageProcessor, DinatForImageClassification
import torch
from datasets import load_dataset

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

image_processor = AutoImageProcessor.from_pretrained("shi-labs/dinat-mini-in1k-224")
model = DinatForImageClassification.from_pretrained("shi-labs/dinat-mini-in1k-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, DinatForImageClassification
<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;shi-labs/dinat-mini-in1k-224&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = DinatForImageClassification.from_pretrained(<span class="hljs-string">&quot;shi-labs/dinat-mini-in1k-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(){p=s("p"),v=a("Example:"),_=m(),w(u.$$.fragment)},l(l){p=r(l,"P",{});var g=i(p);v=n(g,"Example:"),g.forEach(o),_=f(l),$(u.$$.fragment,l)},m(l,g){h(l,p,g),t(p,v),h(l,_,g),y(u,l,g),b=!0},p:wn,i(l){b||(D(u.$$.fragment,l),b=!0)},o(l){T(u.$$.fragment,l),b=!1},d(l){l&&o(p),l&&o(_),A(u,l)}}}function Fs(P){let p,v,_,u,b,l,g,j,wo,zt,O,Q,ct,pe,$o,ht,yo,Ot,B,Do,ue,To,Ao,St,G,Eo,He,Co,xo,Lt,We,ko,Ht,Ue,mt,Po,Wt,Re,Io,Ut,X,ge,No,Ke,jo,Mo,qo,E,Fo,ft,zo,Oo,pt,So,Lo,ut,Ho,Wo,gt,Uo,Ro,_t,Ko,Vo,bt,Qo,Bo,vt,Go,Xo,Rt,Ve,Yo,Kt,Y,M,Jo,_e,Zo,ea,be,ta,oa,wt,aa,na,sa,$t,ra,Vt,J,yn,Qt,Z,ia,Qe,la,da,Bt,F,ca,ve,ha,ma,we,fa,pa,Gt,S,ee,yt,$e,ua,Dt,ga,Xt,Be,_a,Yt,ye,Jt,Ge,z,Xe,ba,va,De,wa,$a,Te,ya,Da,Zt,Ye,Ta,eo,L,te,Tt,Ae,Aa,At,Ea,to,x,Ee,Ca,H,xa,Je,ka,Pa,Ce,Ia,Na,ja,W,Ma,Ze,qa,Fa,et,za,Oa,Sa,oe,oo,U,ae,Et,xe,La,Ct,Ha,ao,q,ke,Wa,Pe,Ua,Ie,Ra,Ka,Va,I,Ne,Qa,R,Ba,tt,Ga,Xa,xt,Ya,Ja,Za,ne,en,se,no,K,re,kt,je,tn,Pt,on,so,k,Me,an,It,nn,sn,qe,rn,Fe,ln,dn,cn,N,ze,hn,V,mn,ot,fn,pn,Nt,un,gn,_n,ie,bn,le,ro;return l=new dt({}),pe=new dt({}),$e=new dt({}),ye=new Ps({props:{pipeline:"image-classification"}}),Ae=new dt({}),Ee=new Ft({props:{name:"class transformers.DinatConfig",anchor:"transformers.DinatConfig",parameters:[{name:"patch_size",val:" = 4"},{name:"num_channels",val:" = 3"},{name:"embed_dim",val:" = 64"},{name:"depths",val:" = [3, 4, 6, 5]"},{name:"num_heads",val:" = [2, 4, 8, 16]"},{name:"kernel_size",val:" = 7"},{name:"dilations",val:" = [[1, 8, 1], [1, 4, 1, 4], [1, 2, 1, 2, 1, 2], [1, 1, 1, 1, 1]]"},{name:"mlp_ratio",val:" = 3.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:"patch_norm",val:" = True"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-05"},{name:"layer_scale_init_value",val:" = 0.0"},{name:"out_features",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.DinatConfig.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
The size (resolution) of each patch. NOTE: Only patch size of 4 is supported at the moment.`,name:"patch_size"},{anchor:"transformers.DinatConfig.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.DinatConfig.embed_dim",description:`<strong>embed_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014;
Dimensionality of patch embedding.`,name:"embed_dim"},{anchor:"transformers.DinatConfig.depths",description:`<strong>depths</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[2, 2, 6, 2]</code>) &#x2014;
Number of layers in each level of the encoder.`,name:"depths"},{anchor:"transformers.DinatConfig.num_heads",description:`<strong>num_heads</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[3, 6, 12, 24]</code>) &#x2014;
Number of attention heads in each layer of the Transformer encoder.`,name:"num_heads"},{anchor:"transformers.DinatConfig.kernel_size",description:`<strong>kernel_size</strong> (<code>int</code>, <em>optional</em>, defaults to 7) &#x2014;
Neighborhood Attention kernel size.`,name:"kernel_size"},{anchor:"transformers.DinatConfig.dilations",description:`<strong>dilations</strong> (<code>List[List[int]]</code>, <em>optional</em>, defaults to <code>[[1, 8, 1], [1, 4, 1, 4], [1, 2, 1, 2, 1, 2], [1, 1, 1, 1, 1]]</code>) &#x2014;
Dilation value of each NA layer in the Transformer encoder.`,name:"dilations"},{anchor:"transformers.DinatConfig.mlp_ratio",description:`<strong>mlp_ratio</strong> (<code>float</code>, <em>optional</em>, defaults to 3.0) &#x2014;
Ratio of MLP hidden dimensionality to embedding dimensionality.`,name:"mlp_ratio"},{anchor:"transformers.DinatConfig.qkv_bias",description:`<strong>qkv_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not a learnable bias should be added to the queries, keys and values.`,name:"qkv_bias"},{anchor:"transformers.DinatConfig.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.DinatConfig.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.DinatConfig.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.DinatConfig.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.DinatConfig.patch_norm",description:`<strong>patch_norm</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to add layer normalization after patch embedding.`,name:"patch_norm"},{anchor:"transformers.DinatConfig.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.DinatConfig.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.DinatConfig.layer_scale_init_value",description:`<strong>layer_scale_init_value</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The initial value for the layer scale. Disabled if &lt;=0.`,name:"layer_scale_init_value"},{anchor:"transformers.DinatConfig.out_features",description:`<strong>out_features</strong> (<code>List[str]</code>, <em>optional</em>) &#x2014;
If used as backbone, list of features to output. Can be any of <code>&quot;stem&quot;</code>, <code>&quot;stage1&quot;</code>, <code>&quot;stage2&quot;</code>, etc.
(depending on how many stages the model has). Will default to the last stage if unset.`,name:"out_features"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/dinat/configuration_dinat.py#L29"}}),oe=new vn({props:{anchor:"transformers.DinatConfig.example",$$slots:{default:[Is]},$$scope:{ctx:P}}}),xe=new dt({}),ke=new Ft({props:{name:"class transformers.DinatModel",anchor:"transformers.DinatModel",parameters:[{name:"config",val:""},{name:"add_pooling_layer",val:" = True"}],parametersDescription:[{anchor:"transformers.DinatModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/dinat#transformers.DinatConfig">DinatConfig</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/dinat/modeling_dinat.py#L700"}}),Ne=new Ft({props:{name:"forward",anchor:"transformers.DinatModel.forward",parameters:[{name:"pixel_values",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.DinatModel.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/poolformer#transformers.PoolFormerFeatureExtractor.__call__">ViTImageProcessor.<strong>call</strong>()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.DinatModel.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.DinatModel.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.DinatModel.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/dinat/modeling_dinat.py#L730",returnDescription:`
<p>A <code>transformers.models.dinat.modeling_dinat.DinatModelOutput</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/dinat#transformers.DinatConfig"
>DinatConfig</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.dinat.modeling_dinat.DinatModelOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ne=new Ds({props:{$$slots:{default:[Ns]},$$scope:{ctx:P}}}),se=new vn({props:{anchor:"transformers.DinatModel.forward.example",$$slots:{default:[js]},$$scope:{ctx:P}}}),je=new dt({}),Me=new Ft({props:{name:"class transformers.DinatForImageClassification",anchor:"transformers.DinatForImageClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.DinatForImageClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/dinat#transformers.DinatConfig">DinatConfig</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/dinat/modeling_dinat.py#L792"}}),ze=new Ft({props:{name:"forward",anchor:"transformers.DinatForImageClassification.forward",parameters:[{name:"pixel_values",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.DinatForImageClassification.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) &#x2014;
Pixel values. Pixel values can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See <a href="/docs/transformers/main/en/model_doc/poolformer#transformers.PoolFormerFeatureExtractor.__call__">ViTImageProcessor.<strong>call</strong>()</a>
for details.`,name:"pixel_values"},{anchor:"transformers.DinatForImageClassification.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.DinatForImageClassification.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.DinatForImageClassification.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.DinatForImageClassification.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/dinat/modeling_dinat.py#L809",returnDescription:`
<p>A <code>transformers.models.dinat.modeling_dinat.DinatImageClassifierOutput</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/dinat#transformers.DinatConfig"
>DinatConfig</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.dinat.modeling_dinat.DinatImageClassifierOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ie=new Ds({props:{$$slots:{default:[Ms]},$$scope:{ctx:P}}}),le=new vn({props:{anchor:"transformers.DinatForImageClassification.forward.example",$$slots:{default:[qs]},$$scope:{ctx:P}}}),{c(){p=s("meta"),v=m(),_=s("h1"),u=s("a"),b=s("span"),w(l.$$.fragment),g=m(),j=s("span"),wo=a("Dilated Neighborhood Attention Transformer"),zt=m(),O=s("h2"),Q=s("a"),ct=s("span"),w(pe.$$.fragment),$o=m(),ht=s("span"),yo=a("Overview"),Ot=m(),B=s("p"),Do=a("DiNAT was proposed in "),ue=s("a"),To=a("Dilated Neighborhood Attention Transformer"),Ao=a(`
by Ali Hassani and Humphrey Shi.`),St=m(),G=s("p"),Eo=a("It extends "),He=s("a"),Co=a("NAT"),xo=a(` by adding a Dilated Neighborhood Attention pattern to capture global context,
and shows significant performance improvements over it.`),Lt=m(),We=s("p"),ko=a("The abstract from the paper is the following:"),Ht=m(),Ue=s("p"),mt=s("em"),Po=a(`Transformers are quickly becoming one of the most heavily applied deep learning architectures across modalities,
domains, and tasks. In vision, on top of ongoing efforts into plain transformers, hierarchical transformers have
also gained significant attention, thanks to their performance and easy integration into existing frameworks.
These models typically employ localized attention mechanisms, such as the sliding-window Neighborhood Attention (NA)
or Swin Transformer\u2019s Shifted Window Self Attention. While effective at reducing self attention\u2019s quadratic complexity,
local attention weakens two of the most desirable properties of self attention: long range inter-dependency modeling,
and global receptive field. In this paper, we introduce Dilated Neighborhood Attention (DiNA), a natural, flexible and
efficient extension to NA that can capture more global context and expand receptive fields exponentially at no
additional cost. NA\u2019s local attention and DiNA\u2019s sparse global attention complement each other, and therefore we
introduce Dilated Neighborhood Attention Transformer (DiNAT), a new hierarchical vision transformer built upon both.
DiNAT variants enjoy significant improvements over strong baselines such as NAT, Swin, and ConvNeXt.
Our large model is faster and ahead of its Swin counterpart by 1.5% box AP in COCO object detection,
1.3% mask AP in COCO instance segmentation, and 1.1% mIoU in ADE20K semantic segmentation.
Paired with new frameworks, our large variant is the new state of the art panoptic segmentation model on COCO (58.2 PQ)
and ADE20K (48.5 PQ), and instance segmentation model on Cityscapes (44.5 AP) and ADE20K (35.4 AP) (no extra data).
It also matches the state of the art specialized semantic segmentation models on ADE20K (58.2 mIoU),
and ranks second on Cityscapes (84.5 mIoU) (no extra data).`),Wt=m(),Re=s("p"),Io=a("Tips:"),Ut=m(),X=s("ul"),ge=s("li"),No=a("One can use the "),Ke=s("a"),jo=a("AutoImageProcessor"),Mo=a(" API to prepare images for the model."),qo=m(),E=s("li"),Fo=a("DiNAT can be used as a "),ft=s("em"),zo=a("backbone"),Oo=a(". When "),pt=s("code"),So=a("output_hidden_states = True"),Lo=a(`,
it will output both `),ut=s("code"),Ho=a("hidden_states"),Wo=a(" and "),gt=s("code"),Uo=a("reshaped_hidden_states"),Ro=a(". The "),_t=s("code"),Ko=a("reshaped_hidden_states"),Vo=a(" have a shape of "),bt=s("code"),Qo=a("(batch, num_channels, height, width)"),Bo=a(" rather than "),vt=s("code"),Go=a("(batch_size, height, width, num_channels)"),Xo=a("."),Rt=m(),Ve=s("p"),Yo=a("Notes:"),Kt=m(),Y=s("ul"),M=s("li"),Jo=a("DiNAT depends on "),_e=s("a"),Zo=a("NATTEN"),ea=a(`\u2019s implementation of Neighborhood Attention and Dilated Neighborhood Attention.
You can install it with pre-built wheels for Linux by referring to `),be=s("a"),ta=a("shi-labs.com/natten"),oa=a(", or build on your system by running "),wt=s("code"),aa=a("pip install natten"),na=a(`.
Note that the latter will likely take time to compile. NATTEN does not support Windows devices yet.`),sa=m(),$t=s("li"),ra=a("Patch size of 4 is only supported at the moment."),Vt=m(),J=s("img"),Qt=m(),Z=s("small"),ia=a(`Neighborhood Attention with different dilation values.
Taken from the `),Qe=s("a"),la=a("original paper"),da=a("."),Bt=m(),F=s("p"),ca=a("This model was contributed by "),ve=s("a"),ha=a("Ali Hassani"),ma=a(`.
The original code can be found `),we=s("a"),fa=a("here"),pa=a("."),Gt=m(),S=s("h2"),ee=s("a"),yt=s("span"),w($e.$$.fragment),ua=m(),Dt=s("span"),ga=a("Resources"),Xt=m(),Be=s("p"),_a=a("A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with DiNAT."),Yt=m(),w(ye.$$.fragment),Jt=m(),Ge=s("ul"),z=s("li"),Xe=s("a"),ba=a("DinatForImageClassification"),va=a(" is supported by this "),De=s("a"),wa=a("example script"),$a=a(" and "),Te=s("a"),ya=a("notebook"),Da=a("."),Zt=m(),Ye=s("p"),Ta=a("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."),eo=m(),L=s("h2"),te=s("a"),Tt=s("span"),w(Ae.$$.fragment),Aa=m(),At=s("span"),Ea=a("DinatConfig"),to=m(),x=s("div"),w(Ee.$$.fragment),Ca=m(),H=s("p"),xa=a("This is the configuration class to store the configuration of a "),Je=s("a"),ka=a("DinatModel"),Pa=a(`. It is used to instantiate a Dinat
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 Dinat
`),Ce=s("a"),Ia=a("shi-labs/dinat-mini-in1k-224"),Na=a(" architecture."),ja=m(),W=s("p"),Ma=a("Configuration objects inherit from "),Ze=s("a"),qa=a("PretrainedConfig"),Fa=a(` and can be used to control the model outputs. Read the
documentation from `),et=s("a"),za=a("PretrainedConfig"),Oa=a(" for more information."),Sa=m(),w(oe.$$.fragment),oo=m(),U=s("h2"),ae=s("a"),Et=s("span"),w(xe.$$.fragment),La=m(),Ct=s("span"),Ha=a("DinatModel"),ao=m(),q=s("div"),w(ke.$$.fragment),Wa=m(),Pe=s("p"),Ua=a(`The bare Dinat Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Ie=s("a"),Ra=a("torch.nn.Module"),Ka=a(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Va=m(),I=s("div"),w(Ne.$$.fragment),Qa=m(),R=s("p"),Ba=a("The "),tt=s("a"),Ga=a("DinatModel"),Xa=a(" forward method, overrides the "),xt=s("code"),Ya=a("__call__"),Ja=a(" special method."),Za=m(),w(ne.$$.fragment),en=m(),w(se.$$.fragment),no=m(),K=s("h2"),re=s("a"),kt=s("span"),w(je.$$.fragment),tn=m(),Pt=s("span"),on=a("DinatForImageClassification"),so=m(),k=s("div"),w(Me.$$.fragment),an=m(),It=s("p"),nn=a(`Dinat 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.`),sn=m(),qe=s("p"),rn=a("This model is a PyTorch "),Fe=s("a"),ln=a("torch.nn.Module"),dn=a(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),cn=m(),N=s("div"),w(ze.$$.fragment),hn=m(),V=s("p"),mn=a("The "),ot=s("a"),fn=a("DinatForImageClassification"),pn=a(" forward method, overrides the "),Nt=s("code"),un=a("__call__"),gn=a(" special method."),_n=m(),w(ie.$$.fragment),bn=m(),w(le.$$.fragment),this.h()},l(e){const c=Cs('[data-svelte="svelte-1phssyn"]',document.head);p=r(c,"META",{name:!0,content:!0}),c.forEach(o),v=f(e),_=r(e,"H1",{class:!0});var Oe=i(_);u=r(Oe,"A",{id:!0,class:!0,href:!0});var jt=i(u);b=r(jt,"SPAN",{});var Mt=i(b);$(l.$$.fragment,Mt),Mt.forEach(o),jt.forEach(o),g=f(Oe),j=r(Oe,"SPAN",{});var qt=i(j);wo=n(qt,"Dilated Neighborhood Attention Transformer"),qt.forEach(o),Oe.forEach(o),zt=f(e),O=r(e,"H2",{class:!0});var Se=i(O);Q=r(Se,"A",{id:!0,class:!0,href:!0});var Dn=i(Q);ct=r(Dn,"SPAN",{});var Tn=i(ct);$(pe.$$.fragment,Tn),Tn.forEach(o),Dn.forEach(o),$o=f(Se),ht=r(Se,"SPAN",{});var An=i(ht);yo=n(An,"Overview"),An.forEach(o),Se.forEach(o),Ot=f(e),B=r(e,"P",{});var io=i(B);Do=n(io,"DiNAT was proposed in "),ue=r(io,"A",{href:!0,rel:!0});var En=i(ue);To=n(En,"Dilated Neighborhood Attention Transformer"),En.forEach(o),Ao=n(io,`
by Ali Hassani and Humphrey Shi.`),io.forEach(o),St=f(e),G=r(e,"P",{});var lo=i(G);Eo=n(lo,"It extends "),He=r(lo,"A",{href:!0});var Cn=i(He);Co=n(Cn,"NAT"),Cn.forEach(o),xo=n(lo,` by adding a Dilated Neighborhood Attention pattern to capture global context,
and shows significant performance improvements over it.`),lo.forEach(o),Lt=f(e),We=r(e,"P",{});var xn=i(We);ko=n(xn,"The abstract from the paper is the following:"),xn.forEach(o),Ht=f(e),Ue=r(e,"P",{});var kn=i(Ue);mt=r(kn,"EM",{});var Pn=i(mt);Po=n(Pn,`Transformers are quickly becoming one of the most heavily applied deep learning architectures across modalities,
domains, and tasks. In vision, on top of ongoing efforts into plain transformers, hierarchical transformers have
also gained significant attention, thanks to their performance and easy integration into existing frameworks.
These models typically employ localized attention mechanisms, such as the sliding-window Neighborhood Attention (NA)
or Swin Transformer\u2019s Shifted Window Self Attention. While effective at reducing self attention\u2019s quadratic complexity,
local attention weakens two of the most desirable properties of self attention: long range inter-dependency modeling,
and global receptive field. In this paper, we introduce Dilated Neighborhood Attention (DiNA), a natural, flexible and
efficient extension to NA that can capture more global context and expand receptive fields exponentially at no
additional cost. NA\u2019s local attention and DiNA\u2019s sparse global attention complement each other, and therefore we
introduce Dilated Neighborhood Attention Transformer (DiNAT), a new hierarchical vision transformer built upon both.
DiNAT variants enjoy significant improvements over strong baselines such as NAT, Swin, and ConvNeXt.
Our large model is faster and ahead of its Swin counterpart by 1.5% box AP in COCO object detection,
1.3% mask AP in COCO instance segmentation, and 1.1% mIoU in ADE20K semantic segmentation.
Paired with new frameworks, our large variant is the new state of the art panoptic segmentation model on COCO (58.2 PQ)
and ADE20K (48.5 PQ), and instance segmentation model on Cityscapes (44.5 AP) and ADE20K (35.4 AP) (no extra data).
It also matches the state of the art specialized semantic segmentation models on ADE20K (58.2 mIoU),
and ranks second on Cityscapes (84.5 mIoU) (no extra data).`),Pn.forEach(o),kn.forEach(o),Wt=f(e),Re=r(e,"P",{});var In=i(Re);Io=n(In,"Tips:"),In.forEach(o),Ut=f(e),X=r(e,"UL",{});var co=i(X);ge=r(co,"LI",{});var ho=i(ge);No=n(ho,"One can use the "),Ke=r(ho,"A",{href:!0});var Nn=i(Ke);jo=n(Nn,"AutoImageProcessor"),Nn.forEach(o),Mo=n(ho," API to prepare images for the model."),ho.forEach(o),qo=f(co),E=r(co,"LI",{});var C=i(E);Fo=n(C,"DiNAT can be used as a "),ft=r(C,"EM",{});var jn=i(ft);zo=n(jn,"backbone"),jn.forEach(o),Oo=n(C,". When "),pt=r(C,"CODE",{});var Mn=i(pt);So=n(Mn,"output_hidden_states = True"),Mn.forEach(o),Lo=n(C,`,
it will output both `),ut=r(C,"CODE",{});var qn=i(ut);Ho=n(qn,"hidden_states"),qn.forEach(o),Wo=n(C," and "),gt=r(C,"CODE",{});var Fn=i(gt);Uo=n(Fn,"reshaped_hidden_states"),Fn.forEach(o),Ro=n(C,". The "),_t=r(C,"CODE",{});var zn=i(_t);Ko=n(zn,"reshaped_hidden_states"),zn.forEach(o),Vo=n(C," have a shape of "),bt=r(C,"CODE",{});var On=i(bt);Qo=n(On,"(batch, num_channels, height, width)"),On.forEach(o),Bo=n(C," rather than "),vt=r(C,"CODE",{});var Sn=i(vt);Go=n(Sn,"(batch_size, height, width, num_channels)"),Sn.forEach(o),Xo=n(C,"."),C.forEach(o),co.forEach(o),Rt=f(e),Ve=r(e,"P",{});var Ln=i(Ve);Yo=n(Ln,"Notes:"),Ln.forEach(o),Kt=f(e),Y=r(e,"UL",{});var mo=i(Y);M=r(mo,"LI",{});var de=i(M);Jo=n(de,"DiNAT depends on "),_e=r(de,"A",{href:!0,rel:!0});var Hn=i(_e);Zo=n(Hn,"NATTEN"),Hn.forEach(o),ea=n(de,`\u2019s implementation of Neighborhood Attention and Dilated Neighborhood Attention.
You can install it with pre-built wheels for Linux by referring to `),be=r(de,"A",{href:!0,rel:!0});var Wn=i(be);ta=n(Wn,"shi-labs.com/natten"),Wn.forEach(o),oa=n(de,", or build on your system by running "),wt=r(de,"CODE",{});var Un=i(wt);aa=n(Un,"pip install natten"),Un.forEach(o),na=n(de,`.
Note that the latter will likely take time to compile. NATTEN does not support Windows devices yet.`),de.forEach(o),sa=f(mo),$t=r(mo,"LI",{});var Rn=i($t);ra=n(Rn,"Patch size of 4 is only supported at the moment."),Rn.forEach(o),mo.forEach(o),Vt=f(e),J=r(e,"IMG",{src:!0,alt:!0,width:!0}),Qt=f(e),Z=r(e,"SMALL",{});var fo=i(Z);ia=n(fo,`Neighborhood Attention with different dilation values.
Taken from the `),Qe=r(fo,"A",{href:!0});var Kn=i(Qe);la=n(Kn,"original paper"),Kn.forEach(o),da=n(fo,"."),fo.forEach(o),Bt=f(e),F=r(e,"P",{});var at=i(F);ca=n(at,"This model was contributed by "),ve=r(at,"A",{href:!0,rel:!0});var Vn=i(ve);ha=n(Vn,"Ali Hassani"),Vn.forEach(o),ma=n(at,`.
The original code can be found `),we=r(at,"A",{href:!0,rel:!0});var Qn=i(we);fa=n(Qn,"here"),Qn.forEach(o),pa=n(at,"."),at.forEach(o),Gt=f(e),S=r(e,"H2",{class:!0});var po=i(S);ee=r(po,"A",{id:!0,class:!0,href:!0});var Bn=i(ee);yt=r(Bn,"SPAN",{});var Gn=i(yt);$($e.$$.fragment,Gn),Gn.forEach(o),Bn.forEach(o),ua=f(po),Dt=r(po,"SPAN",{});var Xn=i(Dt);ga=n(Xn,"Resources"),Xn.forEach(o),po.forEach(o),Xt=f(e),Be=r(e,"P",{});var Yn=i(Be);_a=n(Yn,"A list of official Hugging Face and community (indicated by \u{1F30E}) resources to help you get started with DiNAT."),Yn.forEach(o),Yt=f(e),$(ye.$$.fragment,e),Jt=f(e),Ge=r(e,"UL",{});var Jn=i(Ge);z=r(Jn,"LI",{});var Le=i(z);Xe=r(Le,"A",{href:!0});var Zn=i(Xe);ba=n(Zn,"DinatForImageClassification"),Zn.forEach(o),va=n(Le," is supported by this "),De=r(Le,"A",{href:!0,rel:!0});var es=i(De);wa=n(es,"example script"),es.forEach(o),$a=n(Le," and "),Te=r(Le,"A",{href:!0,rel:!0});var ts=i(Te);ya=n(ts,"notebook"),ts.forEach(o),Da=n(Le,"."),Le.forEach(o),Jn.forEach(o),Zt=f(e),Ye=r(e,"P",{});var os=i(Ye);Ta=n(os,"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."),os.forEach(o),eo=f(e),L=r(e,"H2",{class:!0});var uo=i(L);te=r(uo,"A",{id:!0,class:!0,href:!0});var as=i(te);Tt=r(as,"SPAN",{});var ns=i(Tt);$(Ae.$$.fragment,ns),ns.forEach(o),as.forEach(o),Aa=f(uo),At=r(uo,"SPAN",{});var ss=i(At);Ea=n(ss,"DinatConfig"),ss.forEach(o),uo.forEach(o),to=f(e),x=r(e,"DIV",{class:!0});var ce=i(x);$(Ee.$$.fragment,ce),Ca=f(ce),H=r(ce,"P",{});var nt=i(H);xa=n(nt,"This is the configuration class to store the configuration of a "),Je=r(nt,"A",{href:!0});var rs=i(Je);ka=n(rs,"DinatModel"),rs.forEach(o),Pa=n(nt,`. It is used to instantiate a Dinat
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 Dinat
`),Ce=r(nt,"A",{href:!0,rel:!0});var is=i(Ce);Ia=n(is,"shi-labs/dinat-mini-in1k-224"),is.forEach(o),Na=n(nt," architecture."),nt.forEach(o),ja=f(ce),W=r(ce,"P",{});var st=i(W);Ma=n(st,"Configuration objects inherit from "),Ze=r(st,"A",{href:!0});var ls=i(Ze);qa=n(ls,"PretrainedConfig"),ls.forEach(o),Fa=n(st,` and can be used to control the model outputs. Read the
documentation from `),et=r(st,"A",{href:!0});var ds=i(et);za=n(ds,"PretrainedConfig"),ds.forEach(o),Oa=n(st," for more information."),st.forEach(o),Sa=f(ce),$(oe.$$.fragment,ce),ce.forEach(o),oo=f(e),U=r(e,"H2",{class:!0});var go=i(U);ae=r(go,"A",{id:!0,class:!0,href:!0});var cs=i(ae);Et=r(cs,"SPAN",{});var hs=i(Et);$(xe.$$.fragment,hs),hs.forEach(o),cs.forEach(o),La=f(go),Ct=r(go,"SPAN",{});var ms=i(Ct);Ha=n(ms,"DinatModel"),ms.forEach(o),go.forEach(o),ao=f(e),q=r(e,"DIV",{class:!0});var rt=i(q);$(ke.$$.fragment,rt),Wa=f(rt),Pe=r(rt,"P",{});var _o=i(Pe);Ua=n(_o,`The bare Dinat Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Ie=r(_o,"A",{href:!0,rel:!0});var fs=i(Ie);Ra=n(fs,"torch.nn.Module"),fs.forEach(o),Ka=n(_o,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),_o.forEach(o),Va=f(rt),I=r(rt,"DIV",{class:!0});var he=i(I);$(Ne.$$.fragment,he),Qa=f(he),R=r(he,"P",{});var it=i(R);Ba=n(it,"The "),tt=r(it,"A",{href:!0});var ps=i(tt);Ga=n(ps,"DinatModel"),ps.forEach(o),Xa=n(it," forward method, overrides the "),xt=r(it,"CODE",{});var us=i(xt);Ya=n(us,"__call__"),us.forEach(o),Ja=n(it," special method."),it.forEach(o),Za=f(he),$(ne.$$.fragment,he),en=f(he),$(se.$$.fragment,he),he.forEach(o),rt.forEach(o),no=f(e),K=r(e,"H2",{class:!0});var bo=i(K);re=r(bo,"A",{id:!0,class:!0,href:!0});var gs=i(re);kt=r(gs,"SPAN",{});var _s=i(kt);$(je.$$.fragment,_s),_s.forEach(o),gs.forEach(o),tn=f(bo),Pt=r(bo,"SPAN",{});var bs=i(Pt);on=n(bs,"DinatForImageClassification"),bs.forEach(o),bo.forEach(o),so=f(e),k=r(e,"DIV",{class:!0});var me=i(k);$(Me.$$.fragment,me),an=f(me),It=r(me,"P",{});var vs=i(It);nn=n(vs,`Dinat 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.`),vs.forEach(o),sn=f(me),qe=r(me,"P",{});var vo=i(qe);rn=n(vo,"This model is a PyTorch "),Fe=r(vo,"A",{href:!0,rel:!0});var ws=i(Fe);ln=n(ws,"torch.nn.Module"),ws.forEach(o),dn=n(vo,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),vo.forEach(o),cn=f(me),N=r(me,"DIV",{class:!0});var fe=i(N);$(ze.$$.fragment,fe),hn=f(fe),V=r(fe,"P",{});var lt=i(V);mn=n(lt,"The "),ot=r(lt,"A",{href:!0});var $s=i(ot);fn=n($s,"DinatForImageClassification"),$s.forEach(o),pn=n(lt," forward method, overrides the "),Nt=r(lt,"CODE",{});var ys=i(Nt);un=n(ys,"__call__"),ys.forEach(o),gn=n(lt," special method."),lt.forEach(o),_n=f(fe),$(ie.$$.fragment,fe),bn=f(fe),$(le.$$.fragment,fe),fe.forEach(o),me.forEach(o),this.h()},h(){d(p,"name","hf:doc:metadata"),d(p,"content",JSON.stringify(zs)),d(u,"id","dilated-neighborhood-attention-transformer"),d(u,"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"),d(u,"href","#dilated-neighborhood-attention-transformer"),d(_,"class","relative group"),d(Q,"id","overview"),d(Q,"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"),d(Q,"href","#overview"),d(O,"class","relative group"),d(ue,"href","https://arxiv.org/abs/2209.15001"),d(ue,"rel","nofollow"),d(He,"href","nat"),d(Ke,"href","/docs/transformers/main/en/model_doc/auto#transformers.AutoImageProcessor"),d(_e,"href","https://github.com/SHI-Labs/NATTEN/"),d(_e,"rel","nofollow"),d(be,"href","https://shi-labs.com/natten"),d(be,"rel","nofollow"),xs(J.src,yn="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/dilated-neighborhood-attention-pattern.jpg")||d(J,"src",yn),d(J,"alt","drawing"),d(J,"width","600"),d(Qe,"href","https://arxiv.org/abs/2209.15001"),d(ve,"href","https://huggingface.co/alihassanijr"),d(ve,"rel","nofollow"),d(we,"href","https://github.com/SHI-Labs/Neighborhood-Attention-Transformer"),d(we,"rel","nofollow"),d(ee,"id","resources"),d(ee,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(ee,"href","#resources"),d(S,"class","relative group"),d(Xe,"href","/docs/transformers/main/en/model_doc/dinat#transformers.DinatForImageClassification"),d(De,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification"),d(De,"rel","nofollow"),d(Te,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb"),d(Te,"rel","nofollow"),d(te,"id","transformers.DinatConfig"),d(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"),d(te,"href","#transformers.DinatConfig"),d(L,"class","relative group"),d(Je,"href","/docs/transformers/main/en/model_doc/dinat#transformers.DinatModel"),d(Ce,"href","https://huggingface.co/shi-labs/dinat-mini-in1k-224"),d(Ce,"rel","nofollow"),d(Ze,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),d(et,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),d(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ae,"id","transformers.DinatModel"),d(ae,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(ae,"href","#transformers.DinatModel"),d(U,"class","relative group"),d(Ie,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(Ie,"rel","nofollow"),d(tt,"href","/docs/transformers/main/en/model_doc/dinat#transformers.DinatModel"),d(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(re,"id","transformers.DinatForImageClassification"),d(re,"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"),d(re,"href","#transformers.DinatForImageClassification"),d(K,"class","relative group"),d(Fe,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(Fe,"rel","nofollow"),d(ot,"href","/docs/transformers/main/en/model_doc/dinat#transformers.DinatForImageClassification"),d(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(k,"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,c){t(document.head,p),h(e,v,c),h(e,_,c),t(_,u),t(u,b),y(l,b,null),t(_,g),t(_,j),t(j,wo),h(e,zt,c),h(e,O,c),t(O,Q),t(Q,ct),y(pe,ct,null),t(O,$o),t(O,ht),t(ht,yo),h(e,Ot,c),h(e,B,c),t(B,Do),t(B,ue),t(ue,To),t(B,Ao),h(e,St,c),h(e,G,c),t(G,Eo),t(G,He),t(He,Co),t(G,xo),h(e,Lt,c),h(e,We,c),t(We,ko),h(e,Ht,c),h(e,Ue,c),t(Ue,mt),t(mt,Po),h(e,Wt,c),h(e,Re,c),t(Re,Io),h(e,Ut,c),h(e,X,c),t(X,ge),t(ge,No),t(ge,Ke),t(Ke,jo),t(ge,Mo),t(X,qo),t(X,E),t(E,Fo),t(E,ft),t(ft,zo),t(E,Oo),t(E,pt),t(pt,So),t(E,Lo),t(E,ut),t(ut,Ho),t(E,Wo),t(E,gt),t(gt,Uo),t(E,Ro),t(E,_t),t(_t,Ko),t(E,Vo),t(E,bt),t(bt,Qo),t(E,Bo),t(E,vt),t(vt,Go),t(E,Xo),h(e,Rt,c),h(e,Ve,c),t(Ve,Yo),h(e,Kt,c),h(e,Y,c),t(Y,M),t(M,Jo),t(M,_e),t(_e,Zo),t(M,ea),t(M,be),t(be,ta),t(M,oa),t(M,wt),t(wt,aa),t(M,na),t(Y,sa),t(Y,$t),t($t,ra),h(e,Vt,c),h(e,J,c),h(e,Qt,c),h(e,Z,c),t(Z,ia),t(Z,Qe),t(Qe,la),t(Z,da),h(e,Bt,c),h(e,F,c),t(F,ca),t(F,ve),t(ve,ha),t(F,ma),t(F,we),t(we,fa),t(F,pa),h(e,Gt,c),h(e,S,c),t(S,ee),t(ee,yt),y($e,yt,null),t(S,ua),t(S,Dt),t(Dt,ga),h(e,Xt,c),h(e,Be,c),t(Be,_a),h(e,Yt,c),y(ye,e,c),h(e,Jt,c),h(e,Ge,c),t(Ge,z),t(z,Xe),t(Xe,ba),t(z,va),t(z,De),t(De,wa),t(z,$a),t(z,Te),t(Te,ya),t(z,Da),h(e,Zt,c),h(e,Ye,c),t(Ye,Ta),h(e,eo,c),h(e,L,c),t(L,te),t(te,Tt),y(Ae,Tt,null),t(L,Aa),t(L,At),t(At,Ea),h(e,to,c),h(e,x,c),y(Ee,x,null),t(x,Ca),t(x,H),t(H,xa),t(H,Je),t(Je,ka),t(H,Pa),t(H,Ce),t(Ce,Ia),t(H,Na),t(x,ja),t(x,W),t(W,Ma),t(W,Ze),t(Ze,qa),t(W,Fa),t(W,et),t(et,za),t(W,Oa),t(x,Sa),y(oe,x,null),h(e,oo,c),h(e,U,c),t(U,ae),t(ae,Et),y(xe,Et,null),t(U,La),t(U,Ct),t(Ct,Ha),h(e,ao,c),h(e,q,c),y(ke,q,null),t(q,Wa),t(q,Pe),t(Pe,Ua),t(Pe,Ie),t(Ie,Ra),t(Pe,Ka),t(q,Va),t(q,I),y(Ne,I,null),t(I,Qa),t(I,R),t(R,Ba),t(R,tt),t(tt,Ga),t(R,Xa),t(R,xt),t(xt,Ya),t(R,Ja),t(I,Za),y(ne,I,null),t(I,en),y(se,I,null),h(e,no,c),h(e,K,c),t(K,re),t(re,kt),y(je,kt,null),t(K,tn),t(K,Pt),t(Pt,on),h(e,so,c),h(e,k,c),y(Me,k,null),t(k,an),t(k,It),t(It,nn),t(k,sn),t(k,qe),t(qe,rn),t(qe,Fe),t(Fe,ln),t(qe,dn),t(k,cn),t(k,N),y(ze,N,null),t(N,hn),t(N,V),t(V,mn),t(V,ot),t(ot,fn),t(V,pn),t(V,Nt),t(Nt,un),t(V,gn),t(N,_n),y(ie,N,null),t(N,bn),y(le,N,null),ro=!0},p(e,[c]){const Oe={};c&2&&(Oe.$$scope={dirty:c,ctx:e}),oe.$set(Oe);const jt={};c&2&&(jt.$$scope={dirty:c,ctx:e}),ne.$set(jt);const Mt={};c&2&&(Mt.$$scope={dirty:c,ctx:e}),se.$set(Mt);const qt={};c&2&&(qt.$$scope={dirty:c,ctx:e}),ie.$set(qt);const Se={};c&2&&(Se.$$scope={dirty:c,ctx:e}),le.$set(Se)},i(e){ro||(D(l.$$.fragment,e),D(pe.$$.fragment,e),D($e.$$.fragment,e),D(ye.$$.fragment,e),D(Ae.$$.fragment,e),D(Ee.$$.fragment,e),D(oe.$$.fragment,e),D(xe.$$.fragment,e),D(ke.$$.fragment,e),D(Ne.$$.fragment,e),D(ne.$$.fragment,e),D(se.$$.fragment,e),D(je.$$.fragment,e),D(Me.$$.fragment,e),D(ze.$$.fragment,e),D(ie.$$.fragment,e),D(le.$$.fragment,e),ro=!0)},o(e){T(l.$$.fragment,e),T(pe.$$.fragment,e),T($e.$$.fragment,e),T(ye.$$.fragment,e),T(Ae.$$.fragment,e),T(Ee.$$.fragment,e),T(oe.$$.fragment,e),T(xe.$$.fragment,e),T(ke.$$.fragment,e),T(Ne.$$.fragment,e),T(ne.$$.fragment,e),T(se.$$.fragment,e),T(je.$$.fragment,e),T(Me.$$.fragment,e),T(ze.$$.fragment,e),T(ie.$$.fragment,e),T(le.$$.fragment,e),ro=!1},d(e){o(p),e&&o(v),e&&o(_),A(l),e&&o(zt),e&&o(O),A(pe),e&&o(Ot),e&&o(B),e&&o(St),e&&o(G),e&&o(Lt),e&&o(We),e&&o(Ht),e&&o(Ue),e&&o(Wt),e&&o(Re),e&&o(Ut),e&&o(X),e&&o(Rt),e&&o(Ve),e&&o(Kt),e&&o(Y),e&&o(Vt),e&&o(J),e&&o(Qt),e&&o(Z),e&&o(Bt),e&&o(F),e&&o(Gt),e&&o(S),A($e),e&&o(Xt),e&&o(Be),e&&o(Yt),A(ye,e),e&&o(Jt),e&&o(Ge),e&&o(Zt),e&&o(Ye),e&&o(eo),e&&o(L),A(Ae),e&&o(to),e&&o(x),A(Ee),A(oe),e&&o(oo),e&&o(U),A(xe),e&&o(ao),e&&o(q),A(ke),A(Ne),A(ne),A(se),e&&o(no),e&&o(K),A(je),e&&o(so),e&&o(k),A(Me),A(ze),A(ie),A(le)}}}const zs={local:"dilated-neighborhood-attention-transformer",sections:[{local:"overview",title:"Overview"},{local:"resources",title:"Resources"},{local:"transformers.DinatConfig",title:"DinatConfig"},{local:"transformers.DinatModel",title:"DinatModel"},{local:"transformers.DinatForImageClassification",title:"DinatForImageClassification"}],title:"Dilated Neighborhood Attention Transformer"};function Os(P){return ks(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Vs extends Ts{constructor(p){super();As(this,p,Os,Fs,Es,{})}}export{Vs as default,zs as metadata};
