Main Content

spaceToDepthLayer

R2026b

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.

layer = spaceToDepthLayer(blockSize,Name=name) creates a space to depth layer and sets the Name property as the value name.

example

Input Arguments

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.

This argument sets the BlockSize property.

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

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. For Layer array input, the trainnet (Deep Learning Toolbox) and dlnetwork (Deep Learning Toolbox) functions automatically assign names to unnamed layers.

Data Types: char

This property is read-only.

Number of inputs to the layer, represented as 1. This layer has a single input only.

Data Types: double

This property is read-only.

Input name, represented as {'in'}. This layer has a single input only.

This property is read-only.

Number of outputs from the layer, represented as 1. This layer has a single output only.

Data Types: double

This property is read-only.

Output name, represented as {'out'}. This layer has a single output only.

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

expand all

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

Version History

Introduced in R2020b

expand all

See Also

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

Topics