主要内容

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 [HWC] and blocks of size [heightwidth], 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. TheblockSizeinput sets theBlockSizeproperty.

example

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

Properties

expand all

Block size to reorder the input activation, specified as a vector of two positive integers[h w], wherehis the height andwis the width. When creating the layer, you can specifyBlockSize作为一个标量使用相同的值both dimensions.

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

Layer name, specified as a character vector or a string scalar. ForLayerarray input, thetrainNetwork,assembleNetwork,layerGraph, anddlnetworkfunctions automatically assign names to layers with name''.

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™.

Version History

Introduced in R2020b

See Also

(有限公司mputer Vision Toolbox)|(有限公司mputer Vision Toolbox)|||

Topics