Deep Neural Network Library (DNNL)  1.1.3
Performance library for Deep Learning
Classes | Enumerations
Generic

Classes

struct  dnnl_version_t
 Version type. More...
 

Enumerations

enum  dnnl_status_t {
  dnnl_success = 0, dnnl_out_of_memory = 1, dnnl_invalid_arguments = 2, dnnl_unimplemented = 3,
  dnnl_iterator_ends = 4, dnnl_runtime_error = 5, dnnl_not_required = 6
}
 Status values returned by the library functions. More...
 
enum  dnnl_data_type_t {
  dnnl_data_type_undef = 0, dnnl_f16 = 1, dnnl_bf16 = 2, dnnl_f32 = 3,
  dnnl_s32 = 4, dnnl_s8 = 5, dnnl_u8 = 6
}
 Data type specification. More...
 
enum  dnnl_format_kind_t {
  dnnl_format_kind_undef = 0, dnnl_format_kind_any, dnnl_blocked, dnnl_format_kind_wino,
  dnnl_format_kind_rnn_packed
}
 Memory format kind. More...
 
enum  dnnl_format_tag_t {
  dnnl_format_tag_undef = 0, dnnl_format_tag_any, dnnl_a, dnnl_ab,
  dnnl_abc, dnnl_abcd, dnnl_abcde, dnnl_abcdef,
  dnnl_abdec, dnnl_acb, dnnl_acbde, dnnl_acdb,
  dnnl_acdeb, dnnl_ba, dnnl_bac, dnnl_bacd,
  dnnl_bca, dnnl_bcda, dnnl_bcdea, dnnl_cba,
  dnnl_cdba, dnnl_cdeba, dnnl_decab , dnnl_aBc16b ,
  dnnl_aBc4b , dnnl_aBc8b , dnnl_aBcd16b , dnnl_aBcd4b ,
  dnnl_aBcd8b , dnnl_ABcd8b8a , dnnl_aBcde16b , dnnl_aBcde4b ,
  dnnl_aBcde8b , dnnl_aBcdef16b , dnnl_aBcdef4b , dnnl_format_tag_last,
  dnnl_x = dnnl_a, dnnl_nc = dnnl_ab, dnnl_cn = dnnl_ba, dnnl_tn = dnnl_ab,
  dnnl_nt = dnnl_ba, dnnl_ncw = dnnl_abc, dnnl_nwc = dnnl_acb, dnnl_nchw = dnnl_abcd,
  dnnl_nhwc = dnnl_acdb, dnnl_chwn = dnnl_bcda, dnnl_ncdhw = dnnl_abcde, dnnl_ndhwc = dnnl_acdeb,
  dnnl_oi = dnnl_ab, dnnl_io = dnnl_ba, dnnl_oiw = dnnl_abc, dnnl_owi = dnnl_acb,
  dnnl_wio = dnnl_cba, dnnl_iwo = dnnl_bca, dnnl_oihw = dnnl_abcd, dnnl_hwio = dnnl_cdba,
  dnnl_ohwi = dnnl_acdb, dnnl_ihwo = dnnl_bcda, dnnl_iohw = dnnl_bacd, dnnl_oidhw = dnnl_abcde,
  dnnl_dhwio = dnnl_cdeba, dnnl_odhwi = dnnl_acdeb, dnnl_idhwo = dnnl_bcdea, dnnl_goiw = dnnl_abcd,
  dnnl_goihw = dnnl_abcde, dnnl_hwigo = dnnl_decab, dnnl_giohw = dnnl_acbde, dnnl_goidhw = dnnl_abcdef,
  dnnl_tnc = dnnl_abc, dnnl_ntc = dnnl_bac, dnnl_ldnc = dnnl_abcd, dnnl_ldigo = dnnl_abcde,
  dnnl_ldgoi = dnnl_abdec, dnnl_ldgo = dnnl_abcd, dnnl_nCdhw16c = dnnl_aBcde16b, dnnl_nCdhw4c = dnnl_aBcde4b,
  dnnl_nCdhw8c = dnnl_aBcde8b, dnnl_nChw16c = dnnl_aBcd16b, dnnl_nChw4c = dnnl_aBcd4b, dnnl_nChw8c = dnnl_aBcd8b,
  dnnl_nCw16c = dnnl_aBc16b, dnnl_nCw4c = dnnl_aBc4b, dnnl_nCw8c = dnnl_aBc8b
}
 Memory format tag specification. More...
 
enum  dnnl_prop_kind_t {
  dnnl_prop_kind_undef = 0, dnnl_forward_training = 64, dnnl_forward_inference = 96, dnnl_forward_scoring = dnnl_forward_inference,
  dnnl_forward = dnnl_forward_training, dnnl_backward = 128, dnnl_backward_data = 160, dnnl_backward_weights = 192,
  dnnl_backward_bias = 193
}
 Kinds of propagation. More...
 
enum  dnnl_primitive_kind_t {
  dnnl_undefined_primitive, dnnl_reorder, dnnl_shuffle, dnnl_concat,
  dnnl_sum, dnnl_convolution, dnnl_deconvolution, dnnl_eltwise,
  dnnl_softmax, dnnl_pooling, dnnl_lrn, dnnl_batch_normalization,
  dnnl_layer_normalization, dnnl_inner_product, dnnl_rnn, dnnl_gemm,
  dnnl_binary
}
 Kinds of primitives. More...
 
enum  dnnl_alg_kind_t { ,
  dnnl_convolution_direct = 0x1, dnnl_convolution_winograd = 0x2, dnnl_convolution_auto = 0x3, dnnl_deconvolution_direct = 0xa,
  dnnl_deconvolution_winograd = 0xb, dnnl_eltwise_relu = 0x1f, dnnl_eltwise_tanh = 0x2f, dnnl_eltwise_elu = 0x3f,
  dnnl_eltwise_square = 0x4f, dnnl_eltwise_abs = 0x5f, dnnl_eltwise_sqrt = 0x6f, dnnl_eltwise_linear = 0x7f,
  dnnl_eltwise_bounded_relu = 0x8f, dnnl_eltwise_soft_relu = 0x9f, dnnl_eltwise_logistic = 0xaf, dnnl_eltwise_exp = 0xbf,
  dnnl_eltwise_gelu = 0xcf, dnnl_eltwise_swish = 0xdf, dnnl_pooling_max = 0x1ff, dnnl_pooling_avg_include_padding = 0x2ff,
  dnnl_pooling_avg_exclude_padding = 0x3ff , dnnl_lrn_across_channels = 0xaff, dnnl_lrn_within_channel = 0xbff, dnnl_vanilla_rnn = 0x1fff,
  dnnl_vanilla_lstm = 0x2fff, dnnl_vanilla_gru = 0x3fff, dnnl_lbr_gru = 0x4fff, dnnl_binary_add = 0x1fff0,
  dnnl_binary_mul = 0x1fff1
}
 Kinds of algorithms. More...
 
enum  dnnl_normalization_flags_t { dnnl_use_global_stats = 0x1U, dnnl_use_scaleshift = 0x2U, dnnl_fuse_norm_relu = 0x4U }
 Flags for batch normalization primitive. More...
 

Detailed Description

Enumeration Type Documentation

◆ dnnl_status_t

Status values returned by the library functions.

Enumerator
dnnl_success 

The operation was successful.

dnnl_out_of_memory 

The operation failed due to an out-of-memory condition.

dnnl_invalid_arguments 

The operation failed because of incorrect function arguments.

dnnl_unimplemented 

The operation failed because requested functionality is not implemented.

dnnl_iterator_ends 

Primitive iterator passed over last primitive descriptor.

dnnl_runtime_error 

Primitive or engine failed on execution.

dnnl_not_required 

Queried element is not required for given primitive.

◆ dnnl_data_type_t

Data type specification.

Enumerator
dnnl_data_type_undef 

Undefined data type, used for empty memory descriptors.

dnnl_f16 

16-bit/half-precision floating point.

dnnl_bf16 

non-standard 16-bit (bfloat16 w/ 7 bit mantissa) floating point.

dnnl_f32 

32-bit/single-precision floating point.

dnnl_s32 

32-bit signed integer.

dnnl_s8 

8-bit signed integer.

dnnl_u8 

8-bit unsigned integer.

◆ dnnl_format_kind_t

Memory format kind.

Enumerator
dnnl_format_kind_undef 

Undefined memory format kind, used for empty memory descriptors.

dnnl_format_kind_any 

Unspecified format kind.

The primitive selects a format automatically.

dnnl_blocked 

A tensor in a generic format described by the stride and blocking values in each dimension.

See dnnl_blocking_desc_t for more information.

dnnl_format_kind_wino 

Weights format used in 8bit Winograd convolution.

dnnl_format_kind_rnn_packed 

Packed weights format used in RNN.

◆ dnnl_format_tag_t

Memory format tag specification.

DNNL formats describe physical data layout. The physical layout is described as a sequence of the dimensions as they are laid out in the memory (from the outer-most to the inner-most). Note that this order doesn't affect the logical order of the dimensions that is kept in the dims field of the dnnl_memory_desc_t structure. The logical order of the dimensions is specified by the primitive that uses the tensor.

For example, CNN 5D tensor always has its logical dimensions in the order (batch, channels, depth, height, width), while the physical layout might be NCDHW (corresponds to dnnl_ncdhw format tag) or NDHWC (corresponds to dnnl_ndhwc format tag).

int batch = 2, channels = 16, depth = 13, height = 13, width = 13;
int ndims = 5; // 5D tensor
dnnl_dims_t dims = {batch, channels, depth, height, width};
dnnl_memory_desc_t data_in_ncdhw;
&data_in_ncdhw, 5, dims, dnnl_f32, dnnl_ncdhw);
// note that in both cases dims passed are the same
dnnl_memory_desc_t data_in_ndhwc;
&data_in_ndhwc, 5, dims, dnnl_f32, dnnl_ndhwc);

Memory format tags can be further divided into two categories:

  • Domain-agnostic names, i.e. names the do not depend on the tensor usage in the specific primitive. These names use letters from a to l to denote logical dimension from 1 to 12, and form the order in which the dimensions are laid in memory. For instance, dnnl_ab is used to denote 2D tensor where the second logical dimension (aka b) is the innermost, i.e. has stride = 1, and the first logical dimension (a) laid out in memory with stride equal to the size of second dimension. On the other hand, dnnl_ba is just transposed version of the same tensor: the first dimension (a) becomes the innermost one.
  • Domain-specific names, i.e. names that make sense only in the context of a certain domain, such as CNN. This names are just aliases to the corresponding domain-agnostic tags and used mostly for the convenience. For example, dnnl_nc is used to denote 2D CNN activations tensor memory format, where channels are the innermost dimension and batch is an outermost one. Moreover, dnnl_nc is just an alias to dnnl_ab, since for DNNL CNN primitives the logical dimensions of activations tensors come in order: batch, channels, spatial. In other words, batch corresponds to the first logical dimension (a), channels correspond to the second one (b).

The following domain-specific notation applies to memory format tags:

  • 'n' denotes the mini-batch dimension
  • 'c' denotes a channels dimension
  • When there are multiple channel dimensions (for example, in convolution weights tensor), 'i' and 'o' denote dimensions of input and output channels
  • 'd', 'h', and 'w' denote spatial depth, height, and width respectively

Upper-case letters indicate that the data is laid out in blocks for a particular dimension. In such cases, the format name contains both upper- and lower-case letters for that dimension with a lower-case letter preceded by the block size. For example: dnnl_nChw8c describes a format where the outermost dimension is mini-batch, followed by the channel block number, followed by the spatial height and width, and finally followed by 8-element channel blocks.

See also
Understanding Memory Formats
Enumerator
dnnl_format_tag_undef 

Undefined memory format tag.

dnnl_format_tag_any 

Undefined memory format tag.

The primitive selects a format automatically.

dnnl_a 

plain 1D tensor

dnnl_ab 

plain 2D tensor

dnnl_abc 

plain 3D tensor

dnnl_abcd 

plain 4D tensor

dnnl_abcde 

plain 5D tensor

dnnl_abcdef 

plain 6D tensor

dnnl_abdec 

permuted 5D tensor

dnnl_acb 

permuted 3D tensor

dnnl_acbde 

permuted 5D tensor

dnnl_acdb 

permuted 4D tensor

dnnl_acdeb 

permuted 5D tensor

dnnl_ba 

permuted 2D tensor

dnnl_bac 

permuted 3D tensor

dnnl_bacd 

permuted 4D tensor

dnnl_bca 

permuted 3D tensor

dnnl_bcda 

permuted 4D tensor

dnnl_bcdea 

permuted 5D tensor

dnnl_cba 

permuted 3D tensor

dnnl_cdba 

permuted 4D tensor

dnnl_cdeba 

permuted 5D tensor

dnnl_decab 

permuted 5D tensor

dnnl_aBc16b 

3D tensor blocked by 2nd dimension with block size 16

dnnl_aBc4b 

3D tensor blocked by 2nd dimension with block size 4

dnnl_aBc8b 

3D tensor blocked by 2nd dimension with block size 8

dnnl_aBcd16b 

4D tensor blocked by 2nd dimension with block size 16

dnnl_aBcd4b 

4D tensor blocked by 2nd dimension with block size 4

dnnl_aBcd8b 

4D tensor blocked by 2nd dimension with block size 8

dnnl_ABcd8b8a 

4D tensor blocked by 1st and 2nd dimension with block size 8

dnnl_aBcde16b 

5D tensor blocked by 2nd dimension with block size 16

dnnl_aBcde4b 

5D tensor blocked by 2nd dimension with block size 4

dnnl_aBcde8b 

5D tensor blocked by 2nd dimension with block size 8

dnnl_aBcdef16b 

6D tensor blocked by 2nd dimension with block size 16

dnnl_aBcdef4b 

6D tensor blocked by 2nd dimension with block size 4

dnnl_format_tag_last 

Just a sentinel, not real memory format tag.

Must be changed after new format tag is added.

dnnl_x 

1D tensor, an alias to dnnl_a

dnnl_nc 

2D CNN activations tensor, an alias to dnnl_ab

dnnl_cn 

2D CNN activations tensor, an alias to dnnl_ba

dnnl_tn 

2D RNN statistics tensor, an alias to dnnl_ab

dnnl_nt 

2D RNN statistics tensor, an alias to dnnl_ba

dnnl_ncw 

3D CNN activations tensor, an alias to dnnl_abc

dnnl_nwc 

3D CNN activations tensor, an alias to dnnl_acb

dnnl_nchw 

4D CNN activations tensor, an alias to dnnl_abcd

dnnl_nhwc 

4D CNN activations tensor, an alias to dnnl_acdb

dnnl_chwn 

4D CNN activations tensor, an alias to dnnl_bcda

dnnl_ncdhw 

5D CNN activations tensor, an alias to dnnl_abcde

dnnl_ndhwc 

5D CNN activations tensor, an alias to dnnl_acdeb

dnnl_oi 

2D CNN weights tensor, an alias to dnnl_ab

dnnl_io 

2D CNN weights tensor, an alias to dnnl_ba

dnnl_oiw 

3D CNN weights tensor, an alias to dnnl_abc

dnnl_owi 

3D CNN weights tensor, an alias to dnnl_acb

dnnl_wio 

3D CNN weights tensor, an alias to dnnl_cba

dnnl_iwo 

3D CNN weights tensor, an alias to dnnl_bca

dnnl_oihw 

4D CNN weights tensor, an alias to dnnl_abcd

dnnl_hwio 

4D CNN weights tensor, an alias to dnnl_cdba

dnnl_ohwi 

4D CNN weights tensor, an alias to dnnl_acdb

dnnl_ihwo 

4D CNN weights tensor, an alias to dnnl_bcda

dnnl_iohw 

4D CNN weights tensor, an alias to dnnl_bacd

dnnl_oidhw 

5D CNN weights tensor, an alias to dnnl_abcde

dnnl_dhwio 

5D CNN weights tensor, an alias to dnnl_cdeba

dnnl_odhwi 

5D CNN weights tensor, an alias to dnnl_acdeb

dnnl_idhwo 

5D CNN weights tensor, an alias to dnnl_bcdea

dnnl_goiw 

4D CNN weights tensor (incl. groups), an alias to dnnl_abcd

dnnl_goihw 

5D CNN weights tensor (incl. groups), an alias to dnnl_abcde

dnnl_hwigo 

5D CNN weights tensor (incl. groups), an alias to dnnl_decab

dnnl_giohw 

5D CNN weights tensor (incl. groups), an alias to dnnl_acbde

dnnl_goidhw 

6D CNN weights tensor (incl. groups), an alias to dnnl_abcdef

dnnl_tnc 

3D RNN data tensor in the format (seq_length, batch, input channels).

dnnl_ntc 

3D RNN data tensor in the format (batch, seq_length, input channels).

dnnl_ldnc 

4D RNN states tensor in the format (num_layers, num_directions, batch, state channels).

dnnl_ldigo 

5D RNN weights tensor in the format (num_layers, num_directions, input_channels, num_gates, output_channels).

  • For LSTM cells, the gates order is input, forget, candidate and output gate.
  • For GRU cells, the gates order is update, reset and output gate.
dnnl_ldgoi 

5D RNN weights tensor in the format (num_layers, num_directions, num_gates, output_channels, input_channels).

  • For LSTM cells, the gates order is input, forget, candidate and output gate.
  • For GRU cells, the gates order is update, reset and output gate.
dnnl_ldgo 

4D RNN bias tensor in the format (num_layers, num_directions, num_gates, output_channels).

  • For LSTM cells, the gates order is input, forget, candidate and output gate.
  • For GRU cells, the gates order is update, reset and output gate.
dnnl_nCdhw16c 

5D CNN activations tensor blocked by channels with block size 16, an alias to dnnl_aBcde16b

dnnl_nCdhw4c 

5D CNN activations tensor blocked by channels with block size 4, an alias to dnnl_aBcde4b

dnnl_nCdhw8c 

5D CNN activations tensor blocked by channels with block size 8, an alias to dnnl_aBcde8b

dnnl_nChw16c 

4D CNN activations tensor blocked by channels with block size 16, an alias to dnnl_aBcd16b

dnnl_nChw4c 

4D CNN activations tensor blocked by channels with block size 4, an alias to dnnl_aBcd4b

dnnl_nChw8c 

4D CNN activations tensor blocked by channels with block size 8, an alias to dnnl_aBcd8b

dnnl_nCw16c 

3D CNN activations tensor blocked by channels with block size 16, an alias to dnnl_aBc16b

dnnl_nCw4c 

3D CNN activations tensor blocked by channels with block size 4, an alias to dnnl_aBc4b

dnnl_nCw8c 

3D CNN activations tensor blocked by channels with block size 8, an alias to dnnl_aBc8b

◆ dnnl_prop_kind_t

Kinds of propagation.

Enumerator
dnnl_prop_kind_undef 

Undefined propagation type.

dnnl_forward_training 

Forward data propagation (training mode).

In this mode primitives perform computations necessary for subsequent backward propagation.

dnnl_forward_inference 

Forward data propagation (inference mode).

In this mode primitives perform only computations that are necessary for inference and omit computations that are necessary only for backward propagation.

dnnl_forward_scoring 

Forward data propagation (alias for dnnl_forward_inference).

dnnl_forward 

Forward data propagation (alias for dnnl_forward_training).

dnnl_backward 

Backward propagation (with respect to all parameters).

dnnl_backward_data 

Backward data propagation.

dnnl_backward_weights 

Backward weights propagation.

dnnl_backward_bias 

Backward bias propagation.

◆ dnnl_primitive_kind_t

Kinds of primitives.

Used to implement a way to extend the library with new primitives without changing the ABI.

Enumerator
dnnl_undefined_primitive 

Undefined primitive.

dnnl_reorder 

A reorder primitive.

dnnl_shuffle 

A shuffle primitive.

dnnl_concat 

A (out-of-place) concat primitive.

dnnl_sum 

A sum primitive.

dnnl_convolution 

A convolution primitive.

dnnl_deconvolution 

A deconvolution primitive.

dnnl_eltwise 

An element-wise primitive.

dnnl_softmax 

A softmax primitive.

dnnl_pooling 

A pooling primitive.

dnnl_lrn 

An LRN primitive.

dnnl_batch_normalization 

A batch normalization primitive.

dnnl_layer_normalization 

A layer normalization primitive.

dnnl_inner_product 

An inner product primitive.

dnnl_rnn 

A rnn primitive.

dnnl_gemm 

A matrix multiplication primitive.

dnnl_binary 

A binary primitive.

◆ dnnl_alg_kind_t

Kinds of algorithms.

Enumerator
dnnl_convolution_direct 

Direct convolution.

dnnl_convolution_winograd 

Winograd convolution.

dnnl_convolution_auto 

Convolution algorithm(either direct or Winograd) is chosen just in time.

dnnl_deconvolution_direct 

Direct deconvolution.

dnnl_deconvolution_winograd 

Winograd deconvolution.

dnnl_eltwise_relu 

Eltwise: ReLU.

dnnl_eltwise_tanh 

Eltwise: hyperbolic tangent non-linearity (tanh)

dnnl_eltwise_elu 

Eltwise: parametric exponential linear unit (elu)

dnnl_eltwise_square 

Eltwise: square.

dnnl_eltwise_abs 

Eltwise: abs.

dnnl_eltwise_sqrt 

Eltwise: square root.

dnnl_eltwise_linear 

Eltwise: linear.

dnnl_eltwise_bounded_relu 

Eltwise: bounded_relu.

dnnl_eltwise_soft_relu 

Eltwise: soft_relu.

dnnl_eltwise_logistic 

Eltwise: logistic.

dnnl_eltwise_exp 

Eltwise: exponent.

dnnl_eltwise_gelu 

Eltwise: gelu.

Note
Tanh approximation formula is used to approximate cumulative distribution function of a Gaussian
dnnl_eltwise_swish 

Eltwise: swish.

dnnl_pooling_max 

Max pooling.

dnnl_pooling_avg_include_padding 

Average pooling include padding.

dnnl_pooling_avg_exclude_padding 

Average pooling exclude padding.

dnnl_lrn_across_channels 

Local response normalization (LRN) across multiple channels.

dnnl_lrn_within_channel 

LRN within a single channel.

dnnl_vanilla_rnn 

RNN cell.

dnnl_vanilla_lstm 

LSTM cell.

dnnl_vanilla_gru 

GRU cell.

dnnl_lbr_gru 

GRU cell with linear before reset.

Modification of original GRU cell. Differs from dnnl_vanilla_gru in how the new memory gate is calculated:

\[ c_t = tanh(W_c*x_t + b_{c_x} + r_t*(U_c*h_{t-1}+b_{c_h})) \]

Primitive expects 4 biases on input: \([b_{u}, b_{r}, b_{c_x}, b_{c_h}]\)

dnnl_binary_add 

Binary add.

dnnl_binary_mul 

Binary mul.

◆ dnnl_normalization_flags_t

Flags for batch normalization primitive.

Enumerator
dnnl_use_global_stats 

Use global statistics.

If specified

  • on forward propagation use mean and variance provided by user (input)
  • on backward propagation reduces the amount of computations, since mean and variance are considered as constants

If not specified:

  • on forward propagation mean and variance are computed and stored in output
  • on backward propagation compute full derivative wrt to data
dnnl_use_scaleshift 

Use scale and shift parameters.

If specified:

  • on forward propagation use scale and shift (aka scale and bias) for the batch normalization results
  • on backward propagation (for prop_kind == dnnl_backward) compute diff wrt to scale and shift (hence one extra output used)

If no specified:

dnnl_fuse_norm_relu 

Fuse with ReLU.

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.

If specified:

  • on inference this option behaves the same as if the primitive were fused with ReLU using post ops API with zero negative slope.
  • on training primitive requires workspace (required to be able to perform backward pass)