DML_MEAN_VARIANCE_NORMALIZATION1_OPERATOR_DESC structure (directml.h)

Performs a mean variance normalization function on the input tensor. This operator will calculate the mean and variance of the input tensor to perform normalization. This operator performs the following computation.

Output = FusedActivation(Scale * ((Input - Mean) / sqrt(Variance + Epsilon)) + Bias).

Syntax

struct DML_MEAN_VARIANCE_NORMALIZATION1_OPERATOR_DESC {
  const DML_TENSOR_DESC   *InputTensor;
  const DML_TENSOR_DESC   *ScaleTensor;
  const DML_TENSOR_DESC   *BiasTensor;
  const DML_TENSOR_DESC   *OutputTensor;
  UINT                    AxisCount;
  const UINT              *Axes;
  BOOL                    NormalizeVariance;
  FLOAT                   Epsilon;
  const DML_OPERATOR_DESC *FusedActivation;
};

Members

InputTensor

Type: const DML_TENSOR_DESC*

A tensor containing the Input data. This tensor's dimensions should be { BatchCount, ChannelCount, Height, Width }.

ScaleTensor

Type: _Maybenull_ const DML_TENSOR_DESC*

An optional tensor containing the Scale data.

If DML_FEATURE_LEVEL is less than DML_FEATURE_LEVEL_4_0, then this tensor's dimensions should be { ScaleBatchCount, ChannelCount, ScaleHeight, ScaleWidth }. The dimensions ScaleBatchCount, ScaleHeight, and ScaleWidth should either match InputTensor, or be set to 1 to automatically broadcast those dimensions across the input.

If DML_FEATURE_LEVEL is greater than or equal to DML_FEATURE_LEVEL_4_0, then any dimension can be set to 1, and be automatically broadcast to match InputTensor.

If DML_FEATURE_LEVEL is less than DML_FEATURE_LEVEL_5_2, then this tensor is required if BiasTensor is present. If DML_FEATURE_LEVEL is greater than or equal to DML_FEATURE_LEVEL_5_2, then this tensor can be null regardless of the value of BiasTensor.

BiasTensor

Type: _Maybenull_ const DML_TENSOR_DESC*

An optional tensor containing the Bias data.

If DML_FEATURE_LEVEL is less than DML_FEATURE_LEVEL_4_0, then this tensor's dimensions should be { BiasBatchCount, ChannelCount, BiasHeight, BiasWidth }. The dimensions BiasBatchCount, BiasHeight, and BiasWidth should either match InputTensor, or be set to 1 to automatically broadcast those dimensions across the input.

If DML_FEATURE_LEVEL is greater than or equal to DML_FEATURE_LEVEL_4_0, then any dimension can be set to 1, and be automatically broadcast to match InputTensor.

If DML_FEATURE_LEVEL is less than DML_FEATURE_LEVEL_5_2, then this tensor is required if ScaleTensor is present. If DML_FEATURE_LEVEL is greater than or equal to DML_FEATURE_LEVEL_5_2, then this tensor can be null regardless of the value of ScaleTensor.

OutputTensor

Type: const DML_TENSOR_DESC*

A tensor to write the results to. This tensor's dimensions are { BatchCount, ChannelCount, Height, Width }.

AxisCount

Type: UINT

The number of axes. This field determines the size of the Axes array.

Axes

Type: _Field_size_(AxisCount) const UINT*

The axes along which to calculate the Mean and Variance.

NormalizeVariance

Type: BOOL

TRUE if the Normalization layer includes Variance in the normalization calculation. Otherwise, FALSE. If FALSE, then normalization equation is Output = FusedActivation(Scale * (Input - Mean) + Bias).

Epsilon

Type: FLOAT

The epsilon value to use to avoid division by zero. A value of 0.00001 is recommended as default.

FusedActivation

Type: _Maybenull_ const DML_OPERATOR_DESC*

An optional fused activation layer to apply after the normalization.

Remarks

DML_MEAN_VARIANCE_NORMALIZATION1_OPERATOR_DESC is a superset of functionality of DML_MEAN_VARIANCE_NORMALIZATION_OPERATOR_DESC. Here, setting the Axes array to { 2, 3 } is the equivalent of setting CrossChannel to FALSE in DML_MEAN_VARIANCE_NORMALIZATION_OPERATOR_DESC; while setting the Axes array to { 1, 2, 3 } is equivalent of setting CrossChannel to TRUE.

Availability

This operator was introduced in DML_FEATURE_LEVEL_2_1.

Tensor constraints

BiasTensor, InputTensor, OutputTensor, and ScaleTensor must have the same DataType and DimensionCount.

Tensor support

DML_FEATURE_LEVEL_3_1 and above

Tensor Kind Supported dimension counts Supported data types
InputTensor Input 1 to 8 FLOAT32, FLOAT16
ScaleTensor Optional input 1 to 8 FLOAT32, FLOAT16
BiasTensor Optional input 1 to 8 FLOAT32, FLOAT16
OutputTensor Output 1 to 8 FLOAT32, FLOAT16

DML_FEATURE_LEVEL_2_1 and above

Tensor Kind Supported dimension counts Supported data types
InputTensor Input 4 FLOAT32, FLOAT16
ScaleTensor Optional input 4 FLOAT32, FLOAT16
BiasTensor Optional input 4 FLOAT32, FLOAT16
OutputTensor Output 4 FLOAT32, FLOAT16

Requirements

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

See also

Using fused operators for improved performance