enum dnnl_normalization_flags_t¶
Overview¶
Flags for normalization primitives. More…
#include <dnnl_types.h> enum dnnl_normalization_flags_t { dnnl_normalization_flags_none = 0x0U, dnnl_use_global_stats = 0x1U, dnnl_use_scale = 0x2U, dnnl_use_shift = 0x4U, dnnl_fuse_norm_relu = 0x8U, dnnl_fuse_norm_add_relu = 0x10U, dnnl_rms_norm = 0x20U, };
Detailed Documentation¶
Flags for normalization primitives.
Enum Values¶
dnnl_normalization_flags_none
Use no normalization flags.
If specified, the library computes mean and variance on forward propagation for training and inference, outputs them on forward propagation for training, and computes the respective derivatives on backward propagation.
Note
Backward propagation of type prop_kind == dnnl_backward_data has the same behavior as prop_kind == dnnl_backward.
dnnl_use_global_stats
Use global statistics.
If specified, the library uses mean and variance provided by the user as an input on forward propagation and does not compute their derivatives on backward propagation. Otherwise, the library computes mean and variance on forward propagation for training and inference, outputs them on forward propagation for training, and computes the respective derivatives on backward propagation.
dnnl_use_scale
Use scale parameter.
If specified, the user is expected to pass scale as input on forward propagation. On backward propagation of type dnnl_backward, the library computes its derivative.
dnnl_use_shift
Use shift parameter.
If specified, the user is expected to pass shift as input on forward propagation. On backward propagation of type dnnl_backward, the library computes its derivative.
dnnl_fuse_norm_relu
Fuse normalization with ReLU.
On training, normalization will require the workspace to implement backward propagation. On inference, the workspace is not required and behavior is the same as when normalization is fused with ReLU using the post-ops API.
Note
The flag implies negative slope being 0. On training this is the only configuration supported. For inference, to use non-zero negative slope consider using Primitive Attributes: Post-ops.
dnnl_fuse_norm_add_relu
Fuse normalization with an elementwise binary Add operation followed by ReLU.
During training, normalization will require a workspace to implement backward propagation. For inference, the workspace is not needed. On forward propagation, an elementwise binary Add operation is applied to the normalization results with an additional input tensor, followed by ReLU with a negative slope of 0. On backward propagation, the result of the backward ReLU operation with the input tensor and workspace from the forward pass is saved to an extra output tensor, and backward normalization is performed.
dnnl_rms_norm
Use Root Mean Square (RMS) Normalization.
In forward propagation, the mean is considered zero, and RMS norm is used instead of variance for scaling. Only the RMS norm is output during forward propagation for training. In backward propagation, the library calculates the derivative with respect to the RMS norm only, assuming the mean is zero.
Note
When used with dnnl_use_global_stats, only RMS norm is required to be provided as input.