({{, (RefLink[DeconvolutionLayer, paclet:ref/DeconvolutionLayer])[n,sz]
represents a trainable deconvolutional net layer having n output channels and using kernels of size sz to compute the deconvolution.}, {, (RefLink[DeconvolutionLayer, paclet:ref/DeconvolutionLayer])[n,{s}]
represents a layer performing one-dimensional deconvolutions with kernels of size s.}, {, (RefLink[DeconvolutionLayer, paclet:ref/DeconvolutionLayer])[n,{h,w}]
represents a layer performing two-dimensional deconvolutions with kernels of size h×w.}, {, (RefLink[DeconvolutionLayer, paclet:ref/DeconvolutionLayer])[n,kernel,opts]
includes options for initial kernels and other parameters. }})

OpenersNotesSection(Spacer1)Details and Options

The following optional parameters can be included:

The settings for "PaddingSize" and "Stride" can be of the following forms:

With (RefLink[Automatic, paclet:ref/Automatic]) settings, weights and biases are added automatically when (RefLink[NetInitialize, paclet:ref/NetInitialize]) or (RefLink[NetTrain, paclet:ref/NetTrain]) is used.

The setting "Biases"->(RefLink[None, paclet:ref/None]) specifies that no biases should be used.

With the setting "Interleaving"->(RefLink[False, paclet:ref/False]), the channel dimension is taken to be the first dimension of the input and output arrays.

With the setting "Interleaving"->(RefLink[True, paclet:ref/True]), the channel dimension is taken to be the last dimension of the input and output arrays.

If weights and biases have been added, (RefLink[DeconvolutionLayer, paclet:ref/DeconvolutionLayer])[…][input] explicitly computes the output from applying the layer.

(RefLink[DeconvolutionLayer, paclet:ref/DeconvolutionLayer])[…][{(Subscript[input, 1]),(Subscript[input, 2]),…}] explicitly computes outputs for each of the (Subscript[input, i]).

When given a (RefLink[NumericArray, paclet:ref/NumericArray]) as input, the output will be a (RefLink[NumericArray, paclet:ref/NumericArray]).

(RefLink[NetExtract, paclet:ref/NetExtract]) can be used to extract weights and biases from a (RefLink[DeconvolutionLayer, paclet:ref/DeconvolutionLayer]) object.

(RefLink[DeconvolutionLayer, paclet:ref/DeconvolutionLayer]) is typically used inside (RefLink[NetChain, paclet:ref/NetChain]), (RefLink[NetGraph, paclet:ref/NetGraph]), etc.

(RefLink[DeconvolutionLayer, paclet:ref/DeconvolutionLayer]) exposes the following ports for use in (RefLink[NetGraph, paclet:ref/NetGraph]) etc.:

When it cannot be inferred from other layers in a larger net, the option "Input"->{(Subscript[d, 1]),(Subscript[d, 2]),(Subscript[d, 3])} can be used to fix the input dimensions of (RefLink[DeconvolutionLayer, paclet:ref/DeconvolutionLayer]).

Given an input array of dimensions (Subscript[d, 1])×(Subscript[d, 2])×(Subscript[d, 3]), the output array will be of dimensions (Subscript[(OverTilde[d]), 1])×(Subscript[(OverTilde[d]), 2])×(Subscript[(OverTilde[d]), 3]), where the channel dimension (Subscript[(OverTilde[d]), 1])=n and the sizes (Subscript[d, 2]) and (Subscript[d, 3]) are transformed according to (Subscript[(OverTilde[d]), i])=s((Subscript[d, i])-1)+k-2p, where p is the padding size, k is the kernel size, and s is the stride size for each dimension.

OpenersPrimaryExamplesSection(Spacer1)Examples  (9)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Create a (RefLink[DeconvolutionLayer, paclet:ref/DeconvolutionLayer]) with five output channels and a 2×2 kernel size:

DeconvolutionLayer[5,{2,2}]

Create a randomly initialized (RefLink[DeconvolutionLayer, paclet:ref/DeconvolutionLayer]) with the input dimensions specified:

deconv=NetInitialize@DeconvolutionLayer[1,{2,2},"Input"->{1,2,2}]

Apply the layer to an input tensor to produce an output tensor:

deconv[{{{1,1},{1,-2}}}]//MatrixForm

Create a randomly initialized (RefLink[DeconvolutionLayer, paclet:ref/DeconvolutionLayer]) that takes in an image and produces an image:

deconv=NetInitialize@DeconvolutionLayer[3,{3,3},"Input"-> NetEncoder["Image"],"Output"->NetDecoder["Image"]]

Apply the layer to an image:

deconv[]

Thread the layer over a batch of inputs:

deconv[{,}]

OpenersExampleSection1(Spacer1)Options  (5)

OpenersExampleSubsection0(Spacer1)"Biases"  (1)

Create a randomly initialized (RefLink[DeconvolutionLayer, paclet:ref/DeconvolutionLayer]) without biases:

deconv=NetInitialize@DeconvolutionLayer[2,{4,4},"Input"->{1,40,40},"Biases"-> None]

No biases are present:

NetExtract[deconv,"Biases"]

OpenersExampleSubsection1(Spacer1)"Interleaving"  (1)

Create a (RefLink[DeconvolutionLayer, paclet:ref/DeconvolutionLayer]) with "Interleaving"->(RefLink[False, paclet:ref/False]) and one input channel:

DeconvolutionLayer[1,5,"Input"-> {1,25,25},"Interleaving"->False ]

Create a (RefLink[DeconvolutionLayer, paclet:ref/DeconvolutionLayer]) with "Interleaving"->(RefLink[True, paclet:ref/True]) and one input channel:

DeconvolutionLayer[1,5,"Input"-> {25,25,1},"Interleaving"->True ]

OpenersExampleSubsection2(Spacer1)"PaddingSize"  (1)

Use padding to make the output dimensions equivalent to the input dimensions:

deconv=DeconvolutionLayer[1,5,"Input"-> {1,25,25},"PaddingSize"->2 ]

deconv[["Input"]]==deconv[["Output"]]

OpenersExampleSubsection3(Spacer1)"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"]]

OpenersExampleSubsection4(Spacer1)"Weights"  (1)

Create a deconvolution layer with specified weights and no biases:

deconv=DeconvolutionLayer[1,{2,3},"Input"->{1,2,2},"Biases"-> None,"Weights"-> RandomReal[1,{1,1,2,3}]]

Evaluate this layer on data:

deconv[RandomReal[1,{1,2,2}]]//MatrixForm

OpenersExampleSection2(Spacer1)Properties & Relations  (1)

The following function computes the size of the non-channel dimensions c, 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},3,2,2]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[ConvolutionLayer, paclet:ref/ConvolutionLayer])  ▪  (RefLink[NetChain, paclet:ref/NetChain])  ▪  (RefLink[NetGraph, paclet:ref/NetGraph])  ▪  (RefLink[NetInitialize, paclet:ref/NetInitialize])  ▪  (RefLink[NetTrain, paclet:ref/NetTrain])  ▪  (RefLink[NetExtract, paclet:ref/NetExtract])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Neural Networks in the Wolfram Language, paclet:tutorial/NeuralNetworksOverview])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Neural Networks, paclet:guide/NeuralNetworks])}})}})