DeconvolutionLayer[n,sz]
represents a trainable deconvolutional net layer having n output channels and using kernels of size sz to compute the deconvolution.
DeconvolutionLayer[n,{s}]
represents a layer performing one-dimensional deconvolutions with kernels of size s.
DeconvolutionLayer[n,{h,w}]
represents a layer performing two-dimensional deconvolutions with kernels of size h×w.
DeconvolutionLayer[n,kernel,opts]
includes options for initial kernels and other parameters.
DeconvolutionLayer
DeconvolutionLayer[n,sz]
represents a trainable deconvolutional net layer having n output channels and using kernels of size sz to compute the deconvolution.
DeconvolutionLayer[n,{s}]
represents a layer performing one-dimensional deconvolutions with kernels of size s.
DeconvolutionLayer[n,{h,w}]
represents a layer performing two-dimensional deconvolutions with kernels of size h×w.
DeconvolutionLayer[n,kernel,opts]
includes options for initial kernels and other parameters.
Details and Options
- DeconvolutionLayer[…][input] explicitly computes the output from applying the layer to input.
- DeconvolutionLayer[…][{input1,input2,…}] explicitly computes outputs for each of the inputi.
- The following optional parameters can be included:
-
"Biases" Automatic initial vector of kernel biases "ChannelGroups" 1 number of channel groups "Dilation" 1 dilation factor Interleaving False the position of the channel dimension LearningRateMultipliers Automatic learning rate multipliers for kernel weights and/or biases PaddingSize 0 amount of padding to remove from the output "Stride" 1 convolution step size to use "Weights" Automatic initial matrix of kernel weights - The setting for PaddingSize can be of the following forms:
-
n crop every dimension by n elements on the beginning and end {n1,n2,…} crop the i
dimension by n elements on the beginning and end{{n1,m1},{n2,m2},…} crop the i
dimension by ni elements at the beginning and mi at the end"Same" crop every dimension so that the output size is equal to the input size multiplied by the stride - The settings for "Dilation" and "Stride" can be of the following forms:
-
n use the value n for all dimensions {…,ni,…} use the value ni for the i
dimension - By setting "ChannelGroups"g, the m input channels and n output channels are split into g groups of m/g and n/g channels, respectively, where m and n are required to be divisible by g. Separate deconvolutions are performed connecting the i
group of input channels with the i
group of output channels, and results are concatenated in the output. Each input/output group pair is connected by n/g×m/g deconvolution, so setting "ChannelGroups"g effectively reduces the number of distinct deconvolutions from n×m to n×m/g. - With Automatic settings, weights and biases are added automatically when NetInitialize or NetTrain is used.
- The setting "Biases"->None specifies that no biases should be used.
- With the setting InterleavingFalse, the channel dimension is taken to be the first dimension of the input and output arrays.
- With the setting InterleavingTrue, the channel dimension is taken to be the last dimension of the input and output arrays.
- If weights and biases have been added, DeconvolutionLayer[…][input] explicitly computes the output from applying the layer.
- DeconvolutionLayer[…][{input1,input2,…}] explicitly computes outputs for each of the inputi.
- When given a NumericArray as input, the output will be a NumericArray.
- NetExtract can be used to extract weights and biases from a DeconvolutionLayer object.
- DeconvolutionLayer is typically used inside NetChain, NetGraph, etc.
- DeconvolutionLayer exposes the following ports for use in NetGraph etc.:
-
"Input" a rank-3 array "Output" a rank-3 array - When it cannot be inferred from other layers in a larger net, the option "Input"->{d1,d2,d3} can be used to fix the input dimensions of DeconvolutionLayer.
- Given an input array of dimensions d1×d2×d3, the output array will be of dimensions
×
×
, where the channel dimension
=n and the sizes d2 and d3 are transformed according to
=s(di-1)+df(k-1)+1-pb-pe,where df is the dilation factor,
/
are the padding sizes at the beginning/end of the axis, k is the kernel size, and s is the stride size for each dimension. - Options[DeconvolutionLayer] gives the list of default options to construct the layer. Options[DeconvolutionLayer[…]] gives the list of default options to evaluate the layer on some data.
- Information[DeconvolutionLayer[…]] gives a report about the layer.
- Information[DeconvolutionLayer[…],prop] gives the value of the property prop of DeconvolutionLayer[…]. Possible properties are the same as for NetGraph.
Examples
open all close allBasic Examples (3)
Create a DeconvolutionLayer with five output channels and a 2×2 kernel size:
DeconvolutionLayer[5, {2, 2}]Create a randomly initialized DeconvolutionLayer with the input dimensions specified:
deconv = DeconvolutionLayer[1, {2, 2}, "Input" -> {1, 2, 2}]//NetInitializeApply the layer to an input tensor to produce an output tensor:
deconv[{{{1, 1}, {1, -2}}}]//MatrixFormCreate a randomly initialized DeconvolutionLayer that takes in an image and produces an image:
deconv = DeconvolutionLayer[2, {3, 3}, "Input" -> NetEncoder["Image"], "Output" -> NetDecoder["Image"]]//NetInitializedeconv[[image]]Thread the layer over a batch of inputs:
deconv[{[image], [image]}]Scope (6)
Arguments (3)
Create a DeconvolutionLayer with 2 output channels and kernel size 3:
DeconvolutionLayer[2, 3]Specify an explicit one-dimensional kernel:
DeconvolutionLayer[2, {3}]Specify an explicit two-dimensional kernel:
DeconvolutionLayer[2, {3, 3}]Ports (3)
Specify that the "Input" port of the layer takes a array of size 3×64×64:
DeconvolutionLayer[2, {3, 3}, "Input" -> {3, 64, 64}]Specify the "Input" and "Output" ports explicitly:
DeconvolutionLayer[2, {3, 3}, "Input" -> {3, 64, 64}, "Output" -> {2, 66, 66}]Attach an image encoder/decoder to the layer "Input" and "Output" ports:
deconv = DeconvolutionLayer[3, {2, 2}, "Input" -> NetEncoder[{"Image", {28, 28}, "Grayscale"}], "Output" -> NetDecoder[{"Image", "RGB"}]]//NetInitializeApply the initialized layer to an input:
deconv[[image]]Options (12)
"Biases" (1)
Create a randomly initialized DeconvolutionLayer without biases:
deconv = NetInitialize@DeconvolutionLayer[2, {4, 4}, "Input" -> {1, 40, 40}, "Biases" -> None]NetExtract[deconv, "Biases"]"ChannelGroups" (1)
Create and initialize a DeconvolutionLayer with more than one channel group:
deconv =
NetInitialize@
DeconvolutionLayer[3, {3, 3}, "Input" -> NetEncoder["Image"], "Output" -> NetDecoder["Image"], "ChannelGroups" -> 3]deconv[[image]]```"Dilation" (2)
A dilation factor of size n on a given dimension effectively applies the kernel to elements of the output arrays that are distance n apart.
Create a one-dimensional DeconvolutionLayer with a dilation factor of 2:
deconv = DeconvolutionLayer["Weights" -> {{{0.5, 0.5}}}, "Biases" -> None, "Dilation" -> 2]deconv[{{0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}}] // NormalCreate a random two-dimensional DeconvolutionLayer with a dilation factor of 5:
deconv = NetInitialize@DeconvolutionLayer[3, {3, 3}, "Dilation" -> 5, "Input" -> NetEncoder[ "Image"], "Output" -> NetDecoder["Image"]]Apply the dilated convolution layer to an image:
deconv[[image]]Interleaving (1)
Create a DeconvolutionLayer with InterleavingFalse and one input channel:
DeconvolutionLayer[1, 5, "Input" -> {1, 25, 25}, Interleaving -> False]Create a DeconvolutionLayer with InterleavingTrue and one input channel:
DeconvolutionLayer[1, 5, "Input" -> {25, 25, 1}, Interleaving -> True]LearningRateMultipliers (1)
Create a DeconvolutionLayer that will never change during training:
NetInitialize@DeconvolutionLayer[5, {7, 7}, "Input" -> {3, 12, 12}, LearningRateMultipliers -> 0]PaddingSize (4)
By default, no cropping is applied to the output:
DeconvolutionLayer[1, 2, "Input" -> {1, 25, 25}]Crop by a fixed amount using PaddingSizen:
DeconvolutionLayer[1, 2, "Input" -> {1, 25, 25}, PaddingSize -> 1]Crop each dimension by a specific amount:
DeconvolutionLayer[1, 2, "Input" -> {1, 25, 25}, PaddingSize -> {1, 2}]Use padding to make the output dimensions equivalent to the input dimensions:
DeconvolutionLayer[1, 5, "Input" -> {1, 25, 25}, PaddingSize -> 2]This is equivalent to PaddingSize "Same":
deconv = DeconvolutionLayer[1, 5, "Input" -> {1, 25, 25}, PaddingSize -> "Same"]In general, PaddingSize "Same" gives an output size equal to the input size multiplied by the stride:
DeconvolutionLayer[1, 5, "Input" -> {1, 25, 25}, PaddingSize -> "Same", "Stride" -> 2]"Stride" (1)
Use a larger stride to increase the dimension of the output:
deconv1 = DeconvolutionLayer[3, 7, "Input" -> {3, 32, 32}, "Stride" -> 1 ]deconv1[["Output"]]deconv2 = DeconvolutionLayer[3, 7, "Input" -> {3, 32, 32}, "Stride" -> 7 ]deconv2[["Output"]]Properties & Relations (1)
The following function computes the size of the non-channel dimensions
, given the input size and parameters:
outputSize[inputSize_List, kernSize_, stride_, pad_] := (stride * (inputSize - 1) + kernSize - 2 * pad)The output size of an input of size {256,120}, a kernel size of 3, a stride of 2, and a padding size of 2:
outputSize[{256, 120}, 5, 3, 2]Compare with the actual layer (using an arbitrary channel value):
Information[DeconvolutionLayer[11, 5, "Input" -> {11, 256, 120}, "Stride" -> 3, "PaddingSize" -> 2], "OutputPorts"]Tech Notes
Related Guides
Text
Wolfram Research (2016), DeconvolutionLayer, Wolfram Language function, https://reference.wolfram.com/language/ref/DeconvolutionLayer.html (updated 2020).
CMS
Wolfram Language. 2016. "DeconvolutionLayer." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/DeconvolutionLayer.html.
APA
Wolfram Language. (2016). DeconvolutionLayer. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DeconvolutionLayer.html
BibTeX
@misc{reference.wolfram_2026_deconvolutionlayer, author="Wolfram Research", title="{DeconvolutionLayer}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/DeconvolutionLayer.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_deconvolutionlayer, organization={Wolfram Research}, title={DeconvolutionLayer}, year={2020}, url={https://reference.wolfram.com/language/ref/DeconvolutionLayer.html}, note=[Accessed: 12-June-2026]}