import{s as Kt,z as eo,o as to,n as Ne}from"../chunks/scheduler.18a86fab.js";import{S as oo,i as no,g as d,s as n,r as u,A as so,h as c,f as o,c as s,j as P,u as h,x as S,k as R,y as l,a as i,v as f,d as g,t as _,w}from"../chunks/index.98837b22.js";import{T as Qt}from"../chunks/Tip.77304350.js";import{D as W}from"../chunks/Docstring.6758ea23.js";import{C as Ct}from"../chunks/CodeBlock.8d0c2e8a.js";import{E as It}from"../chunks/ExampleCodeBlock.0c42463f.js";import{H as G}from"../chunks/Heading.7e7e0c5b.js";import{E as ro}from"../chunks/index.92f616ba.js";function ao(x){let r,y="Example:",m,p,b;return p=new Ct({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFN3aW4yU1JDb25maWclMkMlMjBTd2luMlNSTW9kZWwlMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwU3dpbjJTUiUyMGNhaWRhcyUyRnN3aW4yc3ItY2xhc3NpY2Fsc3IteDItNjQlMjBzdHlsZSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwU3dpbjJTUkNvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMG1vZGVsJTIwKHdpdGglMjByYW5kb20lMjB3ZWlnaHRzKSUyMGZyb20lMjB0aGUlMjBjYWlkYXMlMkZzd2luMnNyLWNsYXNzaWNhbHNyLXgyLTY0JTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBTd2luMlNSTW9kZWwoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Swin2SRConfig, Swin2SRModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a Swin2SR caidas/swin2sr-classicalsr-x2-64 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = Swin2SRConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the caidas/swin2sr-classicalsr-x2-64 style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Swin2SRModel(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`,wrap:!1}}),{c(){r=d("p"),r.textContent=y,m=n(),u(p.$$.fragment)},l(a){r=c(a,"P",{"data-svelte-h":!0}),S(r)!=="svelte-11lpom8"&&(r.textContent=y),m=s(a),h(p.$$.fragment,a)},m(a,v){i(a,r,v),i(a,m,v),f(p,a,v),b=!0},p:Ne,i(a){b||(g(p.$$.fragment,a),b=!0)},o(a){_(p.$$.fragment,a),b=!1},d(a){a&&(o(r),o(m)),w(p,a)}}}function io(x){let r,y=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){r=d("p"),r.innerHTML=y},l(m){r=c(m,"P",{"data-svelte-h":!0}),S(r)!=="svelte-fincs2"&&(r.innerHTML=y)},m(m,p){i(m,r,p)},p:Ne,d(m){m&&o(r)}}}function lo(x){let r,y="Example:",m,p,b;return p=new Ct({props:{code:"",highlighted:"",wrap:!1}}),{c(){r=d("p"),r.textContent=y,m=n(),u(p.$$.fragment)},l(a){r=c(a,"P",{"data-svelte-h":!0}),S(r)!=="svelte-11lpom8"&&(r.textContent=y),m=s(a),h(p.$$.fragment,a)},m(a,v){i(a,r,v),i(a,m,v),f(p,a,v),b=!0},p:Ne,i(a){b||(g(p.$$.fragment,a),b=!0)},o(a){_(p.$$.fragment,a),b=!1},d(a){a&&(o(r),o(m)),w(p,a)}}}function co(x){let r,y=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){r=d("p"),r.innerHTML=y},l(m){r=c(m,"P",{"data-svelte-h":!0}),S(r)!=="svelte-fincs2"&&(r.innerHTML=y)},m(m,p){i(m,r,p)},p:Ne,d(m){m&&o(r)}}}function mo(x){let r,y="Example:",m,p,b;return p=new Ct({props:{code:"aW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjBudW1weSUyMGFzJTIwbnAlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFpbXBvcnQlMjByZXF1ZXN0cyUwQSUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBBdXRvSW1hZ2VQcm9jZXNzb3IlMkMlMjBTd2luMlNSRm9ySW1hZ2VTdXBlclJlc29sdXRpb24lMEElMEFwcm9jZXNzb3IlMjAlM0QlMjBBdXRvSW1hZ2VQcm9jZXNzb3IuZnJvbV9wcmV0cmFpbmVkKCUyMmNhaWRhcyUyRnN3aW4yU1ItY2xhc3NpY2FsLXNyLXgyLTY0JTIyKSUwQW1vZGVsJTIwJTNEJTIwU3dpbjJTUkZvckltYWdlU3VwZXJSZXNvbHV0aW9uLmZyb21fcHJldHJhaW5lZCglMjJjYWlkYXMlMkZzd2luMlNSLWNsYXNzaWNhbC1zci14Mi02NCUyMiklMEElMEF1cmwlMjAlM0QlMjAlMjJodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGc3BhY2VzJTJGampvdXJuZXkxMTI1JTJGc3dpbjJzciUyRnJlc29sdmUlMkZtYWluJTJGc2FtcGxlcyUyRmJ1dHRlcmZseS5qcGclMjIlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4ocmVxdWVzdHMuZ2V0KHVybCUyQyUyMHN0cmVhbSUzRFRydWUpLnJhdyklMEElMjMlMjBwcmVwYXJlJTIwaW1hZ2UlMjBmb3IlMjB0aGUlMjBtb2RlbCUwQWlucHV0cyUyMCUzRCUyMHByb2Nlc3NvcihpbWFnZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBJTIzJTIwZm9yd2FyZCUyMHBhc3MlMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQSUwQW91dHB1dCUyMCUzRCUyMG91dHB1dHMucmVjb25zdHJ1Y3Rpb24uZGF0YS5zcXVlZXplKCkuZmxvYXQoKS5jcHUoKS5jbGFtcF8oMCUyQyUyMDEpLm51bXB5KCklMEFvdXRwdXQlMjAlM0QlMjBucC5tb3ZlYXhpcyhvdXRwdXQlMkMlMjBzb3VyY2UlM0QwJTJDJTIwZGVzdGluYXRpb24lM0QtMSklMEFvdXRwdXQlMjAlM0QlMjAob3V0cHV0JTIwKiUyMDI1NS4wKS5yb3VuZCgpLmFzdHlwZShucC51aW50OCklMjAlMjAlMjMlMjBmbG9hdDMyJTIwdG8lMjB1aW50OCUwQSUyMyUyMHlvdSUyMGNhbiUyMHZpc3VhbGl6ZSUyMCU2MG91dHB1dCU2MCUyMHdpdGglMjAlNjBJbWFnZS5mcm9tYXJyYXklNjA=",highlighted:`<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">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoImageProcessor, Swin2SRForImageSuperResolution

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = AutoImageProcessor.from_pretrained(<span class="hljs-string">&quot;caidas/swin2SR-classical-sr-x2-64&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = Swin2SRForImageSuperResolution.from_pretrained(<span class="hljs-string">&quot;caidas/swin2SR-classical-sr-x2-64&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;https://huggingface.co/spaces/jjourney1125/swin2sr/resolve/main/samples/butterfly.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># prepare image for the model</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = processor(image, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># forward pass</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>output = outputs.reconstruction.data.squeeze().<span class="hljs-built_in">float</span>().cpu().clamp_(<span class="hljs-number">0</span>, <span class="hljs-number">1</span>).numpy()
<span class="hljs-meta">&gt;&gt;&gt; </span>output = np.moveaxis(output, source=<span class="hljs-number">0</span>, destination=-<span class="hljs-number">1</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>output = (output * <span class="hljs-number">255.0</span>).<span class="hljs-built_in">round</span>().astype(np.uint8)  <span class="hljs-comment"># float32 to uint8</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># you can visualize \`output\` with \`Image.fromarray\`</span>`,wrap:!1}}),{c(){r=d("p"),r.textContent=y,m=n(),u(p.$$.fragment)},l(a){r=c(a,"P",{"data-svelte-h":!0}),S(r)!=="svelte-11lpom8"&&(r.textContent=y),m=s(a),h(p.$$.fragment,a)},m(a,v){i(a,r,v),i(a,m,v),f(p,a,v),b=!0},p:Ne,i(a){b||(g(p.$$.fragment,a),b=!0)},o(a){_(p.$$.fragment,a),b=!1},d(a){a&&(o(r),o(m)),w(p,a)}}}function po(x){let r,y,m,p,b,a,v,jt='<img alt="PyTorch" src="https://img.shields.io/badge/PyTorch-DE3412?style=flat&amp;logo=pytorch&amp;logoColor=white"/>',Je,O,We,Y,Ft=`The Swin2SR model was proposed in <a href="https://arxiv.org/abs/2209.11345" rel="nofollow">Swin2SR: SwinV2 Transformer for Compressed Image Super-Resolution and Restoration</a> by Marcos V. Conde, Ui-Jin Choi, Maxime Burchi, Radu Timofte.
Swin2SR improves the <a href="https://github.com/JingyunLiang/SwinIR/" rel="nofollow">SwinIR</a> model by incorporating <a href="swinv2">Swin Transformer v2</a> layers which mitigates issues such as training instability, resolution gaps between pre-training
and fine-tuning, and hunger on data.`,Le,A,zt="The abstract from the paper is the following:",He,Q,Pt=`<em>Compression plays an important role on the efficient transmission and storage of images and videos through band-limited systems such as streaming services, virtual reality or videogames. However, compression unavoidably leads to artifacts and the loss of the original information, which may severely degrade the visual quality. For these reasons, quality enhancement of compressed images has become a popular research topic. While most state-of-the-art image restoration methods are based on convolutional neural networks, other transformers-based methods such as SwinIR, show impressive performance on these tasks.
In this paper, we explore the novel Swin Transformer V2, to improve SwinIR for image super-resolution, and in particular, the compressed input scenario. Using this method we can tackle the major issues in training transformer vision models, such as training instability, resolution gaps between pre-training and fine-tuning, and hunger on data. We conduct experiments on three representative tasks: JPEG compression artifacts removal, image super-resolution (classical and lightweight), and compressed image super-resolution. Experimental results demonstrate that our method, Swin2SR, can improve the training convergence and performance of SwinIR, and is a top-5 solution at the “AIM 2022 Challenge on Super-Resolution of Compressed Image and Video”.</em>`,qe,L,kt,Be,K,Ut='Swin2SR architecture. Taken from the <a href="https://arxiv.org/abs/2209.11345">original paper.</a>',Ze,ee,Nt=`This model was contributed by <a href="https://huggingface.co/nielsr" rel="nofollow">nielsr</a>.
The original code can be found <a href="https://github.com/mv-lab/swin2sr" rel="nofollow">here</a>.`,Ee,te,De,oe,Jt='Demo notebooks for Swin2SR can be found <a href="https://github.com/NielsRogge/Transformers-Tutorials/tree/master/Swin2SR" rel="nofollow">here</a>.',Ve,ne,Wt='A demo Space for image super-resolution with SwinSR can be found <a href="https://huggingface.co/spaces/jjourney1125/swin2sr" rel="nofollow">here</a>.',Xe,se,Ge,j,re,at,be,Lt="Constructs a Swin2SR image processor.",it,H,ae,lt,ve,Ht="Preprocess an image or batch of images.",Oe,ie,Ye,F,le,dt,ye,qt="Constructs a fast Swin2Sr image processor.",ct,Te,de,Ae,ce,Qe,M,me,mt,$e,Bt=`This is the configuration class to store the configuration of a <a href="/docs/transformers/main/en/model_doc/swin2sr#transformers.Swin2SRModel">Swin2SRModel</a>. It is used to instantiate a Swin
Transformer v2 model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yield a similar configuration to that of the Swin Transformer v2
<a href="https://huggingface.co/caidas/swin2sr-classicalsr-x2-64" rel="nofollow">caidas/swin2sr-classicalsr-x2-64</a> architecture.`,pt,Re,Zt=`Configuration objects inherit from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,ut,q,Ke,pe,et,T,ue,ht,Me,Et="The bare Swin2Sr Model outputting raw hidden-states without any specific head on top.",ft,xe,Dt=`This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,gt,Ie,Vt=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,_t,I,he,wt,Ce,Xt='The <a href="/docs/transformers/main/en/model_doc/swin2sr#transformers.Swin2SRModel">Swin2SRModel</a> forward method, overrides the <code>__call__</code> special method.',St,B,bt,Z,tt,fe,ot,$,ge,vt,je,Gt="Swin2SR Model transformer with an upsampler head on top for image super resolution and restoration.",yt,Fe,Ot=`This model inherits from <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`,Tt,ze,Yt=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,$t,C,_e,Rt,Pe,At='The <a href="/docs/transformers/main/en/model_doc/swin2sr#transformers.Swin2SRForImageSuperResolution">Swin2SRForImageSuperResolution</a> forward method, overrides the <code>__call__</code> special method.',Mt,E,xt,D,nt,we,st,ke,rt;return b=new G({props:{title:"Swin2SR",local:"swin2sr",headingTag:"h1"}}),O=new G({props:{title:"Overview",local:"overview",headingTag:"h2"}}),te=new G({props:{title:"Resources",local:"resources",headingTag:"h2"}}),se=new G({props:{title:"Swin2SRImageProcessor",local:"transformers.Swin2SRImageProcessor",headingTag:"h2"}}),re=new W({props:{name:"class transformers.Swin2SRImageProcessor",anchor:"transformers.Swin2SRImageProcessor",parameters:[{name:"do_rescale",val:": bool = True"},{name:"rescale_factor",val:": typing.Union[int, float] = 0.00392156862745098"},{name:"do_pad",val:": bool = True"},{name:"pad_size",val:": int = 8"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Swin2SRImageProcessor.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to rescale the image by the specified scale <code>rescale_factor</code>. Can be overridden by the <code>do_rescale</code>
parameter in the <code>preprocess</code> method.`,name:"do_rescale"},{anchor:"transformers.Swin2SRImageProcessor.rescale_factor",description:`<strong>rescale_factor</strong> (<code>int</code> or <code>float</code>, <em>optional</em>, defaults to <code>1/255</code>) &#x2014;
Scale factor to use if rescaling the image. Can be overridden by the <code>rescale_factor</code> parameter in the
<code>preprocess</code> method.`,name:"rescale_factor"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/swin2sr/image_processing_swin2sr.py#L39"}}),ae=new W({props:{name:"preprocess",anchor:"transformers.Swin2SRImageProcessor.preprocess",parameters:[{name:"images",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), list['PIL.Image.Image'], list[numpy.ndarray], list['torch.Tensor']]"},{name:"do_rescale",val:": typing.Optional[bool] = None"},{name:"rescale_factor",val:": typing.Optional[float] = None"},{name:"do_pad",val:": typing.Optional[bool] = None"},{name:"pad_size",val:": typing.Optional[int] = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension] = <ChannelDimension.FIRST: 'channels_first'>"},{name:"input_data_format",val:": typing.Union[str, transformers.image_utils.ChannelDimension, NoneType] = None"}],parametersDescription:[{anchor:"transformers.Swin2SRImageProcessor.preprocess.images",description:`<strong>images</strong> (<code>ImageInput</code>) &#x2014;
Image to preprocess. Expects a single or batch of images with pixel values ranging from 0 to 255. If
passing in images with pixel values between 0 and 1, set <code>do_rescale=False</code>.`,name:"images"},{anchor:"transformers.Swin2SRImageProcessor.preprocess.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>self.do_rescale</code>) &#x2014;
Whether to rescale the image values between [0 - 1].`,name:"do_rescale"},{anchor:"transformers.Swin2SRImageProcessor.preprocess.rescale_factor",description:`<strong>rescale_factor</strong> (<code>float</code>, <em>optional</em>, defaults to <code>self.rescale_factor</code>) &#x2014;
Rescale factor to rescale the image by if <code>do_rescale</code> is set to <code>True</code>.`,name:"rescale_factor"},{anchor:"transformers.Swin2SRImageProcessor.preprocess.do_pad",description:`<strong>do_pad</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to pad the image to make the height and width divisible by <code>window_size</code>.`,name:"do_pad"},{anchor:"transformers.Swin2SRImageProcessor.preprocess.pad_size",description:`<strong>pad_size</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
The size of the sliding window for the local attention.`,name:"pad_size"},{anchor:"transformers.Swin2SRImageProcessor.preprocess.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <code>TensorType</code>, <em>optional</em>) &#x2014;
The type of tensors to return. Can be one of:<ul>
<li>Unset: Return a list of <code>np.ndarray</code>.</li>
<li><code>TensorType.TENSORFLOW</code> or <code>&apos;tf&apos;</code>: Return a batch of typ, input_data_format=input_data_formate
<code>tf.Tensor</code>.</li>
<li><code>TensorType.PYTORCH</code> or <code>&apos;pt&apos;</code>: Return a batch of type <code>torch.Tensor</code>.</li>
<li><code>TensorType.NUMPY</code> or <code>&apos;np&apos;</code>: Return a batch of type <code>np.ndarray</code>.</li>
<li><code>TensorType.JAX</code> or <code>&apos;jax&apos;</code>: Return a batch of type <code>jax.numpy.ndarray</code>.</li>
</ul>`,name:"return_tensors"},{anchor:"transformers.Swin2SRImageProcessor.preprocess.data_format",description:`<strong>data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>, defaults to <code>ChannelDimension.FIRST</code>) &#x2014;
The channel dimension format for the output image. Can be one of:<ul>
<li><code>&quot;channels_first&quot;</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>&quot;channels_last&quot;</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li>Unset: Use the channel dimension format of the input image.</li>
</ul>`,name:"data_format"},{anchor:"transformers.Swin2SRImageProcessor.preprocess.input_data_format",description:`<strong>input_data_format</strong> (<code>ChannelDimension</code> or <code>str</code>, <em>optional</em>) &#x2014;
The channel dimension format for the input image. If unset, the channel dimension format is inferred
from the input image. Can be one of:<ul>
<li><code>&quot;channels_first&quot;</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>&quot;channels_last&quot;</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li><code>&quot;none&quot;</code> or <code>ChannelDimension.NONE</code>: image in (height, width) format.</li>
</ul>`,name:"input_data_format"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/swin2sr/image_processing_swin2sr.py#L110"}}),ie=new G({props:{title:"Swin2SRImageProcessorFast",local:"transformers.Swin2SRImageProcessorFast",headingTag:"h2"}}),le=new W({props:{name:"class transformers.Swin2SRImageProcessorFast",anchor:"transformers.Swin2SRImageProcessorFast",parameters:[{name:"**kwargs",val:": typing_extensions.Unpack[transformers.models.swin2sr.image_processing_swin2sr_fast.Swin2SRFastImageProcessorKwargs]"}],parametersDescription:[{anchor:"transformers.Swin2SRImageProcessorFast.do_resize",description:`<strong>do_resize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
Whether to resize the image.`,name:"do_resize"},{anchor:"transformers.Swin2SRImageProcessorFast.size",description:`<strong>size</strong> (<code>dict[str, int]</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
Describes the maximum input dimensions to the model.`,name:"size"},{anchor:"transformers.Swin2SRImageProcessorFast.default_to_square",description:`<strong>default_to_square</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to default to a square image when resizing, if size is an int.`,name:"default_to_square"},{anchor:"transformers.Swin2SRImageProcessorFast.resample",description:`<strong>resample</strong> (<code>Union[PILImageResampling, F.InterpolationMode, NoneType]</code>, defaults to <code>None</code>) &#x2014;
Resampling filter to use if resizing the image. This can be one of the enum <code>PILImageResampling</code>. Only
has an effect if <code>do_resize</code> is set to <code>True</code>.`,name:"resample"},{anchor:"transformers.Swin2SRImageProcessorFast.do_center_crop",description:`<strong>do_center_crop</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
Whether to center crop the image.`,name:"do_center_crop"},{anchor:"transformers.Swin2SRImageProcessorFast.crop_size",description:`<strong>crop_size</strong> (<code>dict[str, int]</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
Size of the output image after applying <code>center_crop</code>.`,name:"crop_size"},{anchor:"transformers.Swin2SRImageProcessorFast.do_rescale",description:`<strong>do_rescale</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to rescale the image.`,name:"do_rescale"},{anchor:"transformers.Swin2SRImageProcessorFast.rescale_factor",description:`<strong>rescale_factor</strong> (<code>Union[int, float, NoneType]</code>, defaults to <code>0.00392156862745098</code>) &#x2014;
Rescale factor to rescale the image by if <code>do_rescale</code> is set to <code>True</code>.`,name:"rescale_factor"},{anchor:"transformers.Swin2SRImageProcessorFast.do_normalize",description:`<strong>do_normalize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
Whether to normalize the image.`,name:"do_normalize"},{anchor:"transformers.Swin2SRImageProcessorFast.image_mean",description:`<strong>image_mean</strong> (<code>Union[float, list[float], NoneType]</code>, defaults to <code>None</code>) &#x2014;
Image mean to use for normalization. Only has an effect if <code>do_normalize</code> is set to <code>True</code>.`,name:"image_mean"},{anchor:"transformers.Swin2SRImageProcessorFast.image_std",description:`<strong>image_std</strong> (<code>Union[float, list[float], NoneType]</code>, defaults to <code>None</code>) &#x2014;
Image standard deviation to use for normalization. Only has an effect if <code>do_normalize</code> is set to
<code>True</code>.`,name:"image_std"},{anchor:"transformers.Swin2SRImageProcessorFast.do_convert_rgb",description:`<strong>do_convert_rgb</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
Whether to convert the image to RGB.`,name:"do_convert_rgb"},{anchor:"transformers.Swin2SRImageProcessorFast.return_tensors",description:"<strong>return_tensors</strong> (<code>Union[str, ~utils.generic.TensorType, NoneType]</code>, defaults to <code>None</code>) &#x2014;\nReturns stacked tensors if set to `pt, otherwise returns a list of tensors.",name:"return_tensors"},{anchor:"transformers.Swin2SRImageProcessorFast.data_format",description:`<strong>data_format</strong> (<code>~image_utils.ChannelDimension</code>, <em>optional</em>, defaults to <code>ChannelDimension.FIRST</code>) &#x2014;
Only <code>ChannelDimension.FIRST</code> is supported. Added for compatibility with slow processors.`,name:"data_format"},{anchor:"transformers.Swin2SRImageProcessorFast.input_data_format",description:`<strong>input_data_format</strong> (<code>Union[~image_utils.ChannelDimension, str, NoneType]</code>, defaults to <code>None</code>) &#x2014;
The channel dimension format for the input image. If unset, the channel dimension format is inferred
from the input image. Can be one of:<ul>
<li><code>&quot;channels_first&quot;</code> or <code>ChannelDimension.FIRST</code>: image in (num_channels, height, width) format.</li>
<li><code>&quot;channels_last&quot;</code> or <code>ChannelDimension.LAST</code>: image in (height, width, num_channels) format.</li>
<li><code>&quot;none&quot;</code> or <code>ChannelDimension.NONE</code>: image in (height, width) format.</li>
</ul>`,name:"input_data_format"},{anchor:"transformers.Swin2SRImageProcessorFast.device",description:`<strong>device</strong> (<code>torch.device</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
The device to process the images on. If unset, the device is inferred from the input images.`,name:"device"},{anchor:"transformers.Swin2SRImageProcessorFast.do_pad",description:`<strong>do_pad</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to pad the image to make the height and width divisible by <code>window_size</code>.`,name:"do_pad"},{anchor:"transformers.Swin2SRImageProcessorFast.pad_size",description:`<strong>pad_size</strong> (<code>int</code>, <em>optional</em>, defaults to <code>8</code>) &#x2014;
The size of the sliding window for the local attention.`,name:"pad_size"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/swin2sr/image_processing_swin2sr_fast.py#L59"}}),de=new W({props:{name:"preprocess",anchor:"transformers.Swin2SRImageProcessorFast.preprocess",parameters:[{name:"images",val:": typing.Union[ForwardRef('PIL.Image.Image'), numpy.ndarray, ForwardRef('torch.Tensor'), list['PIL.Image.Image'], list[numpy.ndarray], list['torch.Tensor']]"},{name:"**kwargs",val:": typing_extensions.Unpack[transformers.models.swin2sr.image_processing_swin2sr_fast.Swin2SRFastImageProcessorKwargs]"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/swin2sr/image_processing_swin2sr_fast.py#L70"}}),ce=new G({props:{title:"Swin2SRConfig",local:"transformers.Swin2SRConfig",headingTag:"h2"}}),me=new W({props:{name:"class transformers.Swin2SRConfig",anchor:"transformers.Swin2SRConfig",parameters:[{name:"image_size",val:" = 64"},{name:"patch_size",val:" = 1"},{name:"num_channels",val:" = 3"},{name:"num_channels_out",val:" = None"},{name:"embed_dim",val:" = 180"},{name:"depths",val:" = [6, 6, 6, 6, 6, 6]"},{name:"num_heads",val:" = [6, 6, 6, 6, 6, 6]"},{name:"window_size",val:" = 8"},{name:"mlp_ratio",val:" = 2.0"},{name:"qkv_bias",val:" = True"},{name:"hidden_dropout_prob",val:" = 0.0"},{name:"attention_probs_dropout_prob",val:" = 0.0"},{name:"drop_path_rate",val:" = 0.1"},{name:"hidden_act",val:" = 'gelu'"},{name:"use_absolute_embeddings",val:" = False"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-05"},{name:"upscale",val:" = 2"},{name:"img_range",val:" = 1.0"},{name:"resi_connection",val:" = '1conv'"},{name:"upsampler",val:" = 'pixelshuffle'"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.Swin2SRConfig.image_size",description:`<strong>image_size</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014;
The size (resolution) of each image.`,name:"image_size"},{anchor:"transformers.Swin2SRConfig.patch_size",description:`<strong>patch_size</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The size (resolution) of each patch.`,name:"patch_size"},{anchor:"transformers.Swin2SRConfig.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.Swin2SRConfig.num_channels_out",description:`<strong>num_channels_out</strong> (<code>int</code>, <em>optional</em>, defaults to <code>num_channels</code>) &#x2014;
The number of output channels. If not set, it will be set to <code>num_channels</code>.`,name:"num_channels_out"},{anchor:"transformers.Swin2SRConfig.embed_dim",description:`<strong>embed_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 180) &#x2014;
Dimensionality of patch embedding.`,name:"embed_dim"},{anchor:"transformers.Swin2SRConfig.depths",description:`<strong>depths</strong> (<code>list(int)</code>, <em>optional</em>, defaults to <code>[6, 6, 6, 6, 6, 6]</code>) &#x2014;
Depth of each layer in the Transformer encoder.`,name:"depths"},{anchor:"transformers.Swin2SRConfig.num_heads",description:`<strong>num_heads</strong> (<code>list(int)</code>, <em>optional</em>, defaults to <code>[6, 6, 6, 6, 6, 6]</code>) &#x2014;
Number of attention heads in each layer of the Transformer encoder.`,name:"num_heads"},{anchor:"transformers.Swin2SRConfig.window_size",description:`<strong>window_size</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
Size of windows.`,name:"window_size"},{anchor:"transformers.Swin2SRConfig.mlp_ratio",description:`<strong>mlp_ratio</strong> (<code>float</code>, <em>optional</em>, defaults to 2.0) &#x2014;
Ratio of MLP hidden dimensionality to embedding dimensionality.`,name:"mlp_ratio"},{anchor:"transformers.Swin2SRConfig.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.Swin2SRConfig.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.Swin2SRConfig.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.Swin2SRConfig.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.Swin2SRConfig.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.Swin2SRConfig.use_absolute_embeddings",description:`<strong>use_absolute_embeddings</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to add absolute position embeddings to the patch embeddings.`,name:"use_absolute_embeddings"},{anchor:"transformers.Swin2SRConfig.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.Swin2SRConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-05) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.Swin2SRConfig.upscale",description:`<strong>upscale</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
The upscale factor for the image. 2/3/4/8 for image super resolution, 1 for denoising and compress artifact
reduction`,name:"upscale"},{anchor:"transformers.Swin2SRConfig.img_range",description:`<strong>img_range</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
The range of the values of the input image.`,name:"img_range"},{anchor:"transformers.Swin2SRConfig.resi_connection",description:`<strong>resi_connection</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;1conv&quot;</code>) &#x2014;
The convolutional block to use before the residual connection in each stage.`,name:"resi_connection"},{anchor:"transformers.Swin2SRConfig.upsampler",description:`<strong>upsampler</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pixelshuffle&quot;</code>) &#x2014;
The reconstruction reconstruction module. Can be &#x2018;pixelshuffle&#x2019;/&#x2018;pixelshuffledirect&#x2019;/&#x2018;nearest+conv&#x2019;/None.`,name:"upsampler"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/swin2sr/configuration_swin2sr.py#L24"}}),q=new It({props:{anchor:"transformers.Swin2SRConfig.example",$$slots:{default:[ao]},$$scope:{ctx:x}}}),pe=new G({props:{title:"Swin2SRModel",local:"transformers.Swin2SRModel",headingTag:"h2"}}),ue=new W({props:{name:"class transformers.Swin2SRModel",anchor:"transformers.Swin2SRModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.Swin2SRModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/swin2sr#transformers.Swin2SRModel">Swin2SRModel</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/swin2sr/modeling_swin2sr.py#L755"}}),he=new W({props:{name:"forward",anchor:"transformers.Swin2SRModel.forward",parameters:[{name:"pixel_values",val:": FloatTensor"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.Swin2SRModel.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, image_size, image_size)</code>) &#x2014;
The tensors corresponding to the input images. Pixel values can be obtained using
<code>{image_processor_class}</code>. See <code>{image_processor_class}.__call__</code> for details (<code>{processor_class}</code> uses
<code>{image_processor_class}</code> for processing images).`,name:"pixel_values"},{anchor:"transformers.Swin2SRModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.Swin2SRModel.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.Swin2SRModel.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.Swin2SRModel.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/swin2sr/modeling_swin2sr.py#L806",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutput"
>transformers.modeling_outputs.BaseModelOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/swin2sr#transformers.Swin2SRConfig"
>Swin2SRConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) — Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional 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>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) 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>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutput"
>transformers.modeling_outputs.BaseModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),B=new Qt({props:{$$slots:{default:[io]},$$scope:{ctx:x}}}),Z=new It({props:{anchor:"transformers.Swin2SRModel.forward.example",$$slots:{default:[lo]},$$scope:{ctx:x}}}),fe=new G({props:{title:"Swin2SRForImageSuperResolution",local:"transformers.Swin2SRForImageSuperResolution",headingTag:"h2"}}),ge=new W({props:{name:"class transformers.Swin2SRForImageSuperResolution",anchor:"transformers.Swin2SRForImageSuperResolution",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.Swin2SRForImageSuperResolution.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/swin2sr#transformers.Swin2SRForImageSuperResolution">Swin2SRForImageSuperResolution</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/swin2sr/modeling_swin2sr.py#L1000"}}),_e=new W({props:{name:"forward",anchor:"transformers.Swin2SRForImageSuperResolution.forward",parameters:[{name:"pixel_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.Swin2SRForImageSuperResolution.forward.pixel_values",description:`<strong>pixel_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, image_size, image_size)</code>, <em>optional</em>) &#x2014;
The tensors corresponding to the input images. Pixel values can be obtained using
<code>{image_processor_class}</code>. See <code>{image_processor_class}.__call__</code> for details (<code>{processor_class}</code> uses
<code>{image_processor_class}</code> for processing images).`,name:"pixel_values"},{anchor:"transformers.Swin2SRForImageSuperResolution.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.Swin2SRForImageSuperResolution.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the masked language modeling loss. Indices should either be in <code>[0, ..., config.vocab_size]</code> or -100 (see <code>input_ids</code> docstring). Tokens with indices set to <code>-100</code> are ignored
(masked), the loss is only computed for the tokens with labels in <code>[0, ..., config.vocab_size]</code>.`,name:"labels"},{anchor:"transformers.Swin2SRForImageSuperResolution.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.Swin2SRForImageSuperResolution.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.Swin2SRForImageSuperResolution.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/swin2sr/modeling_swin2sr.py#L1032",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>A <code>transformers.modeling_outputs.ImageSuperResolutionOutput</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/swin2sr#transformers.Swin2SRConfig"
>Swin2SRConfig</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) — Reconstruction loss.</p>
</li>
<li>
<p><strong>reconstruction</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_channels, height, width)</code>) — Reconstructed images, possibly upscaled.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each stage) of shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states
(also called feature maps) of the model at the output of each stage.</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>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, patch_size, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>transformers.modeling_outputs.ImageSuperResolutionOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),E=new Qt({props:{$$slots:{default:[co]},$$scope:{ctx:x}}}),D=new It({props:{anchor:"transformers.Swin2SRForImageSuperResolution.forward.example",$$slots:{default:[mo]},$$scope:{ctx:x}}}),we=new ro({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/swin2sr.md"}}),{c(){r=d("meta"),y=n(),m=d("p"),p=n(),u(b.$$.fragment),a=n(),v=d("div"),v.innerHTML=jt,Je=n(),u(O.$$.fragment),We=n(),Y=d("p"),Y.innerHTML=Ft,Le=n(),A=d("p"),A.textContent=zt,He=n(),Q=d("p"),Q.innerHTML=Pt,qe=n(),L=d("img"),Be=n(),K=d("small"),K.innerHTML=Ut,Ze=n(),ee=d("p"),ee.innerHTML=Nt,Ee=n(),u(te.$$.fragment),De=n(),oe=d("p"),oe.innerHTML=Jt,Ve=n(),ne=d("p"),ne.innerHTML=Wt,Xe=n(),u(se.$$.fragment),Ge=n(),j=d("div"),u(re.$$.fragment),at=n(),be=d("p"),be.textContent=Lt,it=n(),H=d("div"),u(ae.$$.fragment),lt=n(),ve=d("p"),ve.textContent=Ht,Oe=n(),u(ie.$$.fragment),Ye=n(),F=d("div"),u(le.$$.fragment),dt=n(),ye=d("p"),ye.textContent=qt,ct=n(),Te=d("div"),u(de.$$.fragment),Ae=n(),u(ce.$$.fragment),Qe=n(),M=d("div"),u(me.$$.fragment),mt=n(),$e=d("p"),$e.innerHTML=Bt,pt=n(),Re=d("p"),Re.innerHTML=Zt,ut=n(),u(q.$$.fragment),Ke=n(),u(pe.$$.fragment),et=n(),T=d("div"),u(ue.$$.fragment),ht=n(),Me=d("p"),Me.textContent=Et,ft=n(),xe=d("p"),xe.innerHTML=Dt,gt=n(),Ie=d("p"),Ie.innerHTML=Vt,_t=n(),I=d("div"),u(he.$$.fragment),wt=n(),Ce=d("p"),Ce.innerHTML=Xt,St=n(),u(B.$$.fragment),bt=n(),u(Z.$$.fragment),tt=n(),u(fe.$$.fragment),ot=n(),$=d("div"),u(ge.$$.fragment),vt=n(),je=d("p"),je.textContent=Gt,yt=n(),Fe=d("p"),Fe.innerHTML=Ot,Tt=n(),ze=d("p"),ze.innerHTML=Yt,$t=n(),C=d("div"),u(_e.$$.fragment),Rt=n(),Pe=d("p"),Pe.innerHTML=At,Mt=n(),u(E.$$.fragment),xt=n(),u(D.$$.fragment),nt=n(),u(we.$$.fragment),st=n(),ke=d("p"),this.h()},l(e){const t=so("svelte-u9bgzb",document.head);r=c(t,"META",{name:!0,content:!0}),t.forEach(o),y=s(e),m=c(e,"P",{}),P(m).forEach(o),p=s(e),h(b.$$.fragment,e),a=s(e),v=c(e,"DIV",{class:!0,"data-svelte-h":!0}),S(v)!=="svelte-13t8s2t"&&(v.innerHTML=jt),Je=s(e),h(O.$$.fragment,e),We=s(e),Y=c(e,"P",{"data-svelte-h":!0}),S(Y)!=="svelte-giz5rq"&&(Y.innerHTML=Ft),Le=s(e),A=c(e,"P",{"data-svelte-h":!0}),S(A)!=="svelte-vfdo9a"&&(A.textContent=zt),He=s(e),Q=c(e,"P",{"data-svelte-h":!0}),S(Q)!=="svelte-180sy5i"&&(Q.innerHTML=Pt),qe=s(e),L=c(e,"IMG",{src:!0,alt:!0,width:!0}),Be=s(e),K=c(e,"SMALL",{"data-svelte-h":!0}),S(K)!=="svelte-1f14c9b"&&(K.innerHTML=Ut),Ze=s(e),ee=c(e,"P",{"data-svelte-h":!0}),S(ee)!=="svelte-1qdp0v2"&&(ee.innerHTML=Nt),Ee=s(e),h(te.$$.fragment,e),De=s(e),oe=c(e,"P",{"data-svelte-h":!0}),S(oe)!=="svelte-1w7u0gr"&&(oe.innerHTML=Jt),Ve=s(e),ne=c(e,"P",{"data-svelte-h":!0}),S(ne)!=="svelte-1o6g186"&&(ne.innerHTML=Wt),Xe=s(e),h(se.$$.fragment,e),Ge=s(e),j=c(e,"DIV",{class:!0});var N=P(j);h(re.$$.fragment,N),at=s(N),be=c(N,"P",{"data-svelte-h":!0}),S(be)!=="svelte-1jih302"&&(be.textContent=Lt),it=s(N),H=c(N,"DIV",{class:!0});var Se=P(H);h(ae.$$.fragment,Se),lt=s(Se),ve=c(Se,"P",{"data-svelte-h":!0}),S(ve)!=="svelte-1x3yxsa"&&(ve.textContent=Ht),Se.forEach(o),N.forEach(o),Oe=s(e),h(ie.$$.fragment,e),Ye=s(e),F=c(e,"DIV",{class:!0});var J=P(F);h(le.$$.fragment,J),dt=s(J),ye=c(J,"P",{"data-svelte-h":!0}),S(ye)!=="svelte-wd0lu6"&&(ye.textContent=qt),ct=s(J),Te=c(J,"DIV",{class:!0});var Ue=P(Te);h(de.$$.fragment,Ue),Ue.forEach(o),J.forEach(o),Ae=s(e),h(ce.$$.fragment,e),Qe=s(e),M=c(e,"DIV",{class:!0});var z=P(M);h(me.$$.fragment,z),mt=s(z),$e=c(z,"P",{"data-svelte-h":!0}),S($e)!=="svelte-1xi0ajx"&&($e.innerHTML=Bt),pt=s(z),Re=c(z,"P",{"data-svelte-h":!0}),S(Re)!=="svelte-o55m63"&&(Re.innerHTML=Zt),ut=s(z),h(q.$$.fragment,z),z.forEach(o),Ke=s(e),h(pe.$$.fragment,e),et=s(e),T=c(e,"DIV",{class:!0});var k=P(T);h(ue.$$.fragment,k),ht=s(k),Me=c(k,"P",{"data-svelte-h":!0}),S(Me)!=="svelte-1obu08m"&&(Me.textContent=Et),ft=s(k),xe=c(k,"P",{"data-svelte-h":!0}),S(xe)!=="svelte-6pahdo"&&(xe.innerHTML=Dt),gt=s(k),Ie=c(k,"P",{"data-svelte-h":!0}),S(Ie)!=="svelte-hswkmf"&&(Ie.innerHTML=Vt),_t=s(k),I=c(k,"DIV",{class:!0});var V=P(I);h(he.$$.fragment,V),wt=s(V),Ce=c(V,"P",{"data-svelte-h":!0}),S(Ce)!=="svelte-nrwvhh"&&(Ce.innerHTML=Xt),St=s(V),h(B.$$.fragment,V),bt=s(V),h(Z.$$.fragment,V),V.forEach(o),k.forEach(o),tt=s(e),h(fe.$$.fragment,e),ot=s(e),$=c(e,"DIV",{class:!0});var U=P($);h(ge.$$.fragment,U),vt=s(U),je=c(U,"P",{"data-svelte-h":!0}),S(je)!=="svelte-31vje8"&&(je.textContent=Gt),yt=s(U),Fe=c(U,"P",{"data-svelte-h":!0}),S(Fe)!=="svelte-6pahdo"&&(Fe.innerHTML=Ot),Tt=s(U),ze=c(U,"P",{"data-svelte-h":!0}),S(ze)!=="svelte-hswkmf"&&(ze.innerHTML=Yt),$t=s(U),C=c(U,"DIV",{class:!0});var X=P(C);h(_e.$$.fragment,X),Rt=s(X),Pe=c(X,"P",{"data-svelte-h":!0}),S(Pe)!=="svelte-1tuj2ht"&&(Pe.innerHTML=At),Mt=s(X),h(E.$$.fragment,X),xt=s(X),h(D.$$.fragment,X),X.forEach(o),U.forEach(o),nt=s(e),h(we.$$.fragment,e),st=s(e),ke=c(e,"P",{}),P(ke).forEach(o),this.h()},h(){R(r,"name","hf:doc:metadata"),R(r,"content",uo),R(v,"class","flex flex-wrap space-x-1"),eo(L.src,kt="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/swin2sr_architecture.png")||R(L,"src",kt),R(L,"alt","drawing"),R(L,"width","600"),R(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),R(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),R(Te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),R(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),R(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),R(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),R(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),R(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),R($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,t){l(document.head,r),i(e,y,t),i(e,m,t),i(e,p,t),f(b,e,t),i(e,a,t),i(e,v,t),i(e,Je,t),f(O,e,t),i(e,We,t),i(e,Y,t),i(e,Le,t),i(e,A,t),i(e,He,t),i(e,Q,t),i(e,qe,t),i(e,L,t),i(e,Be,t),i(e,K,t),i(e,Ze,t),i(e,ee,t),i(e,Ee,t),f(te,e,t),i(e,De,t),i(e,oe,t),i(e,Ve,t),i(e,ne,t),i(e,Xe,t),f(se,e,t),i(e,Ge,t),i(e,j,t),f(re,j,null),l(j,at),l(j,be),l(j,it),l(j,H),f(ae,H,null),l(H,lt),l(H,ve),i(e,Oe,t),f(ie,e,t),i(e,Ye,t),i(e,F,t),f(le,F,null),l(F,dt),l(F,ye),l(F,ct),l(F,Te),f(de,Te,null),i(e,Ae,t),f(ce,e,t),i(e,Qe,t),i(e,M,t),f(me,M,null),l(M,mt),l(M,$e),l(M,pt),l(M,Re),l(M,ut),f(q,M,null),i(e,Ke,t),f(pe,e,t),i(e,et,t),i(e,T,t),f(ue,T,null),l(T,ht),l(T,Me),l(T,ft),l(T,xe),l(T,gt),l(T,Ie),l(T,_t),l(T,I),f(he,I,null),l(I,wt),l(I,Ce),l(I,St),f(B,I,null),l(I,bt),f(Z,I,null),i(e,tt,t),f(fe,e,t),i(e,ot,t),i(e,$,t),f(ge,$,null),l($,vt),l($,je),l($,yt),l($,Fe),l($,Tt),l($,ze),l($,$t),l($,C),f(_e,C,null),l(C,Rt),l(C,Pe),l(C,Mt),f(E,C,null),l(C,xt),f(D,C,null),i(e,nt,t),f(we,e,t),i(e,st,t),i(e,ke,t),rt=!0},p(e,[t]){const N={};t&2&&(N.$$scope={dirty:t,ctx:e}),q.$set(N);const Se={};t&2&&(Se.$$scope={dirty:t,ctx:e}),B.$set(Se);const J={};t&2&&(J.$$scope={dirty:t,ctx:e}),Z.$set(J);const Ue={};t&2&&(Ue.$$scope={dirty:t,ctx:e}),E.$set(Ue);const z={};t&2&&(z.$$scope={dirty:t,ctx:e}),D.$set(z)},i(e){rt||(g(b.$$.fragment,e),g(O.$$.fragment,e),g(te.$$.fragment,e),g(se.$$.fragment,e),g(re.$$.fragment,e),g(ae.$$.fragment,e),g(ie.$$.fragment,e),g(le.$$.fragment,e),g(de.$$.fragment,e),g(ce.$$.fragment,e),g(me.$$.fragment,e),g(q.$$.fragment,e),g(pe.$$.fragment,e),g(ue.$$.fragment,e),g(he.$$.fragment,e),g(B.$$.fragment,e),g(Z.$$.fragment,e),g(fe.$$.fragment,e),g(ge.$$.fragment,e),g(_e.$$.fragment,e),g(E.$$.fragment,e),g(D.$$.fragment,e),g(we.$$.fragment,e),rt=!0)},o(e){_(b.$$.fragment,e),_(O.$$.fragment,e),_(te.$$.fragment,e),_(se.$$.fragment,e),_(re.$$.fragment,e),_(ae.$$.fragment,e),_(ie.$$.fragment,e),_(le.$$.fragment,e),_(de.$$.fragment,e),_(ce.$$.fragment,e),_(me.$$.fragment,e),_(q.$$.fragment,e),_(pe.$$.fragment,e),_(ue.$$.fragment,e),_(he.$$.fragment,e),_(B.$$.fragment,e),_(Z.$$.fragment,e),_(fe.$$.fragment,e),_(ge.$$.fragment,e),_(_e.$$.fragment,e),_(E.$$.fragment,e),_(D.$$.fragment,e),_(we.$$.fragment,e),rt=!1},d(e){e&&(o(y),o(m),o(p),o(a),o(v),o(Je),o(We),o(Y),o(Le),o(A),o(He),o(Q),o(qe),o(L),o(Be),o(K),o(Ze),o(ee),o(Ee),o(De),o(oe),o(Ve),o(ne),o(Xe),o(Ge),o(j),o(Oe),o(Ye),o(F),o(Ae),o(Qe),o(M),o(Ke),o(et),o(T),o(tt),o(ot),o($),o(nt),o(st),o(ke)),o(r),w(b,e),w(O,e),w(te,e),w(se,e),w(re),w(ae),w(ie,e),w(le),w(de),w(ce,e),w(me),w(q),w(pe,e),w(ue),w(he),w(B),w(Z),w(fe,e),w(ge),w(_e),w(E),w(D),w(we,e)}}}const uo='{"title":"Swin2SR","local":"swin2sr","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Resources","local":"resources","sections":[],"depth":2},{"title":"Swin2SRImageProcessor","local":"transformers.Swin2SRImageProcessor","sections":[],"depth":2},{"title":"Swin2SRImageProcessorFast","local":"transformers.Swin2SRImageProcessorFast","sections":[],"depth":2},{"title":"Swin2SRConfig","local":"transformers.Swin2SRConfig","sections":[],"depth":2},{"title":"Swin2SRModel","local":"transformers.Swin2SRModel","sections":[],"depth":2},{"title":"Swin2SRForImageSuperResolution","local":"transformers.Swin2SRForImageSuperResolution","sections":[],"depth":2}],"depth":1}';function ho(x){return to(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class To extends oo{constructor(r){super(),no(this,r,ho,po,Kt,{})}}export{To as component};
