DML_MAX_POOLING2_OPERATOR_DESC structure (directml.h)
Computes the maximum value across the elements within the sliding window over the input tensor, and optionally returns the indices of the maximum values selected.
Syntax
struct DML_MAX_POOLING2_OPERATOR_DESC {
const DML_TENSOR_DESC *InputTensor;
const DML_TENSOR_DESC *OutputTensor;
const DML_TENSOR_DESC *OutputIndicesTensor;
UINT DimensionCount;
const UINT *Strides;
const UINT *WindowSize;
const UINT *StartPadding;
const UINT *EndPadding;
const UINT *Dilations;
};
Members
InputTensor
Type: const DML_TENSOR_DESC*
An input tensor of Sizes { BatchCount, ChannelCount, Height, Width }
if InputTensor.DimensionCount is 4, and { BatchCount, ChannelCount, Depth, Height, Weight }
if InputTensor.DimensionCount is 5.
OutputTensor
Type: const DML_TENSOR_DESC*
An output tensor to write the results to. The sizes of the output tensor can be computed as follows.
OutputTensor->Sizes[0] = InputTensor->Sizes[0];
OutputTensor->Sizes[1] = InputTensor->Sizes[1];
for (UINT i = 0; i < DimensionCount; ++i) {
UINT PaddedSize = InputTensor->Sizes[i + 2] + StartPadding[i] + EndPadding[i];
OutputTensor->Sizes[i + 2] = (PaddedSize - WindowSizes[i]) / Strides[i] + 1;
}
OutputIndicesTensor
Type: _Maybenull_ const DML_TENSOR_DESC*
An optional output tensor of indices to the input tensor InputTensor of the maximum values produced and stored in the OutputTensor. These index values are zero-based and treat the input tensor as a contiguous one-dimensional array. When multiple elements within the sliding window have the same value, the later equal values are ignored and the index points to the first value encountered. Both the OutputTensor and OutputIndicesTensor have the same tensor sizes.
DimensionCount
Type: UINT
The number of spatial dimensions of the input tensor InputTensor, which also corresponds to the number of dimensions of the sliding window WindowSize. This value also determines the size of the Strides, StartPadding, and EndPadding arrays. It should be set to 2 when InputTensor is 4D, and 3 when it's a 5D tensor.
Strides
Type: _Field_size_(DimensionCount) const UINT*
The strides for the sliding window dimensions of sizes { Height, Width }
when the DimensionCount is set to 2, or { Depth, Height, Width }
when set to 3.
WindowSize
Type: _Field_size_(DimensionCount) const UINT*
The dimensions of the sliding window in { Height, Width }
when DimensionCount is set to 2, or { Depth, Height, Width }
when set to 3.
StartPadding
Type: _Field_size_(DimensionCount) const UINT*
The number of padding elements to be applied to the beginning of each spatial dimension of the input tensor InputTensor. The values are in { Height, Width }
when DimensionCount is set to 2, or { Depth, Height, Width }
when set to 3.
EndPadding
Type: _Field_size_(DimensionCount) const UINT*
The number of padding elements to be applied to the end of each spatial dimension of the input tensor InputTensor. The values are in { Height, Width }
when DimensionCount is set to 2, or { Depth, Height, Width }
when set to 3.
Dilations
Type: _Field_size_(DimensionCount) const UINT*
The values for each spatial dimension of the input tensor InputTensor by which an element within the sliding window is selected for every elements of that value. The values are in { Height, Width }
when DimensionCount is set to 2, or { Depth, Height, Width }
when set to 3.
Remarks
DML_MAX_POOLING2_OPERATOR_DESC supersedes the earlier version DML_MAX_POOLING_OPERATOR1_DESC with an additional constant array Dilations. The two versions are equivalent when Dilations is set to { 1,1 }
for 4D input, or { 1,1,1 }
for 5D input features.
Availability
This operator was introduced in DML_FEATURE_LEVEL_2_1
.
Tensor constraints
- InputTensor, OutputIndicesTensor, and OutputTensor must have the same DimensionCount.
- InputTensor and OutputTensor must have the same DataType.
Tensor support
DML_FEATURE_LEVEL_5_0 and above
Tensor | Kind | Supported dimension counts | Supported data types |
---|---|---|---|
InputTensor | Input | 4 to 5 | FLOAT32, FLOAT16, INT64, INT32, INT16, INT8, UINT64, UINT32, UINT16, UINT8 |
OutputTensor | Output | 4 to 5 | FLOAT32, FLOAT16, INT64, INT32, INT16, INT8, UINT64, UINT32, UINT16, UINT8 |
OutputIndicesTensor | Optional output | 4 to 5 | UINT64, UINT32 |
DML_FEATURE_LEVEL_3_0 and above
Tensor | Kind | Supported dimension counts | Supported data types |
---|---|---|---|
InputTensor | Input | 4 to 5 | FLOAT32, FLOAT16, INT8, UINT8 |
OutputTensor | Output | 4 to 5 | FLOAT32, FLOAT16, INT8, UINT8 |
OutputIndicesTensor | Optional output | 4 to 5 | UINT32 |
DML_FEATURE_LEVEL_2_1 and above
Tensor | Kind | Supported dimension counts | Supported data types |
---|---|---|---|
InputTensor | Input | 4 to 5 | FLOAT32, FLOAT16 |
OutputTensor | Output | 4 to 5 | FLOAT32, FLOAT16 |
OutputIndicesTensor | Optional output | 4 to 5 | UINT32 |
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 10, version 2004 (10.0; Build 19041) |
Minimum supported server | Windows Server, version 2004 (10.0; Build 19041) |
Header | directml.h |