DML_SPACE_TO_DEPTH1_OPERATOR_DESC structure (directml.h)

Rearranges blocks of spatial data into depth. The operator outputs a copy of the input tensor where values from the height and width dimensions are moved to the depth dimension.

This is the inverse transformation of DML_DEPTH_TO_SPACE1_OPERATOR_DESC.

Syntax

struct DML_SPACE_TO_DEPTH1_OPERATOR_DESC {
  const DML_TENSOR_DESC *InputTensor;
  const DML_TENSOR_DESC *OutputTensor;
  UINT                  BlockSize;
  DML_DEPTH_SPACE_ORDER Order;
};

Members

InputTensor

Type: const DML_TENSOR_DESC*

The tensor to read from. The input tensor's dimensions are { Batch, Channels, Height, Width }.

OutputTensor

Type: const DML_TENSOR_DESC*

The tensor to write the results to. The output tensor's dimensions are { Batch, Channels / (BlockSize * BlockSize), Height * BlockSize, Width * BlockSize }.

BlockSize

Type: UINT

The width and height of the Blocks that are moved.

Order

Type: DML_DEPTH_SPACE_ORDER

See DML_DEPTH_SPACE_ORDER.

Examples

Example 1. Depth-column-row order

BlockSize: 2
Order: DML_DEPTH_SPACE_ORDER_DEPTH_COLUMN_ROW
InputTensor: (Sizes:{1, 2, 4, 6}, DataType:UINT32)
 [[[[ 0, 18,  1, 19,  2, 20],
    [36, 54, 37, 55, 38, 56],
    [ 3, 21,  4, 22,  5, 23],
    [39, 57, 40, 58, 41, 59]],
   [[ 9, 27, 10, 28, 11, 29],
    [45, 63, 46, 64, 47, 65],
    [12, 30, 13, 31, 14, 32],
    [48, 66, 49, 67, 50, 68]]]]

OutputTensor: (Sizes:{1, 8, 2, 3}, DataType:UINT32)
[[[[0,   1,  2],
   [3,   4,  5]],
  [[9,  10, 11],
   [12, 13, 14]],
  [[18, 19, 20],
   [21, 22, 23]],
  [[27, 28, 29],
   [30, 31, 32]],
  [[36, 37, 38],
   [39, 40, 41]],
  [[45, 46, 47],
   [48, 49, 50]],
  [[54, 55, 56],
   [57, 58, 59]],
  [[63, 64, 65],
   [66, 67, 68]]]]

Example 2. Column-row-depth order

BlockSize: 2
Order: DML_DEPTH_SPACE_ORDER_COLUMN_ROW_DEPTH
InputTensor: (Sizes:{1, 2, 4, 6}, DataType:UINT32)
[[[[ 0,  9,  1, 10,  2, 11],
   [18, 27, 19, 28, 20, 29],
   [ 3, 12,  4, 13,  5, 14],
   [21, 30, 22, 31, 23, 32]],
  [[36, 45, 37, 46, 38, 47],
   [54, 63, 55, 64, 56, 65],
   [39, 48, 40, 49, 41, 50],
   [57, 66, 58, 67, 59, 68]]]]
OutputTensor: (Sizes:{1, 8, 2, 3}, DataType:UINT32)
[[[[0,   1,  2],
   [3,   4,  5]],
  [[9,  10, 11],
   [12, 13, 14]],
  [[18, 19, 20],
   [21, 22, 23]],
  [[27, 28, 29],
   [30, 31, 32]],
  [[36, 37, 38],
   [39, 40, 41]],
  [[45, 46, 47],
   [48, 49, 50]],
  [[54, 55, 56],
   [57, 58, 59]],
  [[63, 64, 65],
   [66, 67, 68]]]]

Remarks

When the Order parameter is set to DML_DEPTH_SPACE_ORDER_DEPTH_COLUMN_ROW, this operator is equivalent to DML_SPACE_TO_DEPTH_OPERATOR_DESC.

Availability

This operator was introduced in DML_FEATURE_LEVEL_2_1.

Tensor constraints

InputTensor and OutputTensor must have the same DataType.

Tensor support

DML_FEATURE_LEVEL_5_0 and above

Tensor Kind Dimensions Supported dimension counts Supported data types
InputTensor Input { BatchCount, InputChannelCount, InputHeight, InputWidth } 4 FLOAT64, FLOAT32, FLOAT16, INT64, INT32, INT16, INT8, UINT64, UINT32, UINT16, UINT8
OutputTensor Output { BatchCount, OutputChannelCount, OutputHeight, OutputWidth } 4 FLOAT64, FLOAT32, FLOAT16, INT64, INT32, INT16, INT8, UINT64, UINT32, UINT16, UINT8

DML_FEATURE_LEVEL_2_1 and above

Tensor Kind Dimensions Supported dimension counts Supported data types
InputTensor Input { BatchCount, InputChannelCount, InputHeight, InputWidth } 4 FLOAT32, FLOAT16, INT32, INT16, INT8, UINT32, UINT16, UINT8
OutputTensor Output { BatchCount, OutputChannelCount, OutputHeight, OutputWidth } 4 FLOAT32, FLOAT16, INT32, INT16, INT8, UINT32, UINT16, UINT8

Requirements

Requirement Value
Minimum supported client Windows 10 Build 20348
Minimum supported server Windows 10 Build 20348
Header directml.h