import{S as Sn,i as Ln,s as Hn,e as s,k as f,w as $,t as a,M as Wn,c as r,d as o,m,a as i,x as D,h as n,b as d,N as Un,G as e,g as p,y,q as T,o as A,B as E,v as Kn,L as Ua}from"../../chunks/vendor-hf-doc-builder.js";import{T as On}from"../../chunks/Tip-hf-doc-builder.js";import{D as $t}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Ka}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Dt}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Wa}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Vn(P){let h,v,_,u,b;return u=new Ka({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(){h=s("p"),v=a("Example:"),_=f(),$(u.$$.fragment)},l(l){h=r(l,"P",{});var g=i(h);v=n(g,"Example:"),g.forEach(o),_=m(l),D(u.$$.fragment,l)},m(l,g){p(l,h,g),e(h,v),p(l,_,g),y(u,l,g),b=!0},p:Ua,i(l){b||(T(u.$$.fragment,l),b=!0)},o(l){A(u.$$.fragment,l),b=!1},d(l){l&&o(h),l&&o(_),E(u,l)}}}function Qn(P){let h,v,_,u,b;return{c(){h=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){h=r(l,"P",{});var g=i(h);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){p(l,h,g),e(h,v),e(h,_),e(_,u),e(h,b)},d(l){l&&o(h)}}}function Rn(P){let h,v,_,u,b;return u=new Ka({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]

feature_extractor = AutoImageProcessor.from_pretrained("shi-labs/dinat-mini-in1k-224")
model = DinatModel.from_pretrained("shi-labs/dinat-mini-in1k-224")

inputs = feature_extractor(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>feature_extractor = 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 = feature_extractor(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(){h=s("p"),v=a("Example:"),_=f(),$(u.$$.fragment)},l(l){h=r(l,"P",{});var g=i(h);v=n(g,"Example:"),g.forEach(o),_=m(l),D(u.$$.fragment,l)},m(l,g){p(l,h,g),e(h,v),p(l,_,g),y(u,l,g),b=!0},p:Ua,i(l){b||(T(u.$$.fragment,l),b=!0)},o(l){A(u.$$.fragment,l),b=!1},d(l){l&&o(h),l&&o(_),E(u,l)}}}function Bn(P){let h,v,_,u,b;return{c(){h=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){h=r(l,"P",{});var g=i(h);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){p(l,h,g),e(h,v),e(h,_),e(_,u),e(h,b)},d(l){l&&o(h)}}}function Gn(P){let h,v,_,u,b;return u=new Ka({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]

feature_extractor = AutoImageProcessor.from_pretrained("shi-labs/dinat-mini-in1k-224")
model = DinatForImageClassification.from_pretrained("shi-labs/dinat-mini-in1k-224")

inputs = feature_extractor(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>feature_extractor = 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 = feature_extractor(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(){h=s("p"),v=a("Example:"),_=f(),$(u.$$.fragment)},l(l){h=r(l,"P",{});var g=i(h);v=n(g,"Example:"),g.forEach(o),_=m(l),D(u.$$.fragment,l)},m(l,g){p(l,h,g),e(h,v),p(l,_,g),y(u,l,g),b=!0},p:Ua,i(l){b||(T(u.$$.fragment,l),b=!0)},o(l){A(u.$$.fragment,l),b=!1},d(l){l&&o(h),l&&o(_),E(u,l)}}}function Xn(P){let h,v,_,u,b,l,g,j,Zt,yt,F,V,Ye,he,eo,Je,to,Tt,Q,oo,pe,ao,no,At,R,so,je,ro,io,Et,Me,lo,Ct,qe,Ze,co,xt,ze,ho,kt,B,fe,po,Fe,fo,mo,uo,w,go,et,_o,bo,tt,vo,wo,ot,$o,Do,at,yo,To,nt,Ao,Eo,st,Co,xo,rt,ko,Po,Pt,Oe,Io,It,G,M,No,me,jo,Mo,ue,qo,zo,it,Fo,Oo,So,lt,Lo,Nt,X,Va,jt,Y,Ho,Se,Wo,Uo,Mt,z,Ko,ge,Vo,Qo,_e,Ro,Bo,qt,O,J,dt,be,Go,ct,Xo,zt,x,ve,Yo,S,Jo,Le,Zo,ea,we,ta,oa,aa,L,na,He,sa,ra,We,ia,la,da,Z,Ft,H,ee,ht,$e,ca,pt,ha,Ot,q,De,pa,ye,fa,Te,ma,ua,ga,I,Ae,_a,W,ba,Ue,va,wa,ft,$a,Da,ya,te,Ta,oe,St,U,ae,mt,Ee,Aa,ut,Ea,Lt,k,Ce,Ca,gt,xa,ka,xe,Pa,ke,Ia,Na,ja,N,Pe,Ma,K,qa,Ke,za,Fa,_t,Oa,Sa,La,ne,Ha,se,Ht;return l=new Dt({}),he=new Dt({}),be=new Dt({}),ve=new $t({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:"**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"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/dinat/configuration_dinat.py#L29"}}),Z=new Wa({props:{anchor:"transformers.DinatConfig.example",$$slots:{default:[Vn]},$$scope:{ctx:P}}}),$e=new Dt({}),De=new $t({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/v4.25.1/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/v4.25.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/dinat/modeling_dinat.py#L695"}}),Ae=new $t({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/v4.25.1/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<code>AutoImageProcessor.__call__()</code> 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/v4.25.1/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/dinat/modeling_dinat.py#L725",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/v4.25.1/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>
`}}),te=new On({props:{$$slots:{default:[Qn]},$$scope:{ctx:P}}}),oe=new Wa({props:{anchor:"transformers.DinatModel.forward.example",$$slots:{default:[Rn]},$$scope:{ctx:P}}}),Ee=new Dt({}),Ce=new $t({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/v4.25.1/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/v4.25.1/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.25.1/src/transformers/models/dinat/modeling_dinat.py#L788"}}),Pe=new $t({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/v4.25.1/en/model_doc/auto#transformers.AutoImageProcessor">AutoImageProcessor</a>. See
<code>AutoImageProcessor.__call__()</code> 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/v4.25.1/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/v4.25.1/src/transformers/models/dinat/modeling_dinat.py#L805",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/v4.25.1/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>
`}}),ne=new On({props:{$$slots:{default:[Bn]},$$scope:{ctx:P}}}),se=new Wa({props:{anchor:"transformers.DinatForImageClassification.forward.example",$$slots:{default:[Gn]},$$scope:{ctx:P}}}),{c(){h=s("meta"),v=f(),_=s("h1"),u=s("a"),b=s("span"),$(l.$$.fragment),g=f(),j=s("span"),Zt=a("Dilated Neighborhood Attention Transformer"),yt=f(),F=s("h2"),V=s("a"),Ye=s("span"),$(he.$$.fragment),eo=f(),Je=s("span"),to=a("Overview"),Tt=f(),Q=s("p"),oo=a("DiNAT was proposed in "),pe=s("a"),ao=a("Dilated Neighborhood Attention Transformer"),no=a(`
by Ali Hassani and Humphrey Shi.`),At=f(),R=s("p"),so=a("It extends "),je=s("a"),ro=a("NAT"),io=a(` by adding a Dilated Neighborhood Attention pattern to capture global context,
and shows significant performance improvements over it.`),Et=f(),Me=s("p"),lo=a("The abstract from the paper is the following:"),Ct=f(),qe=s("p"),Ze=s("em"),co=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).`),xt=f(),ze=s("p"),ho=a("Tips:"),kt=f(),B=s("ul"),fe=s("li"),po=a("One can use the "),Fe=s("a"),fo=a("AutoImageProcessor"),mo=a(" API to prepare images for the model."),uo=f(),w=s("li"),go=a("DiNAT can be used as a "),et=s("em"),_o=a("backbone"),bo=a(". When "),tt=s("code"),vo=a("output_hidden_states = True"),wo=a(`,
it will output both `),ot=s("code"),$o=a("hidden_states"),Do=a(" and "),at=s("code"),yo=a("reshaped_hidden_states"),To=a(". The "),nt=s("code"),Ao=a("reshaped_hidden_states"),Eo=a(" have a shape of "),st=s("code"),Co=a("(batch, num_channels, height, width)"),xo=a(" rather than "),rt=s("code"),ko=a("(batch_size, height, width, num_channels)"),Po=a("."),Pt=f(),Oe=s("p"),Io=a("Notes:"),It=f(),G=s("ul"),M=s("li"),No=a("DiNAT depends on "),me=s("a"),jo=a("NATTEN"),Mo=a(`\u2019s implementation of Neighborhood Attention and Dilated Neighborhood Attention.
You can install it with pre-built wheels for Linux by referring to `),ue=s("a"),qo=a("shi-labs.com/natten"),zo=a(", or build on your system by running "),it=s("code"),Fo=a("pip install natten"),Oo=a(`.
Note that the latter will likely take time to compile. NATTEN does not support Windows devices yet.`),So=f(),lt=s("li"),Lo=a("Patch size of 4 is only supported at the moment."),Nt=f(),X=s("img"),jt=f(),Y=s("small"),Ho=a(`Neighborhood Attention with different dilation values.
Taken from the `),Se=s("a"),Wo=a("original paper"),Uo=a("."),Mt=f(),z=s("p"),Ko=a("This model was contributed by "),ge=s("a"),Vo=a("Ali Hassani"),Qo=a(`.
The original code can be found `),_e=s("a"),Ro=a("here"),Bo=a("."),qt=f(),O=s("h2"),J=s("a"),dt=s("span"),$(be.$$.fragment),Go=f(),ct=s("span"),Xo=a("DinatConfig"),zt=f(),x=s("div"),$(ve.$$.fragment),Yo=f(),S=s("p"),Jo=a("This is the configuration class to store the configuration of a "),Le=s("a"),Zo=a("DinatModel"),ea=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
`),we=s("a"),ta=a("shi-labs/dinat-mini-in1k-224"),oa=a(" architecture."),aa=f(),L=s("p"),na=a("Configuration objects inherit from "),He=s("a"),sa=a("PretrainedConfig"),ra=a(` and can be used to control the model outputs. Read the
documentation from `),We=s("a"),ia=a("PretrainedConfig"),la=a(" for more information."),da=f(),$(Z.$$.fragment),Ft=f(),H=s("h2"),ee=s("a"),ht=s("span"),$($e.$$.fragment),ca=f(),pt=s("span"),ha=a("DinatModel"),Ot=f(),q=s("div"),$(De.$$.fragment),pa=f(),ye=s("p"),fa=a(`The bare Dinat Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Te=s("a"),ma=a("torch.nn.Module"),ua=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.`),ga=f(),I=s("div"),$(Ae.$$.fragment),_a=f(),W=s("p"),ba=a("The "),Ue=s("a"),va=a("DinatModel"),wa=a(" forward method, overrides the "),ft=s("code"),$a=a("__call__"),Da=a(" special method."),ya=f(),$(te.$$.fragment),Ta=f(),$(oe.$$.fragment),St=f(),U=s("h2"),ae=s("a"),mt=s("span"),$(Ee.$$.fragment),Aa=f(),ut=s("span"),Ea=a("DinatForImageClassification"),Lt=f(),k=s("div"),$(Ce.$$.fragment),Ca=f(),gt=s("p"),xa=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.`),ka=f(),xe=s("p"),Pa=a("This model is a PyTorch "),ke=s("a"),Ia=a("torch.nn.Module"),Na=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.`),ja=f(),N=s("div"),$(Pe.$$.fragment),Ma=f(),K=s("p"),qa=a("The "),Ke=s("a"),za=a("DinatForImageClassification"),Fa=a(" forward method, overrides the "),_t=s("code"),Oa=a("__call__"),Sa=a(" special method."),La=f(),$(ne.$$.fragment),Ha=f(),$(se.$$.fragment),this.h()},l(t){const c=Wn('[data-svelte="svelte-1phssyn"]',document.head);h=r(c,"META",{name:!0,content:!0}),c.forEach(o),v=m(t),_=r(t,"H1",{class:!0});var Ie=i(_);u=r(Ie,"A",{id:!0,class:!0,href:!0});var bt=i(u);b=r(bt,"SPAN",{});var vt=i(b);D(l.$$.fragment,vt),vt.forEach(o),bt.forEach(o),g=m(Ie),j=r(Ie,"SPAN",{});var wt=i(j);Zt=n(wt,"Dilated Neighborhood Attention Transformer"),wt.forEach(o),Ie.forEach(o),yt=m(t),F=r(t,"H2",{class:!0});var Ne=i(F);V=r(Ne,"A",{id:!0,class:!0,href:!0});var Qa=i(V);Ye=r(Qa,"SPAN",{});var Ra=i(Ye);D(he.$$.fragment,Ra),Ra.forEach(o),Qa.forEach(o),eo=m(Ne),Je=r(Ne,"SPAN",{});var Ba=i(Je);to=n(Ba,"Overview"),Ba.forEach(o),Ne.forEach(o),Tt=m(t),Q=r(t,"P",{});var Wt=i(Q);oo=n(Wt,"DiNAT was proposed in "),pe=r(Wt,"A",{href:!0,rel:!0});var Ga=i(pe);ao=n(Ga,"Dilated Neighborhood Attention Transformer"),Ga.forEach(o),no=n(Wt,`
by Ali Hassani and Humphrey Shi.`),Wt.forEach(o),At=m(t),R=r(t,"P",{});var Ut=i(R);so=n(Ut,"It extends "),je=r(Ut,"A",{href:!0});var Xa=i(je);ro=n(Xa,"NAT"),Xa.forEach(o),io=n(Ut,` by adding a Dilated Neighborhood Attention pattern to capture global context,
and shows significant performance improvements over it.`),Ut.forEach(o),Et=m(t),Me=r(t,"P",{});var Ya=i(Me);lo=n(Ya,"The abstract from the paper is the following:"),Ya.forEach(o),Ct=m(t),qe=r(t,"P",{});var Ja=i(qe);Ze=r(Ja,"EM",{});var Za=i(Ze);co=n(Za,`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).`),Za.forEach(o),Ja.forEach(o),xt=m(t),ze=r(t,"P",{});var en=i(ze);ho=n(en,"Tips:"),en.forEach(o),kt=m(t),B=r(t,"UL",{});var Kt=i(B);fe=r(Kt,"LI",{});var Vt=i(fe);po=n(Vt,"One can use the "),Fe=r(Vt,"A",{href:!0});var tn=i(Fe);fo=n(tn,"AutoImageProcessor"),tn.forEach(o),mo=n(Vt," API to prepare images for the model."),Vt.forEach(o),uo=m(Kt),w=r(Kt,"LI",{});var C=i(w);go=n(C,"DiNAT can be used as a "),et=r(C,"EM",{});var on=i(et);_o=n(on,"backbone"),on.forEach(o),bo=n(C,". When "),tt=r(C,"CODE",{});var an=i(tt);vo=n(an,"output_hidden_states = True"),an.forEach(o),wo=n(C,`,
it will output both `),ot=r(C,"CODE",{});var nn=i(ot);$o=n(nn,"hidden_states"),nn.forEach(o),Do=n(C," and "),at=r(C,"CODE",{});var sn=i(at);yo=n(sn,"reshaped_hidden_states"),sn.forEach(o),To=n(C,". The "),nt=r(C,"CODE",{});var rn=i(nt);Ao=n(rn,"reshaped_hidden_states"),rn.forEach(o),Eo=n(C," have a shape of "),st=r(C,"CODE",{});var ln=i(st);Co=n(ln,"(batch, num_channels, height, width)"),ln.forEach(o),xo=n(C," rather than "),rt=r(C,"CODE",{});var dn=i(rt);ko=n(dn,"(batch_size, height, width, num_channels)"),dn.forEach(o),Po=n(C,"."),C.forEach(o),Kt.forEach(o),Pt=m(t),Oe=r(t,"P",{});var cn=i(Oe);Io=n(cn,"Notes:"),cn.forEach(o),It=m(t),G=r(t,"UL",{});var Qt=i(G);M=r(Qt,"LI",{});var re=i(M);No=n(re,"DiNAT depends on "),me=r(re,"A",{href:!0,rel:!0});var hn=i(me);jo=n(hn,"NATTEN"),hn.forEach(o),Mo=n(re,`\u2019s implementation of Neighborhood Attention and Dilated Neighborhood Attention.
You can install it with pre-built wheels for Linux by referring to `),ue=r(re,"A",{href:!0,rel:!0});var pn=i(ue);qo=n(pn,"shi-labs.com/natten"),pn.forEach(o),zo=n(re,", or build on your system by running "),it=r(re,"CODE",{});var fn=i(it);Fo=n(fn,"pip install natten"),fn.forEach(o),Oo=n(re,`.
Note that the latter will likely take time to compile. NATTEN does not support Windows devices yet.`),re.forEach(o),So=m(Qt),lt=r(Qt,"LI",{});var mn=i(lt);Lo=n(mn,"Patch size of 4 is only supported at the moment."),mn.forEach(o),Qt.forEach(o),Nt=m(t),X=r(t,"IMG",{src:!0,alt:!0,width:!0}),jt=m(t),Y=r(t,"SMALL",{});var Rt=i(Y);Ho=n(Rt,`Neighborhood Attention with different dilation values.
Taken from the `),Se=r(Rt,"A",{href:!0});var un=i(Se);Wo=n(un,"original paper"),un.forEach(o),Uo=n(Rt,"."),Rt.forEach(o),Mt=m(t),z=r(t,"P",{});var Ve=i(z);Ko=n(Ve,"This model was contributed by "),ge=r(Ve,"A",{href:!0,rel:!0});var gn=i(ge);Vo=n(gn,"Ali Hassani"),gn.forEach(o),Qo=n(Ve,`.
The original code can be found `),_e=r(Ve,"A",{href:!0,rel:!0});var _n=i(_e);Ro=n(_n,"here"),_n.forEach(o),Bo=n(Ve,"."),Ve.forEach(o),qt=m(t),O=r(t,"H2",{class:!0});var Bt=i(O);J=r(Bt,"A",{id:!0,class:!0,href:!0});var bn=i(J);dt=r(bn,"SPAN",{});var vn=i(dt);D(be.$$.fragment,vn),vn.forEach(o),bn.forEach(o),Go=m(Bt),ct=r(Bt,"SPAN",{});var wn=i(ct);Xo=n(wn,"DinatConfig"),wn.forEach(o),Bt.forEach(o),zt=m(t),x=r(t,"DIV",{class:!0});var ie=i(x);D(ve.$$.fragment,ie),Yo=m(ie),S=r(ie,"P",{});var Qe=i(S);Jo=n(Qe,"This is the configuration class to store the configuration of a "),Le=r(Qe,"A",{href:!0});var $n=i(Le);Zo=n($n,"DinatModel"),$n.forEach(o),ea=n(Qe,`. 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
`),we=r(Qe,"A",{href:!0,rel:!0});var Dn=i(we);ta=n(Dn,"shi-labs/dinat-mini-in1k-224"),Dn.forEach(o),oa=n(Qe," architecture."),Qe.forEach(o),aa=m(ie),L=r(ie,"P",{});var Re=i(L);na=n(Re,"Configuration objects inherit from "),He=r(Re,"A",{href:!0});var yn=i(He);sa=n(yn,"PretrainedConfig"),yn.forEach(o),ra=n(Re,` and can be used to control the model outputs. Read the
documentation from `),We=r(Re,"A",{href:!0});var Tn=i(We);ia=n(Tn,"PretrainedConfig"),Tn.forEach(o),la=n(Re," for more information."),Re.forEach(o),da=m(ie),D(Z.$$.fragment,ie),ie.forEach(o),Ft=m(t),H=r(t,"H2",{class:!0});var Gt=i(H);ee=r(Gt,"A",{id:!0,class:!0,href:!0});var An=i(ee);ht=r(An,"SPAN",{});var En=i(ht);D($e.$$.fragment,En),En.forEach(o),An.forEach(o),ca=m(Gt),pt=r(Gt,"SPAN",{});var Cn=i(pt);ha=n(Cn,"DinatModel"),Cn.forEach(o),Gt.forEach(o),Ot=m(t),q=r(t,"DIV",{class:!0});var Be=i(q);D(De.$$.fragment,Be),pa=m(Be),ye=r(Be,"P",{});var Xt=i(ye);fa=n(Xt,`The bare Dinat Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Te=r(Xt,"A",{href:!0,rel:!0});var xn=i(Te);ma=n(xn,"torch.nn.Module"),xn.forEach(o),ua=n(Xt,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Xt.forEach(o),ga=m(Be),I=r(Be,"DIV",{class:!0});var le=i(I);D(Ae.$$.fragment,le),_a=m(le),W=r(le,"P",{});var Ge=i(W);ba=n(Ge,"The "),Ue=r(Ge,"A",{href:!0});var kn=i(Ue);va=n(kn,"DinatModel"),kn.forEach(o),wa=n(Ge," forward method, overrides the "),ft=r(Ge,"CODE",{});var Pn=i(ft);$a=n(Pn,"__call__"),Pn.forEach(o),Da=n(Ge," special method."),Ge.forEach(o),ya=m(le),D(te.$$.fragment,le),Ta=m(le),D(oe.$$.fragment,le),le.forEach(o),Be.forEach(o),St=m(t),U=r(t,"H2",{class:!0});var Yt=i(U);ae=r(Yt,"A",{id:!0,class:!0,href:!0});var In=i(ae);mt=r(In,"SPAN",{});var Nn=i(mt);D(Ee.$$.fragment,Nn),Nn.forEach(o),In.forEach(o),Aa=m(Yt),ut=r(Yt,"SPAN",{});var jn=i(ut);Ea=n(jn,"DinatForImageClassification"),jn.forEach(o),Yt.forEach(o),Lt=m(t),k=r(t,"DIV",{class:!0});var de=i(k);D(Ce.$$.fragment,de),Ca=m(de),gt=r(de,"P",{});var Mn=i(gt);xa=n(Mn,`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.`),Mn.forEach(o),ka=m(de),xe=r(de,"P",{});var Jt=i(xe);Pa=n(Jt,"This model is a PyTorch "),ke=r(Jt,"A",{href:!0,rel:!0});var qn=i(ke);Ia=n(qn,"torch.nn.Module"),qn.forEach(o),Na=n(Jt,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Jt.forEach(o),ja=m(de),N=r(de,"DIV",{class:!0});var ce=i(N);D(Pe.$$.fragment,ce),Ma=m(ce),K=r(ce,"P",{});var Xe=i(K);qa=n(Xe,"The "),Ke=r(Xe,"A",{href:!0});var zn=i(Ke);za=n(zn,"DinatForImageClassification"),zn.forEach(o),Fa=n(Xe," forward method, overrides the "),_t=r(Xe,"CODE",{});var Fn=i(_t);Oa=n(Fn,"__call__"),Fn.forEach(o),Sa=n(Xe," special method."),Xe.forEach(o),La=m(ce),D(ne.$$.fragment,ce),Ha=m(ce),D(se.$$.fragment,ce),ce.forEach(o),de.forEach(o),this.h()},h(){d(h,"name","hf:doc:metadata"),d(h,"content",JSON.stringify(Yn)),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(V,"id","overview"),d(V,"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(V,"href","#overview"),d(F,"class","relative group"),d(pe,"href","https://arxiv.org/abs/2209.15001"),d(pe,"rel","nofollow"),d(je,"href","nat"),d(Fe,"href","/docs/transformers/v4.25.1/en/model_doc/auto#transformers.AutoImageProcessor"),d(me,"href","https://github.com/SHI-Labs/NATTEN/"),d(me,"rel","nofollow"),d(ue,"href","https://shi-labs.com/natten"),d(ue,"rel","nofollow"),Un(X.src,Va="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/dilated-neighborhood-attention-pattern.jpg")||d(X,"src",Va),d(X,"alt","drawing"),d(X,"width","600"),d(Se,"href","https://arxiv.org/abs/2209.15001"),d(ge,"href","https://huggingface.co/alihassanijr"),d(ge,"rel","nofollow"),d(_e,"href","https://github.com/SHI-Labs/Neighborhood-Attention-Transformer"),d(_e,"rel","nofollow"),d(J,"id","transformers.DinatConfig"),d(J,"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(J,"href","#transformers.DinatConfig"),d(O,"class","relative group"),d(Le,"href","/docs/transformers/v4.25.1/en/model_doc/dinat#transformers.DinatModel"),d(we,"href","https://huggingface.co/shi-labs/dinat-mini-in1k-224"),d(we,"rel","nofollow"),d(He,"href","/docs/transformers/v4.25.1/en/main_classes/configuration#transformers.PretrainedConfig"),d(We,"href","/docs/transformers/v4.25.1/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(ee,"id","transformers.DinatModel"),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","#transformers.DinatModel"),d(H,"class","relative group"),d(Te,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(Te,"rel","nofollow"),d(Ue,"href","/docs/transformers/v4.25.1/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(ae,"id","transformers.DinatForImageClassification"),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.DinatForImageClassification"),d(U,"class","relative group"),d(ke,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),d(ke,"rel","nofollow"),d(Ke,"href","/docs/transformers/v4.25.1/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(t,c){e(document.head,h),p(t,v,c),p(t,_,c),e(_,u),e(u,b),y(l,b,null),e(_,g),e(_,j),e(j,Zt),p(t,yt,c),p(t,F,c),e(F,V),e(V,Ye),y(he,Ye,null),e(F,eo),e(F,Je),e(Je,to),p(t,Tt,c),p(t,Q,c),e(Q,oo),e(Q,pe),e(pe,ao),e(Q,no),p(t,At,c),p(t,R,c),e(R,so),e(R,je),e(je,ro),e(R,io),p(t,Et,c),p(t,Me,c),e(Me,lo),p(t,Ct,c),p(t,qe,c),e(qe,Ze),e(Ze,co),p(t,xt,c),p(t,ze,c),e(ze,ho),p(t,kt,c),p(t,B,c),e(B,fe),e(fe,po),e(fe,Fe),e(Fe,fo),e(fe,mo),e(B,uo),e(B,w),e(w,go),e(w,et),e(et,_o),e(w,bo),e(w,tt),e(tt,vo),e(w,wo),e(w,ot),e(ot,$o),e(w,Do),e(w,at),e(at,yo),e(w,To),e(w,nt),e(nt,Ao),e(w,Eo),e(w,st),e(st,Co),e(w,xo),e(w,rt),e(rt,ko),e(w,Po),p(t,Pt,c),p(t,Oe,c),e(Oe,Io),p(t,It,c),p(t,G,c),e(G,M),e(M,No),e(M,me),e(me,jo),e(M,Mo),e(M,ue),e(ue,qo),e(M,zo),e(M,it),e(it,Fo),e(M,Oo),e(G,So),e(G,lt),e(lt,Lo),p(t,Nt,c),p(t,X,c),p(t,jt,c),p(t,Y,c),e(Y,Ho),e(Y,Se),e(Se,Wo),e(Y,Uo),p(t,Mt,c),p(t,z,c),e(z,Ko),e(z,ge),e(ge,Vo),e(z,Qo),e(z,_e),e(_e,Ro),e(z,Bo),p(t,qt,c),p(t,O,c),e(O,J),e(J,dt),y(be,dt,null),e(O,Go),e(O,ct),e(ct,Xo),p(t,zt,c),p(t,x,c),y(ve,x,null),e(x,Yo),e(x,S),e(S,Jo),e(S,Le),e(Le,Zo),e(S,ea),e(S,we),e(we,ta),e(S,oa),e(x,aa),e(x,L),e(L,na),e(L,He),e(He,sa),e(L,ra),e(L,We),e(We,ia),e(L,la),e(x,da),y(Z,x,null),p(t,Ft,c),p(t,H,c),e(H,ee),e(ee,ht),y($e,ht,null),e(H,ca),e(H,pt),e(pt,ha),p(t,Ot,c),p(t,q,c),y(De,q,null),e(q,pa),e(q,ye),e(ye,fa),e(ye,Te),e(Te,ma),e(ye,ua),e(q,ga),e(q,I),y(Ae,I,null),e(I,_a),e(I,W),e(W,ba),e(W,Ue),e(Ue,va),e(W,wa),e(W,ft),e(ft,$a),e(W,Da),e(I,ya),y(te,I,null),e(I,Ta),y(oe,I,null),p(t,St,c),p(t,U,c),e(U,ae),e(ae,mt),y(Ee,mt,null),e(U,Aa),e(U,ut),e(ut,Ea),p(t,Lt,c),p(t,k,c),y(Ce,k,null),e(k,Ca),e(k,gt),e(gt,xa),e(k,ka),e(k,xe),e(xe,Pa),e(xe,ke),e(ke,Ia),e(xe,Na),e(k,ja),e(k,N),y(Pe,N,null),e(N,Ma),e(N,K),e(K,qa),e(K,Ke),e(Ke,za),e(K,Fa),e(K,_t),e(_t,Oa),e(K,Sa),e(N,La),y(ne,N,null),e(N,Ha),y(se,N,null),Ht=!0},p(t,[c]){const Ie={};c&2&&(Ie.$$scope={dirty:c,ctx:t}),Z.$set(Ie);const bt={};c&2&&(bt.$$scope={dirty:c,ctx:t}),te.$set(bt);const vt={};c&2&&(vt.$$scope={dirty:c,ctx:t}),oe.$set(vt);const wt={};c&2&&(wt.$$scope={dirty:c,ctx:t}),ne.$set(wt);const Ne={};c&2&&(Ne.$$scope={dirty:c,ctx:t}),se.$set(Ne)},i(t){Ht||(T(l.$$.fragment,t),T(he.$$.fragment,t),T(be.$$.fragment,t),T(ve.$$.fragment,t),T(Z.$$.fragment,t),T($e.$$.fragment,t),T(De.$$.fragment,t),T(Ae.$$.fragment,t),T(te.$$.fragment,t),T(oe.$$.fragment,t),T(Ee.$$.fragment,t),T(Ce.$$.fragment,t),T(Pe.$$.fragment,t),T(ne.$$.fragment,t),T(se.$$.fragment,t),Ht=!0)},o(t){A(l.$$.fragment,t),A(he.$$.fragment,t),A(be.$$.fragment,t),A(ve.$$.fragment,t),A(Z.$$.fragment,t),A($e.$$.fragment,t),A(De.$$.fragment,t),A(Ae.$$.fragment,t),A(te.$$.fragment,t),A(oe.$$.fragment,t),A(Ee.$$.fragment,t),A(Ce.$$.fragment,t),A(Pe.$$.fragment,t),A(ne.$$.fragment,t),A(se.$$.fragment,t),Ht=!1},d(t){o(h),t&&o(v),t&&o(_),E(l),t&&o(yt),t&&o(F),E(he),t&&o(Tt),t&&o(Q),t&&o(At),t&&o(R),t&&o(Et),t&&o(Me),t&&o(Ct),t&&o(qe),t&&o(xt),t&&o(ze),t&&o(kt),t&&o(B),t&&o(Pt),t&&o(Oe),t&&o(It),t&&o(G),t&&o(Nt),t&&o(X),t&&o(jt),t&&o(Y),t&&o(Mt),t&&o(z),t&&o(qt),t&&o(O),E(be),t&&o(zt),t&&o(x),E(ve),E(Z),t&&o(Ft),t&&o(H),E($e),t&&o(Ot),t&&o(q),E(De),E(Ae),E(te),E(oe),t&&o(St),t&&o(U),E(Ee),t&&o(Lt),t&&o(k),E(Ce),E(Pe),E(ne),E(se)}}}const Yn={local:"dilated-neighborhood-attention-transformer",sections:[{local:"overview",title:"Overview"},{local:"transformers.DinatConfig",title:"DinatConfig"},{local:"transformers.DinatModel",title:"DinatModel"},{local:"transformers.DinatForImageClassification",title:"DinatForImageClassification"}],title:"Dilated Neighborhood Attention Transformer"};function Jn(P){return Kn(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ss extends Sn{constructor(h){super();Ln(this,h,Jn,Xn,Hn,{})}}export{ss as default,Yn as metadata};
