DML_LP_POOLING_OPERATOR_DESC structure (directml.h)

Computes the Lp-normalized value across the elements within the sliding window over the input tensor.

Syntax

struct DML_LP_POOLING_OPERATOR_DESC {
  const DML_TENSOR_DESC *InputTensor;
  const DML_TENSOR_DESC *OutputTensor;
  UINT                  DimensionCount;
  const UINT            *Strides;
  const UINT            *WindowSize;
  const UINT            *StartPadding;
  const UINT            *EndPadding;
  UINT                  P;
};

Members

InputTensor

Type: const DML_TENSOR_DESC*

An input tensor with Sizes { BatchCount, ChannelCount, Height, Width } for 4D, and { BatchCount, ChannelCount, Depth, Height, Width } for 5D.

OutputTensor

Type: const DML_TENSOR_DESC*

The output tensor to write 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;
}

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*

An array containing 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*

An array containing 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*

An array containing 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*

An array containing 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.

P

Type: UINT

The value of the P variable in the Lp-normalization function Y = (X1^P + X2^P + ... + Xn^P) ^ (1/P), where X1 to Xn representing each of the values within the sliding window. In common use cases, this value is either set to 1 or 2, representing either the L1 or L2 normalization respectively.

Availability

This operator was introduced in DML_FEATURE_LEVEL_1_0.

Tensor constraints

InputTensor and OutputTensor must have the same DataType and DimensionCount.

Tensor support

Tensor Kind Supported dimension counts Supported data types
InputTensor Input 4 to 5 FLOAT32, FLOAT16
OutputTensor Output 4 to 5 FLOAT32, FLOAT16

Requirements

Requirement Value
Header directml.h