Depth to space layer
A 2-D depth to space layer permutes data from the depth dimension into blocks of 2-D spatial data.
Given an input feature map of size [H
and blocks of size [height
width], the output feature map size is
This object requires Deep Learning Toolbox™.
layer = depthToSpace2dLayer(blockSize) creates a 2-D depth to
space layer, specifying the block size to rearrange the input activation. The
blockSize input sets the BlockSize property.
depthToSpace2dLayer(blockSize,"Mode","CRD")creates a 2-D depth to space layer that orders data by column, row, and then depth.
BlockSize— Block size to reorder input activation
Block size to reorder the input activation, specified as a vector of two positive
[h w], where
h is the height and
w is the width. When creating the layer, you can specify
BlockSize as a scalar to use the same value for both
[2 1] specifies blocks of height 2 and width 1.
Mode— Order of rearranged dimensions
Order of rearranged dimensions from the input data, specified as
"crd". When you specify
"dcr", the layer orders data by depth, column, and then row. When
"crd", the layer orders data by column, row, and then
NumInputs— Number of inputs
Number of inputs of the layer. This layer accepts a single input only.
InputNames— Input names
Input names of the layer. This layer accepts a single input only.
NumOutputs— Number of outputs
Number of outputs of the layer. This layer has a single output only.
OutputNames— Output names
Output names of the layer. This layer has a single output only.
Specify the block size for reordering input activations.
blockSize = [2 2];
Create a 2-D depth to space layer that orders data by column, row, and then depth.
layer = depthToSpace2dLayer(blockSize,"Mode","crd","Name","depthToSpaceLayer")
layer = DepthToSpace2DLayer with properties: Name: 'depthToSpaceLayer' BlockSize: [2 2] Mode: "crd" Show all properties
To generate CUDA® or C++ code by using GPU Coder™, you must first construct and train a deep neural network. Once the network is trained and evaluated, you can configure the code generator to generate code and deploy the convolutional neural network on platforms that use NVIDIA® or ARM® GPU processors. For more information, see Deep Learning with GPU Coder (GPU Coder).
For this layer, you can generate code that takes advantage of the NVIDIA
CUDA deep neural network library (cuDNN), NVIDIA
TensorRT™ high performance inference library, or the ARM
Compute Library for Mali GPU.