Main Content

spaceToDepthLayer

Space to depth layer

Description

A space to depth layer permutes the spatial blocks of the input into the depth dimension. Use this layer when you need to combine feature maps of different size without discarding any feature data.

Given an input feature map of size [H W C] and blocks of size [height width], the output feature map size is [floor(H/height) floor(W/width) C*height*width].

This object requires Deep Learning Toolbox™.

Creation

Description

layer = spaceToDepthLayer(blockSize) creates a space to depth layer, specifying the block size to reorder the input activation. The blockSize input sets the BlockSize property.

example

layer = spaceToDepthLayer(blockSize,'Name',Name) creates a space to depth layer and sets the optional Name property.

Properties

expand all

Block size to reorder the input activation, specified as a vector of two positive integers [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 dimensions.

Example: [2 1] specifies blocks of height 2 and width 1.

Layer name, specified as a character vector or a string scalar. For Layer array input, the trainNetwork, assembleNetwork, layerGraph, and dlnetwork functions automatically assign names to layers with Name set to ''.

Data Types: char | string

This property is read-only.

Number of inputs of the layer. This layer accepts a single input only.

Data Types: double

This property is read-only.

Input names of the layer. This layer accepts a single input only.

Data Types: cell

This property is read-only.

Number of outputs of the layer. This layer has a single output only.

Data Types: double

This property is read-only.

Output names of the layer. This layer has a single output only.

Data Types: cell

Examples

collapse all

Specify the block size to reorder input activations.

blockSize = [2 2];

Create a space to depth layer named 'spacetodepth'.

layer = spaceToDepthLayer(blockSize,'Name','spacetodepth')
layer = 
  SpaceToDepthLayer with properties:

         Name: 'spacetodepth'
    BlockSize: [2 2]

   Learnable Parameters
    No properties.

   State Parameters
    No properties.

  Show all properties

Extended Capabilities

GPU Arrays
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.

See Also

(Computer Vision Toolbox) | (Computer Vision Toolbox) | | |

Topics

Introduced in R2020b