Intel(R) Math Kernel Library for Deep Neural Networks (Intel(R) MKL-DNN)  1.0.4
Performance library for Deep Learning
Classes | Enumerations
Generic

Classes

struct  mkldnn_version_t
 Version type. More...
 

Enumerations

enum  mkldnn_status_t {
  mkldnn_success = 0, mkldnn_out_of_memory = 1, mkldnn_invalid_arguments = 2, mkldnn_unimplemented = 3,
  mkldnn_iterator_ends = 4, mkldnn_runtime_error = 5, mkldnn_not_required = 6
}
 Status values returned by the library functions. More...
 
enum  mkldnn_data_type_t {
  mkldnn_data_type_undef = 0, mkldnn_f16 = 1, mkldnn_bf16 = 2, mkldnn_f32 = 3,
  mkldnn_s32 = 4, mkldnn_s8 = 5, mkldnn_u8 = 6
}
 Data type specification. More...
 
enum  mkldnn_format_kind_t {
  mkldnn_format_kind_undef = 0, mkldnn_format_kind_any, mkldnn_blocked, mkldnn_format_kind_wino,
  mkldnn_format_kind_rnn_packed
}
 Memory format kind. More...
 
enum  mkldnn_format_tag_t {
  mkldnn_format_tag_undef = 0, mkldnn_format_tag_any, mkldnn_a, mkldnn_ab,
  mkldnn_abc, mkldnn_abcd, mkldnn_abcde, mkldnn_abcdef,
  mkldnn_abdec, mkldnn_acb, mkldnn_acbde, mkldnn_acdb,
  mkldnn_acdeb, mkldnn_ba, mkldnn_bac, mkldnn_bacd,
  mkldnn_bca, mkldnn_bcda, mkldnn_bcdea, mkldnn_cba,
  mkldnn_cdba, mkldnn_cdeba, mkldnn_decab , mkldnn_aBc16b ,
  mkldnn_aBc4b , mkldnn_aBc8b , mkldnn_aBcd16b , mkldnn_aBcd4b ,
  mkldnn_aBcd8b , mkldnn_ABcd8b8a , mkldnn_aBcde16b , mkldnn_aBcde4b ,
  mkldnn_aBcde8b , mkldnn_aBcdef16b , mkldnn_aBcdef4b , mkldnn_format_tag_last,
  mkldnn_x = mkldnn_a, mkldnn_nc = mkldnn_ab, mkldnn_cn = mkldnn_ba, mkldnn_ncw = mkldnn_abc,
  mkldnn_nwc = mkldnn_acb, mkldnn_nchw = mkldnn_abcd, mkldnn_nhwc = mkldnn_acdb, mkldnn_chwn = mkldnn_bcda,
  mkldnn_ncdhw = mkldnn_abcde, mkldnn_ndhwc = mkldnn_acdeb, mkldnn_oi = mkldnn_ab, mkldnn_io = mkldnn_ba,
  mkldnn_oiw = mkldnn_abc, mkldnn_owi = mkldnn_acb, mkldnn_wio = mkldnn_cba, mkldnn_iwo = mkldnn_bca,
  mkldnn_oihw = mkldnn_abcd, mkldnn_hwio = mkldnn_cdba, mkldnn_ohwi = mkldnn_acdb, mkldnn_ihwo = mkldnn_bcda,
  mkldnn_iohw = mkldnn_bacd, mkldnn_oidhw = mkldnn_abcde, mkldnn_dhwio = mkldnn_cdeba, mkldnn_odhwi = mkldnn_acdeb,
  mkldnn_idhwo = mkldnn_bcdea, mkldnn_goiw = mkldnn_abcd, mkldnn_goihw = mkldnn_abcde, mkldnn_hwigo = mkldnn_decab,
  mkldnn_giohw = mkldnn_acbde, mkldnn_goidhw = mkldnn_abcdef, mkldnn_tnc = mkldnn_abc, mkldnn_ntc = mkldnn_bac,
  mkldnn_ldnc = mkldnn_abcd, mkldnn_ldigo = mkldnn_abcde, mkldnn_ldgoi = mkldnn_abdec, mkldnn_ldgo = mkldnn_abcd,
  mkldnn_nCdhw16c = mkldnn_aBcde16b, mkldnn_nCdhw4c = mkldnn_aBcde4b, mkldnn_nCdhw8c = mkldnn_aBcde8b, mkldnn_nChw16c = mkldnn_aBcd16b,
  mkldnn_nChw4c = mkldnn_aBcd4b, mkldnn_nChw8c = mkldnn_aBcd8b, mkldnn_nCw16c = mkldnn_aBc16b, mkldnn_nCw4c = mkldnn_aBc4b,
  mkldnn_nCw8c = mkldnn_aBc8b
}
 Memory format tag specification. More...
 
enum  mkldnn_prop_kind_t {
  mkldnn_prop_kind_undef = 0, mkldnn_forward_training = 64, mkldnn_forward_inference = 96, mkldnn_forward_scoring = mkldnn_forward_inference,
  mkldnn_forward = mkldnn_forward_training, mkldnn_backward = 128, mkldnn_backward_data = 160, mkldnn_backward_weights = 192,
  mkldnn_backward_bias = 193
}
 Kinds of propagation. More...
 
enum  mkldnn_primitive_kind_t {
  mkldnn_undefined_primitive, mkldnn_reorder, mkldnn_shuffle, mkldnn_concat,
  mkldnn_sum, mkldnn_convolution, mkldnn_deconvolution, mkldnn_eltwise,
  mkldnn_softmax, mkldnn_pooling, mkldnn_lrn, mkldnn_batch_normalization,
  mkldnn_inner_product, mkldnn_rnn, mkldnn_gemm
}
 Kinds of primitives. More...
 
enum  mkldnn_alg_kind_t { ,
  mkldnn_convolution_direct = 0x1, mkldnn_convolution_winograd = 0x2, mkldnn_convolution_auto = 0x3, mkldnn_deconvolution_direct = 0xa,
  mkldnn_deconvolution_winograd = 0xb, mkldnn_eltwise_relu = 0x1f, mkldnn_eltwise_tanh = 0x2f, mkldnn_eltwise_elu = 0x3f,
  mkldnn_eltwise_square = 0x4f, mkldnn_eltwise_abs = 0x5f, mkldnn_eltwise_sqrt = 0x6f, mkldnn_eltwise_linear = 0x7f,
  mkldnn_eltwise_bounded_relu = 0x8f, mkldnn_eltwise_soft_relu = 0x9f, mkldnn_eltwise_logistic = 0xaf, mkldnn_eltwise_exp = 0xbf,
  mkldnn_eltwise_gelu = 0xcf, mkldnn_pooling_max = 0x1ff, mkldnn_pooling_avg_include_padding = 0x2ff, mkldnn_pooling_avg_exclude_padding = 0x3ff ,
  mkldnn_lrn_across_channels = 0xaff, mkldnn_lrn_within_channel = 0xbff, mkldnn_vanilla_rnn = 0x1fff, mkldnn_vanilla_lstm = 0x2fff,
  mkldnn_vanilla_gru = 0x3fff, mkldnn_lbr_gru = 0x4fff
}
 Kinds of algorithms. More...
 
enum  mkldnn_normalization_flags_t { mkldnn_use_global_stats = 0x1U, mkldnn_use_scaleshift = 0x2U, mkldnn_fuse_norm_relu = 0x4U }
 Flags for batch normalization primitive. More...
 

Detailed Description

Enumeration Type Documentation

◆ mkldnn_status_t

Status values returned by the library functions.

Enumerator
mkldnn_success 

The operation was successful.

mkldnn_out_of_memory 

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

mkldnn_invalid_arguments 

The operation failed because of incorrect function arguments.

mkldnn_unimplemented 

The operation failed because requested functionality is not implemented.

mkldnn_iterator_ends 

Primitive iterator passed over last primitive descriptor.

mkldnn_runtime_error 

Primitive or engine failed on execution.

mkldnn_not_required 

Queried element is not required for given primitive.

◆ mkldnn_data_type_t

Data type specification.

Enumerator
mkldnn_data_type_undef 

Undefined data type, used for empty memory descriptors.

mkldnn_f16 

16-bit/half-precision floating point.

mkldnn_bf16 

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

mkldnn_f32 

32-bit/single-precision floating point.

mkldnn_s32 

32-bit signed integer.

mkldnn_s8 

8-bit signed integer.

mkldnn_u8 

8-bit unsigned integer.

◆ mkldnn_format_kind_t

Memory format kind.

Enumerator
mkldnn_format_kind_undef 

Undefined memory format kind, used for empty memory descriptors.

mkldnn_format_kind_any 

Unspecified format kind.

The primitive selects a format automatically.

mkldnn_blocked 

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

See mkldnn_blocking_desc_t for more information.

mkldnn_format_kind_wino 

Weights format used in 8bit Winograd convolution.

mkldnn_format_kind_rnn_packed 

Packed weights format used in RNN.

◆ mkldnn_format_tag_t

Memory format tag specification.

Intel MKL-DNN 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 mkldnn_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 mkldnn_ncdhw format tag) or NDHWC (corresponds to mkldnn_ndhwc format tag).

int batch = 2, channels = 16, depth = 13, height = 13, width = 13;
int ndims = 5; // 5D tensor
mkldnn_dims_t dims = {batch, channels, depth, height, width};
mkldnn_memory_desc_t data_in_ncdhw;
&data_in_ncdhw, 5, dims, mkldnn_f32, mkldnn_ncdhw);
// note that in both cases dims passed are the same
mkldnn_memory_desc_t data_in_ndhwc;
&data_in_ndhwc, 5, dims, mkldnn_f32, mkldnn_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, mkldnn_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, mkldnn_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, mkldnn_nc is used to denote 2D CNN activations tensor memory format, where channels are the innermost dimension and batch is an outermost one. Moreover, mkldnn_nc is just an alias to mkldnn_ab, since for Intel MKL-DNN 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: mkldnn_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
mkldnn_format_tag_undef 

Undefined memory format tag.

mkldnn_format_tag_any 

Undefined memory format tag.

The primitive selects a format automatically.

mkldnn_a 

plain 1D tensor

mkldnn_ab 

plain 2D tensor

mkldnn_abc 

plain 3D tensor

mkldnn_abcd 

plain 4D tensor

mkldnn_abcde 

plain 5D tensor

mkldnn_abcdef 

plain 6D tensor

mkldnn_abdec 

permuted 5D tensor

mkldnn_acb 

permuted 3D tensor

mkldnn_acbde 

permuted 5D tensor

mkldnn_acdb 

permuted 4D tensor

mkldnn_acdeb 

permuted 5D tensor

mkldnn_ba 

permuted 2D tensor

mkldnn_bac 

permuted 3D tensor

mkldnn_bacd 

permuted 4D tensor

mkldnn_bca 

permuted 3D tensor

mkldnn_bcda 

permuted 4D tensor

mkldnn_bcdea 

permuted 5D tensor

mkldnn_cba 

permuted 3D tensor

mkldnn_cdba 

permuted 4D tensor

mkldnn_cdeba 

permuted 5D tensor

mkldnn_decab 

permuted 5D tensor

mkldnn_aBc16b 

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

mkldnn_aBc4b 

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

mkldnn_aBc8b 

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

mkldnn_aBcd16b 

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

mkldnn_aBcd4b 

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

mkldnn_aBcd8b 

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

mkldnn_ABcd8b8a 

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

mkldnn_aBcde16b 

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

mkldnn_aBcde4b 

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

mkldnn_aBcde8b 

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

mkldnn_aBcdef16b 

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

mkldnn_aBcdef4b 

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

mkldnn_format_tag_last 

Just a sentinel, not real memory format tag.

Must be changed after new format tag is added.

mkldnn_x 

1D tensor, an alias to mkldnn_a

mkldnn_nc 

2D CNN activations tensor, an alias to mkldnn_ab

mkldnn_cn 

2D CNN activations tensor, an alias to mkldnn_ba

mkldnn_ncw 

3D CNN activations tensor, an alias to mkldnn_abc

mkldnn_nwc 

3D CNN activations tensor, an alias to mkldnn_acb

mkldnn_nchw 

4D CNN activations tensor, an alias to mkldnn_abcd

mkldnn_nhwc 

4D CNN activations tensor, an alias to mkldnn_acdb

mkldnn_chwn 

4D CNN activations tensor, an alias to mkldnn_bcda

mkldnn_ncdhw 

5D CNN activations tensor, an alias to mkldnn_abcde

mkldnn_ndhwc 

5D CNN activations tensor, an alias to mkldnn_acdeb

mkldnn_oi 

2D CNN weights tensor, an alias to mkldnn_ab

mkldnn_io 

2D CNN weights tensor, an alias to mkldnn_ba

mkldnn_oiw 

3D CNN weights tensor, an alias to mkldnn_abc

mkldnn_owi 

3D CNN weights tensor, an alias to mkldnn_acb

mkldnn_wio 

3D CNN weights tensor, an alias to mkldnn_cba

mkldnn_iwo 

3D CNN weights tensor, an alias to mkldnn_bca

mkldnn_oihw 

4D CNN weights tensor, an alias to mkldnn_abcd

mkldnn_hwio 

4D CNN weights tensor, an alias to mkldnn_cdba

mkldnn_ohwi 

4D CNN weights tensor, an alias to mkldnn_acdb

mkldnn_ihwo 

4D CNN weights tensor, an alias to mkldnn_bcda

mkldnn_iohw 

4D CNN weights tensor, an alias to mkldnn_bacd

mkldnn_oidhw 

5D CNN weights tensor, an alias to mkldnn_abcde

mkldnn_dhwio 

5D CNN weights tensor, an alias to mkldnn_cdeba

mkldnn_odhwi 

5D CNN weights tensor, an alias to mkldnn_acdeb

mkldnn_idhwo 

5D CNN weights tensor, an alias to mkldnn_bcdea

mkldnn_goiw 

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

mkldnn_goihw 

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

mkldnn_hwigo 

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

mkldnn_giohw 

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

mkldnn_goidhw 

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

mkldnn_tnc 

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

mkldnn_ntc 

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

mkldnn_ldnc 

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

mkldnn_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.
mkldnn_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.
mkldnn_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.
mkldnn_nCdhw16c 

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

mkldnn_nCdhw4c 

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

mkldnn_nCdhw8c 

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

mkldnn_nChw16c 

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

mkldnn_nChw4c 

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

mkldnn_nChw8c 

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

mkldnn_nCw16c 

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

mkldnn_nCw4c 

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

mkldnn_nCw8c 

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

◆ mkldnn_prop_kind_t

Kinds of propagation.

Enumerator
mkldnn_prop_kind_undef 

Undefined propagation type.

mkldnn_forward_training 

Forward data propagation (training mode).

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

mkldnn_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.

mkldnn_forward_scoring 

Forward data propagation (alias for mkldnn_forward_inference).

mkldnn_forward 

Forward data propagation (alias for mkldnn_forward_training).

mkldnn_backward 

Backward propagation (with respect to all parameters).

mkldnn_backward_data 

Backward data propagation.

mkldnn_backward_weights 

Backward weights propagation.

mkldnn_backward_bias 

Backward bias propagation.

◆ mkldnn_primitive_kind_t

Kinds of primitives.

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

Enumerator
mkldnn_undefined_primitive 

Undefined primitive.

mkldnn_reorder 

A reorder primitive.

mkldnn_shuffle 

A shuffle primitive.

mkldnn_concat 

A (out-of-place) concat primitive.

mkldnn_sum 

A sum primitive.

mkldnn_convolution 

A convolution primitive.

mkldnn_deconvolution 

A deconvolution primitive.

mkldnn_eltwise 

An element-wise primitive.

mkldnn_softmax 

A softmax primitive.

mkldnn_pooling 

A pooling primitive.

mkldnn_lrn 

An LRN primitive.

mkldnn_batch_normalization 

An batch normalization primitive.

mkldnn_inner_product 

An inner product primitive.

mkldnn_rnn 

A rnn primitive.

mkldnn_gemm 

A matrix multiplication primitive.

◆ mkldnn_alg_kind_t

Kinds of algorithms.

Enumerator
mkldnn_convolution_direct 

Direct convolution.

mkldnn_convolution_winograd 

Winograd convolution.

mkldnn_convolution_auto 

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

mkldnn_deconvolution_direct 

Direct deconvolution.

mkldnn_deconvolution_winograd 

Winograd deconvolution.

mkldnn_eltwise_relu 

Eltwise: ReLU.

mkldnn_eltwise_tanh 

Eltwise: hyperbolic tangent non-linearity (tanh)

mkldnn_eltwise_elu 

Eltwise: parametric exponential linear unit (elu)

mkldnn_eltwise_square 

Eltwise: square.

mkldnn_eltwise_abs 

Eltwise: abs.

mkldnn_eltwise_sqrt 

Eltwise: square root.

mkldnn_eltwise_linear 

Eltwise: linear.

mkldnn_eltwise_bounded_relu 

Eltwise: bounded_relu.

mkldnn_eltwise_soft_relu 

Eltwise: soft_relu.

mkldnn_eltwise_logistic 

Eltwise: logistic.

mkldnn_eltwise_exp 

Eltwise: exponent.

mkldnn_eltwise_gelu 

Eltwise: gelu.

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

Max pooling.

mkldnn_pooling_avg_include_padding 

Average pooling include padding.

mkldnn_pooling_avg_exclude_padding 

Average pooling exclude padding.

mkldnn_lrn_across_channels 

Local response normalization (LRN) across multiple channels.

mkldnn_lrn_within_channel 

LRN within a single channel.

mkldnn_vanilla_rnn 

RNN cell.

mkldnn_vanilla_lstm 

LSTM cell.

mkldnn_vanilla_gru 

GRU cell.

mkldnn_lbr_gru 

GRU cell with linear before reset.

Modification of original GRU cell. Differs from mkldnn_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}]\)

◆ mkldnn_normalization_flags_t

Flags for batch normalization primitive.

Enumerator
mkldnn_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
mkldnn_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 == mkldnn_backward) compute diff wrt to scale and shift (hence one extra output used)

If no specified:

mkldnn_fuse_norm_relu 

Fuse with ReLU.

If specified:

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