RNN

A primitive to compute recurrent neural network layers.

API

enum dnnl::rnn_flags

RNN cell flags.

Values:

enumerator undef

Undefined RNN flags.

enum dnnl::rnn_direction

A direction of RNN primitive execution.

Values:

enumerator unidirectional_left2right

Unidirectional execution of RNN primitive from left to right.

enumerator unidirectional_right2left

Unidirectional execution of RNN primitive from right to left.

enumerator bidirectional_concat

Bidirectional execution of RNN primitive with concatenation of the results.

enumerator bidirectional_sum

Bidirectional execution of RNN primitive with summation of the results.

enumerator unidirectional = unidirectional_left2right

Alias for dnnl::rnn_direction::unidirectional_left2right.

struct dnnl::vanilla_rnn_forward : public dnnl::primitive

Vanilla RNN forward propagation primitive.

Public Functions

vanilla_rnn_forward()

Default constructor. Produces an empty object.

vanilla_rnn_forward(const primitive_desc &pd)

Constructs a vanilla RNN forward propagation primitive.

Parameters
  • pd: Primitive descriptor for a vanilla RNN forward propagation primitive.

struct desc

Descriptor for a vanilla RNN forward propagation primitive.

Public Functions

desc(prop_kind prop_kind, algorithm activation, rnn_direction direction, const memory::desc &src_layer_desc, const memory::desc &src_iter_desc, const memory::desc &weights_layer_desc, const memory::desc &weights_iter_desc, const memory::desc &bias_desc, const memory::desc &dst_layer_desc, const memory::desc &dst_iter_desc, rnn_flags flags = rnn_flags::undef, float alpha = 0.0f, float beta = 0.0f)

Constructs a descriptor for a vanilla RNN forward propagation primitive.

The src_iter_desc, bias_desc, and dst_iter_desc may point to a zero memory descriptor. This would then indicate that the RNN forward propagation primitive should not use them and should default to zero values instead.

Inputs:

Outputs:

Note

All memory descriptors except src_iter_desc can be initialized with an dnnl::memory::format_tag::any value of format_tag.

Parameters

struct primitive_desc : public dnnl::rnn_primitive_desc_base

Primitive descriptor for a vanilla RNN forward propagation primitive.

Public Functions

primitive_desc()

Default constructor. Produces an empty object.

primitive_desc(const desc &desc, const engine &engine, bool allow_empty = false)

Constructs a primitive descriptor for a vanilla RNN forward propagation primitive.

Parameters
  • desc: Descriptor for a vanilla RNN forward propagation primitive.

  • engine: Engine to use.

  • allow_empty: A flag signifying whether construction is allowed to fail without throwing an exception. In this case an empty object will be produced. This flag is optional and defaults to false.

primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, bool allow_empty = false)

Constructs a primitive descriptor for a vanilla RNN forward propagation primitive.

Parameters
  • desc: Descriptor for a vanilla RNN forward propagation primitive.

  • attr: Primitive attributes to use.

  • engine: Engine to use.

  • allow_empty: A flag signifying whether construction is allowed to fail without throwing an exception. In this case an empty object will be produced. This flag is optional and defaults to false.

memory::desc src_layer_desc() const

Returns source layer memory descriptor.

Return

Source layer memory descriptor.

memory::desc src_iter_desc() const

Returns source iteration memory descriptor.

Return

Source iteration memory descriptor.

Return

A zero memory descriptor if the primitive does not have a source iteration parameter.

memory::desc weights_layer_desc() const

Returns weights layer memory descriptor.

Return

Weights layer memory descriptor.

memory::desc weights_iter_desc() const

Returns weights iteration memory descriptor.

Return

Weights iteration memory descriptor.

memory::desc bias_desc() const

Returns bias memory descriptor.

Return

Bias memory descriptor.

Return

A zero memory descriptor if the primitive does not have a bias parameter.

memory::desc dst_layer_desc() const

Returns destination layer memory descriptor.

Return

Destination layer memory descriptor.

memory::desc dst_iter_desc() const

Returns destination iteration memory descriptor.

Return

Destination iteration memory descriptor.

Return

A zero memory descriptor if the primitive does not have a destination iteration parameter.

memory::desc workspace_desc() const

Returns the workspace memory descriptor.

Return

Workspace memory descriptor.

Return

A zero memory descriptor if the primitive does not require workspace parameter.

struct dnnl::vanilla_rnn_backward : public dnnl::primitive

Vanilla RNN backward propagation primitive.

Public Functions

vanilla_rnn_backward()

Default constructor. Produces an empty object.

vanilla_rnn_backward(const primitive_desc &pd)

Constructs a vanilla RNN backward propagation primitive.

Parameters
  • pd: Primitive descriptor for a vanilla RNN backward propagation primitive.

struct desc

Vanilla RNN descriptor backward propagation primitive.

Public Functions

desc(prop_kind prop_kind, algorithm activation, rnn_direction direction, const memory::desc &src_layer_desc, const memory::desc &src_iter_desc, const memory::desc &weights_layer_desc, const memory::desc &weights_iter_desc, const memory::desc &bias_desc, const memory::desc &dst_layer_desc, const memory::desc &dst_iter_desc, const memory::desc &diff_src_layer_desc, const memory::desc &diff_src_iter_desc, const memory::desc &diff_weights_layer_desc, const memory::desc &diff_weights_iter_desc, const memory::desc &diff_bias_desc, const memory::desc &diff_dst_layer_desc, const memory::desc &diff_dst_iter_desc, rnn_flags flags = rnn_flags::undef, float alpha = 0.0f, float beta = 0.0f)

Constructs a descriptor for a vanilla RNN backward propagation primitive.

The src_iter_desc together with diff_src_iter_desc, bias_desc together with diff_bias_desc, and dst_iter_desc together with diff_src_iter_desc, may point to a zero memory descriptor. This would then indicate that the RNN backward propagation primitive should not use the respective data and should use zero values instead.

Inputs:

Outputs:

Note

All the memory descriptors may be initialized with the dnnl::memory::format_tag::any value of format_tag.

Parameters
  • prop_kind: Propagation kind. Must be dnnl::prop_kind::backward.

  • activation: Activation kind. Possible values are dnnl::algorithm::eltwise_relu, dnnl::algorithm::eltwise_tanh, or dnnl::algorithm::eltwise_logistic.

  • direction: RNN direction. See dnnl::rnn_direction for more info.

  • src_layer_desc: Memory descriptor for the input vector.

  • src_iter_desc: Memory descriptor for the input recurrent hidden state vector.

  • weights_layer_desc: Memory descriptor for the weights applied to the layer input.

  • weights_iter_desc: Memory descriptor for the weights applied to the recurrent input.

  • bias_desc: Bias memory descriptor.

  • dst_layer_desc: Memory descriptor for the output vector.

  • dst_iter_desc: Memory descriptor for the output recurrent hidden state vector.

  • diff_src_layer_desc: Memory descriptor for the diff of input vector.

  • diff_src_iter_desc: Memory descriptor for the diff of input recurrent hidden state vector.

  • diff_weights_layer_desc: Memory descriptor for the diff of weights applied to the layer input.

  • diff_weights_iter_desc: Memory descriptor for the diff of weights applied to the recurrent input.

  • diff_bias_desc: Diff bias memory descriptor.

  • diff_dst_layer_desc: Memory descriptor for the diff of output vector.

  • diff_dst_iter_desc: Memory descriptor for the diff of output recurrent hidden state vector.

  • flags: Unused.

  • alpha: Negative slope if activation is dnnl::algorithm::eltwise_relu.

  • beta: Unused.

struct primitive_desc : public dnnl::rnn_primitive_desc_base

Primitive descriptor for a RNN backward propagation primitive.

Public Functions

primitive_desc()

Default constructor. Produces an empty object.

primitive_desc(const desc &desc, const engine &engine, const vanilla_rnn_forward::primitive_desc &hint_fwd_pd, bool allow_empty = false)

Constructs a primitive descriptor for a vanilla RNN backward propagation primitive.

Parameters
  • desc: Descriptor for a vanilla RNN backward propagation primitive.

  • engine: Engine to use.

  • hint_fwd_pd: Primitive descriptor for a vanilla RNN forward propagation primitive. It is used as a hint for deciding which memory format to use.

  • allow_empty: A flag signifying whether construction is allowed to fail without throwing an exception. In this case an empty object will be produced. This flag is optional and defaults to false.

primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, const vanilla_rnn_forward::primitive_desc &hint_fwd_pd, bool allow_empty = false)

Constructs a primitive descriptor for a vanilla RNN backward propagation primitive.

Parameters
  • desc: Descriptor for a vanilla RNN backward propagation primitive.

  • attr: Primitive attributes to use.

  • engine: Engine to use.

  • hint_fwd_pd: Primitive descriptor for a vanilla RNN forward propagation primitive. It is used as a hint for deciding which memory format to use.

  • allow_empty: A flag signifying whether construction is allowed to fail without throwing an exception. In this case an empty object will be produced. This flag is optional and defaults to false.

memory::desc src_layer_desc() const

Returns source layer memory descriptor.

Return

Source layer memory descriptor.

memory::desc src_iter_desc() const

Returns source iteration memory descriptor.

Return

Source iteration memory descriptor.

Return

A zero memory descriptor if the primitive does not have a source iteration parameter.

memory::desc weights_layer_desc() const

Returns weights layer memory descriptor.

Return

Weights layer memory descriptor.

memory::desc weights_iter_desc() const

Returns weights iteration memory descriptor.

Return

Weights iteration memory descriptor.

memory::desc bias_desc() const

Returns bias memory descriptor.

Return

Bias memory descriptor.

Return

A zero memory descriptor if the primitive does not have a bias parameter.

memory::desc dst_layer_desc() const

Returns destination layer memory descriptor.

Return

Destination layer memory descriptor.

memory::desc dst_iter_desc() const

Returns destination iteration memory descriptor.

Return

Destination iteration memory descriptor.

Return

A zero memory descriptor if the primitive does not have a destination iteration parameter.

memory::desc workspace_desc() const

Returns the workspace memory descriptor.

Return

Workspace memory descriptor.

Return

A zero memory descriptor if the primitive does not require workspace parameter.

memory::desc diff_src_layer_desc() const

Returns diff source layer memory descriptor.

Return

Diff source layer memory descriptor.

memory::desc diff_src_iter_desc() const

Returns diff source iteration memory descriptor.

Return

Diff source iteration memory descriptor.

Return

A zero memory descriptor if the primitive does not have a diff source iteration parameter.

memory::desc diff_weights_layer_desc() const

Returns diff weights layer memory descriptor.

Return

Diff weights layer memory descriptor.

memory::desc diff_weights_iter_desc() const

Returns diff weights iteration memory descriptor.

Return

Diff weights iteration memory descriptor.

memory::desc diff_bias_desc() const

Returns diff bias memory descriptor.

Return

Diff bias memory descriptor.

Return

A zero memory descriptor if the primitive does not have a diff bias parameter.

memory::desc diff_dst_layer_desc() const

Returns diff destination layer memory descriptor.

Return

Diff destination layer memory descriptor.

memory::desc diff_dst_iter_desc() const

Returns diff destination iteration memory descriptor.

Return

Diff destination iteration memory descriptor.

Return

A zero memory descriptor if the primitive does not have a diff destination iteration parameter.

struct dnnl::lstm_forward : public dnnl::primitive

LSTM forward propagation primitive.

Public Functions

lstm_forward()

Default constructor. Produces an empty object.

lstm_forward(const primitive_desc &pd)

Constructs an LSTM forward propagation primitive.

Parameters
  • pd: Primitive descriptor for an LSTM forward propagation primitive.

struct desc

Descriptor for an LSTM forward propagation primitive.

Public Functions

desc(prop_kind prop_kind, rnn_direction direction, const memory::desc &src_layer_desc, const memory::desc &src_iter_desc, const memory::desc &src_iter_c_desc, const memory::desc &weights_layer_desc, const memory::desc &weights_iter_desc, const memory::desc &weights_peephole_desc, const memory::desc &weights_projection_desc, const memory::desc &bias_desc, const memory::desc &dst_layer_desc, const memory::desc &dst_iter_desc, const memory::desc &dst_iter_c_desc, rnn_flags flags = rnn_flags::undef)

Constructs a descriptor for an LSTM (with or without peephole and with or without projection) forward propagation primitive.

The src_iter_desc, src_iter_c_desc, weights_peephole_desc, bias_desc, dst_iter_desc, and dst_iter_c_desc may point to a zero memory descriptor. This would then indicate that the LSTM forward propagation primitive should not use them and should default to zero values instead.

The weights_projection_desc may point to a zero memory descriptor. This would then indicate that the LSTM doesn’t have recurrent projection layer.

Inputs:

Note

All memory descriptors can be initialized with an dnnl::memory::format_tag::any value of format_tag.

Outputs:

Parameters
  • prop_kind: Propagation kind. Possible values are dnnl::prop_kind::forward_training, and dnnl::prop_kind::forward_inference.

  • direction: RNN direction. See dnnl::rnn_direction for more info.

  • src_layer_desc: Memory descriptor for the input vector.

  • src_iter_desc: Memory descriptor for the input recurrent hidden state vector.

  • src_iter_c_desc: Memory descriptor for the input recurrent cell state vector.

  • weights_layer_desc: Memory descriptor for the weights applied to the layer input.

  • weights_iter_desc: Memory descriptor for the weights applied to the recurrent input.

  • weights_peephole_desc: Memory descriptor for the weights applied to the cell states (according to the Peephole LSTM formula).

  • weights_projection_desc: Memory descriptor for the weights applied to the hidden states to get the recurrent projection (according to the Projection LSTM formula).

  • bias_desc: Bias memory descriptor.

  • dst_layer_desc: Memory descriptor for the output vector.

  • dst_iter_desc: Memory descriptor for the output recurrent hidden state vector.

  • dst_iter_c_desc: Memory descriptor for the output recurrent cell state vector.

  • flags: Unused.

desc(prop_kind prop_kind, rnn_direction direction, const memory::desc &src_layer_desc, const memory::desc &src_iter_desc, const memory::desc &src_iter_c_desc, const memory::desc &weights_layer_desc, const memory::desc &weights_iter_desc, const memory::desc &weights_peephole_desc, const memory::desc &bias_desc, const memory::desc &dst_layer_desc, const memory::desc &dst_iter_desc, const memory::desc &dst_iter_c_desc, rnn_flags flags = rnn_flags::undef)

Constructs a descriptor for an LSTM (with or without peephole) forward propagation primitive.

The src_iter_desc, src_iter_c_desc, weights_peephole_desc, bias_desc, dst_iter_desc, and dst_iter_c_desc may point to a zero memory descriptor. This would then indicate that the LSTM forward propagation primitive should not use them and should default to zero values instead.

Inputs:

Outputs:

Note

All memory descriptors can be initialized with an dnnl::memory::format_tag::any value of format_tag.

Parameters
  • prop_kind: Propagation kind. Possible values are dnnl::prop_kind::forward_training, and dnnl::prop_kind::forward_inference.

  • direction: RNN direction. See dnnl::rnn_direction for more info.

  • src_layer_desc: Memory descriptor for the input vector.

  • src_iter_desc: Memory descriptor for the input recurrent hidden state vector.

  • src_iter_c_desc: Memory descriptor for the input recurrent cell state vector.

  • weights_layer_desc: Memory descriptor for the weights applied to the layer input.

  • weights_iter_desc: Memory descriptor for the weights applied to the recurrent input.

  • weights_peephole_desc: Memory descriptor for the weights applied to the cell states (according to the Peephole LSTM formula).

  • bias_desc: Bias memory descriptor.

  • dst_layer_desc: Memory descriptor for the output vector.

  • dst_iter_desc: Memory descriptor for the output recurrent hidden state vector.

  • dst_iter_c_desc: Memory descriptor for the output recurrent cell state vector.

  • flags: Unused.

desc(prop_kind prop_kind, rnn_direction direction, const memory::desc &src_layer_desc, const memory::desc &src_iter_desc, const memory::desc &src_iter_c_desc, const memory::desc &weights_layer_desc, const memory::desc &weights_iter_desc, const memory::desc &bias_desc, const memory::desc &dst_layer_desc, const memory::desc &dst_iter_desc, const memory::desc &dst_iter_c_desc, rnn_flags flags = rnn_flags::undef)

Constructs a descriptor for an LSTM forward propagation primitive.

The src_iter_desc, src_iter_c_desc, bias_desc, dst_iter_desc, and dst_iter_c_desc may point to a zero memory descriptor. This would then indicate that the LSTM forward propagation primitive should not use them and should default to zero values instead.

Inputs:

Outputs:

Note

All memory descriptors can be initialized with an dnnl::memory::format_tag::any value of format_tag.

Parameters
  • prop_kind: Propagation kind. Possible values are dnnl::prop_kind::forward_training, and dnnl::prop_kind::forward_inference.

  • direction: RNN direction. See dnnl::rnn_direction for more info.

  • src_layer_desc: Memory descriptor for the input vector.

  • src_iter_desc: Memory descriptor for the input recurrent hidden state vector.

  • src_iter_c_desc: Memory descriptor for the input recurrent cell state vector.

  • weights_layer_desc: Memory descriptor for the weights applied to the layer input.

  • weights_iter_desc: Memory descriptor for the weights applied to the recurrent input.

  • bias_desc: Bias memory descriptor.

  • dst_layer_desc: Memory descriptor for the output vector.

  • dst_iter_desc: Memory descriptor for the output recurrent hidden state vector.

  • dst_iter_c_desc: Memory descriptor for the output recurrent cell state vector.

  • flags: Unused.

struct primitive_desc : public dnnl::rnn_primitive_desc_base

Primitive descriptor for an LSTM forward propagation primitive.

Public Functions

primitive_desc()

Default constructor. Produces an empty object.

primitive_desc(const desc &desc, const engine &engine, bool allow_empty = false)

Constructs a primitive descriptor for an LSTM forward propagation primitive.

Parameters
  • desc: Descriptor for an LSTM forward propagation primitive.

  • engine: Engine to use.

  • allow_empty: A flag signifying whether construction is allowed to fail without throwing an exception. In this case an empty object will be produced. This flag is optional and defaults to false.

primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, bool allow_empty = false)

Constructs a primitive descriptor for an LSTM forward propagation primitive.

Parameters
  • desc: Descriptor for an LSTM forward propagation primitive.

  • attr: Primitive attributes to use.

  • engine: Engine to use.

  • allow_empty: A flag signifying whether construction is allowed to fail without throwing an exception. In this case an empty object will be produced. This flag is optional and defaults to false.

memory::desc src_layer_desc() const

Returns source layer memory descriptor.

Return

Source layer memory descriptor.

memory::desc src_iter_desc() const

Returns source iteration memory descriptor.

Return

Source iteration memory descriptor.

Return

A zero memory descriptor if the primitive does not have a source iteration parameter.

memory::desc src_iter_c_desc() const

Returns source iteration memory descriptor.

Return

Source iteration memory descriptor.

Return

A zero memory descriptor if the primitive does not have a source iteration parameter.

memory::desc weights_layer_desc() const

Returns weights layer memory descriptor.

Return

Weights layer memory descriptor.

memory::desc weights_iter_desc() const

Returns weights iteration memory descriptor.

Return

Weights iteration memory descriptor.

memory::desc bias_desc() const

Returns bias memory descriptor.

Return

Bias memory descriptor.

Return

A zero memory descriptor if the primitive does not have a bias parameter.

memory::desc dst_layer_desc() const

Returns destination layer memory descriptor.

Return

Destination layer memory descriptor.

memory::desc dst_iter_desc() const

Returns destination iteration memory descriptor.

Return

Destination iteration memory descriptor.

Return

A zero memory descriptor if the primitive does not have a destination iteration parameter.

memory::desc dst_iter_c_desc() const

Returns source iteration memory descriptor.

Return

Source iteration memory descriptor.

Return

A zero memory descriptor if the primitive does not have a source iteration parameter.

memory::desc workspace_desc() const

Returns the workspace memory descriptor.

Return

Workspace memory descriptor.

Return

A zero memory descriptor if the primitive does not require workspace parameter.

struct dnnl::lstm_backward : public dnnl::primitive

LSTM backward propagation primitive.

Public Functions

lstm_backward()

Default constructor. Produces an empty object.

lstm_backward(const primitive_desc &pd)

Constructs an LSTM backward propagation primitive.

Parameters
  • pd: Primitive descriptor for an LSTM backward propagation primitive.

struct desc

Descriptor for an LSTM backward propagation primitive.

Public Functions

desc(prop_kind prop_kind, rnn_direction direction, const memory::desc &src_layer_desc, const memory::desc &src_iter_desc, const memory::desc &src_iter_c_desc, const memory::desc &weights_layer_desc, const memory::desc &weights_iter_desc, const memory::desc &weights_peephole_desc, const memory::desc &weights_projection_desc, const memory::desc &bias_desc, const memory::desc &dst_layer_desc, const memory::desc &dst_iter_desc, const memory::desc &dst_iter_c_desc, const memory::desc &diff_src_layer_desc, const memory::desc &diff_src_iter_desc, const memory::desc &diff_src_iter_c_desc, const memory::desc &diff_weights_layer_desc, const memory::desc &diff_weights_iter_desc, const memory::desc &diff_weights_peephole_desc, const memory::desc &diff_weights_projection_desc, const memory::desc &diff_bias_desc, const memory::desc &diff_dst_layer_desc, const memory::desc &diff_dst_iter_desc, const memory::desc &diff_dst_iter_c_desc, rnn_flags flags = rnn_flags::undef)

projection) descriptor for backward propagation using prop_kind, direction, and memory descriptors.

The src_iter_desc together with diff_iter_desc, src_iter_c_desc together with src_iter_c_desc, weights_peephole_desc together with diff_weights_peephole_desc, bias_desc together with diff_bias_desc, dst_iter_desc together with diff_dst_iter_desc, and dst_iter_c_desc together with diff_dst_iter_c_desc, may point to a zero memory descriptor. This would then indicate that the LSTM backward propagation primitive should not use them and should default to zero values instead.

The weights_projection_desc together with diff_weights_projection_desc may point to a zero memory descriptor. This would then indicate that the LSTM doesn’t have recurrent projection layer.

Inputs:

Note

All memory descriptors can be initialized with dnnl::memory::format_tag::any value of format_tag.

Outputs:

Parameters
  • prop_kind: Propagation kind. Must be dnnl::prop_kind::backward.

  • direction: RNN direction. See dnnl::rnn_direction for more info.

  • src_layer_desc: Memory descriptor for the input vector.

  • src_iter_desc: Memory descriptor for the input recurrent hidden state vector.

  • src_iter_c_desc: Memory descriptor for the input recurrent cell state vector.

  • weights_layer_desc: Memory descriptor for the weights applied to the layer input.

  • weights_iter_desc: Memory descriptor for the weights applied to the recurrent input.

  • weights_peephole_desc: Memory descriptor for the weights applied to the cell states (according to the Peephole LSTM formula).

  • weights_projection_desc: Memory descriptor for the weights applied to the hidden states to get the recurrent projection (according to the Projection LSTM formula).

  • bias_desc: Bias memory descriptor.

  • dst_layer_desc: Memory descriptor for the output vector.

  • dst_iter_desc: Memory descriptor for the output recurrent hidden state vector.

  • dst_iter_c_desc: Memory descriptor for the output recurrent cell state vector.

  • diff_src_layer_desc: Memory descriptor for the diff of input vector.

  • diff_src_iter_desc: Memory descriptor for the diff of input recurrent hidden state vector.

  • diff_src_iter_c_desc: Memory descriptor for the diff of input recurrent cell state vector.

  • diff_weights_layer_desc: Memory descriptor for the diff of weights applied to the layer input.

  • diff_weights_iter_desc: Memory descriptor for the diff of weights applied to the recurrent input.

  • diff_weights_peephole_desc: Memory descriptor for the diff of weights applied to the cell states (according to the Peephole LSTM formula).

  • diff_weights_projection_desc: Memory descriptor for the diff of weights applied to the hidden states to get the recurrent projection (according to the Projection LSTM formula).

  • diff_bias_desc: Diff bias memory descriptor.

  • diff_dst_layer_desc: Memory descriptor for the diff of output vector.

  • diff_dst_iter_desc: Memory descriptor for the diff of output recurrent hidden state vector.

  • diff_dst_iter_c_desc: Memory descriptor for the diff of output recurrent cell state vector.

  • flags: Unused.

desc(prop_kind prop_kind, rnn_direction direction, const memory::desc &src_layer_desc, const memory::desc &src_iter_desc, const memory::desc &src_iter_c_desc, const memory::desc &weights_layer_desc, const memory::desc &weights_iter_desc, const memory::desc &weights_peephole_desc, const memory::desc &bias_desc, const memory::desc &dst_layer_desc, const memory::desc &dst_iter_desc, const memory::desc &dst_iter_c_desc, const memory::desc &diff_src_layer_desc, const memory::desc &diff_src_iter_desc, const memory::desc &diff_src_iter_c_desc, const memory::desc &diff_weights_layer_desc, const memory::desc &diff_weights_iter_desc, const memory::desc &diff_weights_peephole_desc, const memory::desc &diff_bias_desc, const memory::desc &diff_dst_layer_desc, const memory::desc &diff_dst_iter_desc, const memory::desc &diff_dst_iter_c_desc, rnn_flags flags = rnn_flags::undef)

Constructs an LSTM (with or without peephole) descriptor for backward propagation using prop_kind, direction, and memory descriptors.

The src_iter_desc together with diff_iter_desc, src_iter_c_desc together with src_iter_c_desc, weights_peephole_desc together with diff_weights_peephole_desc, bias_desc together with diff_bias_desc, dst_iter_desc together with diff_dst_iter_desc, and dst_iter_c_desc together with diff_dst_iter_c_desc, may point to a zero memory descriptor. This would then indicate that the LSTM backward propagation primitive should not use them and should default to zero values instead.

Inputs:

Note

All memory descriptors may be initialized with dnnl::memory::format_tag::any value of format_tag.

Outputs:

Parameters
  • prop_kind: Propagation kind. Must be dnnl::prop_kind::backward.

  • direction: RNN direction. See dnnl::rnn_direction for more info.

  • src_layer_desc: Memory descriptor for the input vector.

  • src_iter_desc: Memory descriptor for the input recurrent hidden state vector.

  • src_iter_c_desc: Memory descriptor for the input recurrent cell state vector.

  • weights_layer_desc: Memory descriptor for the weights applied to the layer input.

  • weights_iter_desc: Memory descriptor for the weights applied to the recurrent input.

  • weights_peephole_desc: Memory descriptor for the weights applied to the cell states (according to the Peephole LSTM formula).

  • bias_desc: Bias memory descriptor.

  • dst_layer_desc: Memory descriptor for the output vector.

  • dst_iter_desc: Memory descriptor for the output recurrent hidden state vector.

  • dst_iter_c_desc: Memory descriptor for the output recurrent cell state vector.

  • diff_src_layer_desc: Memory descriptor for the diff of input vector.

  • diff_src_iter_desc: Memory descriptor for the diff of input recurrent hidden state vector.

  • diff_src_iter_c_desc: Memory descriptor for the diff of input recurrent cell state vector.

  • diff_weights_layer_desc: Memory descriptor for the diff of weights applied to the layer input.

  • diff_weights_iter_desc: Memory descriptor for the diff of weights applied to the recurrent input.

  • diff_weights_peephole_desc: Memory descriptor for the diff of weights applied to the cell states (according to the Peephole LSTM formula).

  • diff_bias_desc: Diff bias memory descriptor.

  • diff_dst_layer_desc: Memory descriptor for the diff of output vector.

  • diff_dst_iter_desc: Memory descriptor for the diff of output recurrent hidden state vector.

  • diff_dst_iter_c_desc: Memory descriptor for the diff of output recurrent cell state vector.

  • flags: Unused.

desc(prop_kind prop_kind, rnn_direction direction, const memory::desc &src_layer_desc, const memory::desc &src_iter_desc, const memory::desc &src_iter_c_desc, const memory::desc &weights_layer_desc, const memory::desc &weights_iter_desc, const memory::desc &bias_desc, const memory::desc &dst_layer_desc, const memory::desc &dst_iter_desc, const memory::desc &dst_iter_c_desc, const memory::desc &diff_src_layer_desc, const memory::desc &diff_src_iter_desc, const memory::desc &diff_src_iter_c_desc, const memory::desc &diff_weights_layer_desc, const memory::desc &diff_weights_iter_desc, const memory::desc &diff_bias_desc, const memory::desc &diff_dst_layer_desc, const memory::desc &diff_dst_iter_desc, const memory::desc &diff_dst_iter_c_desc, rnn_flags flags = rnn_flags::undef)

Constructs an LSTM descriptor for backward propagation using prop_kind, direction, and memory descriptors.

The src_iter_desc together with diff_iter_desc, src_iter_c_desc together with src_iter_c_desc, bias_desc together with diff_bias_desc, dst_iter_desc together with diff_dst_iter_desc, and dst_iter_c_desc together with diff_dst_iter_c_desc, may point to a zero memory descriptor. This would then indicate that the LSTM backward propagation primitive should not use them and should default to zero values instead.

Inputs:

Note

All memory descriptors may be initialized with dnnl::memory::format_tag::any value of format_tag.

Outputs:

Parameters
  • prop_kind: Propagation kind. Must be dnnl::prop_kind::backward.

  • direction: RNN direction. See dnnl::rnn_direction for more info.

  • src_layer_desc: Memory descriptor for the input vector.

  • src_iter_desc: Memory descriptor for the input recurrent hidden state vector.

  • src_iter_c_desc: Memory descriptor for the input recurrent cell state vector.

  • weights_layer_desc: Memory descriptor for the weights applied to the layer input.

  • weights_iter_desc: Memory descriptor for the weights applied to the recurrent input.

  • bias_desc: Bias memory descriptor.

  • dst_layer_desc: Memory descriptor for the output vector.

  • dst_iter_desc: Memory descriptor for the output recurrent hidden state vector.

  • dst_iter_c_desc: Memory descriptor for the output recurrent cell state vector.

  • diff_src_layer_desc: Memory descriptor for the diff of input vector.

  • diff_src_iter_desc: Memory descriptor for the diff of input recurrent hidden state vector.

  • diff_src_iter_c_desc: Memory descriptor for the diff of input recurrent cell state vector.

  • diff_weights_layer_desc: Memory descriptor for the diff of weights applied to the layer input.

  • diff_weights_iter_desc: Memory descriptor for the diff of weights applied to the recurrent input.

  • diff_bias_desc: Diff bias memory descriptor.

  • diff_dst_layer_desc: Memory descriptor for the diff of output vector.

  • diff_dst_iter_desc: Memory descriptor for the diff of output recurrent hidden state vector.

  • diff_dst_iter_c_desc: Memory descriptor for the diff of output recurrent cell state vector.

  • flags: Unused.

struct primitive_desc : public dnnl::rnn_primitive_desc_base

Primitive descriptor for LSTM backward propagation.

Public Functions

primitive_desc()

Default constructor. Produces an empty object.

primitive_desc(const desc &desc, const engine &engine, const lstm_forward::primitive_desc &hint_fwd_pd, bool allow_empty = false)

Constructs a primitive descriptor for an LSTM backward propagation primitive.

Parameters
  • desc: Descriptor for LSTM backward propagation primitive.

  • engine: Engine to use.

  • hint_fwd_pd: Primitive descriptor for an LSTM forward propagation primitive. It is used as a hint for deciding which memory format to use.

  • allow_empty: A flag signifying whether construction is allowed to fail without throwing an exception. In this case an empty object will be produced. This flag is optional and defaults to false.

primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, const lstm_forward::primitive_desc &hint_fwd_pd, bool allow_empty = false)

Constructs a primitive descriptor for an LSTM backward propagation primitive.

Parameters
  • desc: Descriptor for an LSTM backward propagation primitive.

  • attr: Primitive attributes to use.

  • engine: Engine to use.

  • hint_fwd_pd: Primitive descriptor for an LSTM forward propagation primitive. It is used as a hint for deciding which memory format to use.

  • allow_empty: A flag signifying whether construction is allowed to fail without throwing an exception. In this case an empty object will be produced. This flag is optional and defaults to false.

memory::desc src_layer_desc() const

Returns source layer memory descriptor.

Return

Source layer memory descriptor.

memory::desc src_iter_desc() const

Returns source iteration memory descriptor.

Return

Source iteration memory descriptor.

Return

A zero memory descriptor if the primitive does not have a source iteration parameter.

memory::desc src_iter_c_desc() const

Returns source iteration memory descriptor.

Return

Source iteration memory descriptor.

Return

A zero memory descriptor if the primitive does not have a source iteration parameter.

memory::desc weights_layer_desc() const

Returns weights layer memory descriptor.

Return

Weights layer memory descriptor.

memory::desc weights_iter_desc() const

Returns weights iteration memory descriptor.

Return

Weights iteration memory descriptor.

memory::desc bias_desc() const

Returns bias memory descriptor.

Return

Bias memory descriptor.

Return

A zero memory descriptor if the primitive does not have a bias parameter.

memory::desc dst_layer_desc() const

Returns destination layer memory descriptor.

Return

Destination layer memory descriptor.

memory::desc dst_iter_desc() const

Returns destination iteration memory descriptor.

Return

Destination iteration memory descriptor.

Return

A zero memory descriptor if the primitive does not have a destination iteration parameter.

memory::desc dst_iter_c_desc() const

Returns source iteration memory descriptor.

Return

Source iteration memory descriptor.

Return

A zero memory descriptor if the primitive does not have a source iteration parameter.

memory::desc workspace_desc() const

Returns the workspace memory descriptor.

Return

Workspace memory descriptor.

Return

A zero memory descriptor if the primitive does not require workspace parameter.

memory::desc diff_src_layer_desc() const

Returns diff source layer memory descriptor.

Return

Diff source layer memory descriptor.

memory::desc diff_src_iter_desc() const

Returns diff source iteration memory descriptor.

Return

Diff source iteration memory descriptor.

Return

A zero memory descriptor if the primitive does not have a diff source iteration parameter.

memory::desc diff_src_iter_c_desc() const

Returns diff source recurrent cell state memory descriptor.

Return

Diff source recurrent cell state memory descriptor.

memory::desc diff_weights_layer_desc() const

Returns diff weights layer memory descriptor.

Return

Diff weights layer memory descriptor.

memory::desc diff_weights_iter_desc() const

Returns diff weights iteration memory descriptor.

Return

Diff weights iteration memory descriptor.

memory::desc diff_bias_desc() const

Returns diff bias memory descriptor.

Return

Diff bias memory descriptor.

Return

A zero memory descriptor if the primitive does not have a diff bias parameter.

memory::desc diff_dst_layer_desc() const

Returns diff destination layer memory descriptor.

Return

Diff destination layer memory descriptor.

memory::desc diff_dst_iter_desc() const

Returns diff destination iteration memory descriptor.

Return

Diff destination iteration memory descriptor.

Return

A zero memory descriptor if the primitive does not have a diff destination iteration parameter.

memory::desc diff_dst_iter_c_desc() const

Returns diff destination recurrent cell state memory descriptor.

Return

Diff destination recurrent cell state memory descriptor.

struct dnnl::gru_forward : public dnnl::primitive

GRU forward propagation primitive.

Public Functions

gru_forward()

Default constructor. Produces an empty object.

gru_forward(const primitive_desc &pd)

Constructs a GRU forward propagation primitive.

Parameters
  • pd: Primitive descriptor for a GRU forward propagation primitive.

struct desc

Descriptor for a GRU forward propagation primitive.

Public Functions

desc(prop_kind prop_kind, rnn_direction direction, const memory::desc &src_layer_desc, const memory::desc &src_iter_desc, const memory::desc &weights_layer_desc, const memory::desc &weights_iter_desc, const memory::desc &bias_desc, const memory::desc &dst_layer_desc, const memory::desc &dst_iter_desc, rnn_flags flags = rnn_flags::undef)

Constructs a descriptor for a GRU forward propagation primitive.

The src_iter_desc, bias_desc, and dst_iter, may point to a zero memory descriptor. This would then indicate that the GRU forward propagation primitive should not use them and should default to zero values instead.

Inputs:

Outputs:

Note

All memory descriptors except src_iter_desc may be initialized with an dnnl::memory::format_tag::any value of format_tag.

Parameters
  • prop_kind: Propagation kind. Possible values are dnnl::prop_kind::forward_training, and dnnl::prop_kind::forward_inference.

  • direction: RNN direction. See dnnl::rnn_direction for more info.

  • src_layer_desc: Memory descriptor for the input vector.

  • src_iter_desc: Memory descriptor for the input recurrent hidden state vector.

  • weights_layer_desc: Memory descriptor for the weights applied to the layer input.

  • weights_iter_desc: Memory descriptor for the weights applied to the recurrent input.

  • bias_desc: Bias memory descriptor.

  • dst_layer_desc: Memory descriptor for the output vector.

  • dst_iter_desc: Memory descriptor for the output recurrent hidden state vector.

  • flags: Unused.

struct primitive_desc : public dnnl::rnn_primitive_desc_base

Primitive descriptor GRU forward propagation primitive.

Public Functions

primitive_desc()

Default constructor. Produces an empty object.

primitive_desc(const desc &desc, const engine &engine, bool allow_empty = false)

Constructs a primitive descriptor for a GRU forward propagation primitive.

Parameters
  • desc: Descriptor for a GRU forward propagation primitive.

  • engine: Engine to use.

  • allow_empty: A flag signifying whether construction is allowed to fail without throwing an exception. In this case an empty object will be produced. This flag is optional and defaults to false.

primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, bool allow_empty = false)

Constructs a primitive descriptor for a GRU forward propagation primitive.

Parameters
  • desc: Descriptor for a GRU forward propagation primitive.

  • attr: Primitive attributes to use.

  • engine: Engine to use.

  • allow_empty: A flag signifying whether construction is allowed to fail without throwing an exception. In this case an empty object will be produced. This flag is optional and defaults to false.

memory::desc src_layer_desc() const

Returns source layer memory descriptor.

Return

Source layer memory descriptor.

memory::desc src_iter_desc() const

Returns source iteration memory descriptor.

Return

Source iteration memory descriptor.

Return

A zero memory descriptor if the primitive does not have a source iteration parameter.

memory::desc weights_layer_desc() const

Returns weights layer memory descriptor.

Return

Weights layer memory descriptor.

memory::desc weights_iter_desc() const

Returns weights iteration memory descriptor.

Return

Weights iteration memory descriptor.

memory::desc bias_desc() const

Returns bias memory descriptor.

Return

Bias memory descriptor.

Return

A zero memory descriptor if the primitive does not have a bias parameter.

memory::desc dst_layer_desc() const

Returns destination layer memory descriptor.

Return

Destination layer memory descriptor.

memory::desc dst_iter_desc() const

Returns destination iteration memory descriptor.

Return

Destination iteration memory descriptor.

Return

A zero memory descriptor if the primitive does not have a destination iteration parameter.

memory::desc workspace_desc() const

Returns the workspace memory descriptor.

Return

Workspace memory descriptor.

Return

A zero memory descriptor if the primitive does not require workspace parameter.

struct dnnl::gru_backward : public dnnl::primitive

GRU backward propagation primitive.

Public Functions

gru_backward()

Default constructor. Produces an empty object.

gru_backward(const primitive_desc &pd)

Constructs a GRU backward propagation primitive.

Parameters
  • pd: Primitive descriptor for a GRU backward propagation primitive.

struct desc

Descriptor for a GRU backward propagation primitive.

Public Functions

desc(prop_kind prop_kind, rnn_direction direction, const memory::desc &src_layer_desc, const memory::desc &src_iter_desc, const memory::desc &weights_layer_desc, const memory::desc &weights_iter_desc, const memory::desc &bias_desc, const memory::desc &dst_layer_desc, const memory::desc &dst_iter_desc, const memory::desc &diff_src_layer_desc, const memory::desc &diff_src_iter_desc, const memory::desc &diff_weights_layer_desc, const memory::desc &diff_weights_iter_desc, const memory::desc &diff_bias_desc, const memory::desc &diff_dst_layer_desc, const memory::desc &diff_dst_iter_desc, rnn_flags flags = rnn_flags::undef)

Constructs a descriptor for a GRU backward propagation primitive.

The src_iter_desc together with diff_src_iter_desc, bias_desc together with diff_bias_desc, and dst_iter together with diff_dst_iter, may point to a zero memory descriptor. This would then indicate that the GRU backward propagation primitive should not use them and should default to zero values instead.

Inputs:

Outputs:

Note

All memory descriptors may be initialized with dnnl::memory::format_tag::any value of format_tag.

Parameters
  • prop_kind: Propagation kind. Must be dnnl::prop_kind::backward.

  • direction: RNN direction. See dnnl::rnn_direction for more info.

  • src_layer_desc: Memory descriptor for the input vector.

  • src_iter_desc: Memory descriptor for the input recurrent hidden state vector.

  • weights_layer_desc: Memory descriptor for the weights applied to the layer input.

  • weights_iter_desc: Memory descriptor for the weights applied to the recurrent input.

  • bias_desc: Bias memory descriptor.

  • dst_layer_desc: Memory descriptor for the output vector.

  • dst_iter_desc: Memory descriptor for the output recurrent hidden state vector.

  • diff_src_layer_desc: Memory descriptor for the diff of input vector.

  • diff_src_iter_desc: Memory descriptor for the diff of input recurrent hidden state vector.

  • diff_weights_layer_desc: Memory descriptor for the diff of weights applied to the layer input.

  • diff_weights_iter_desc: Memory descriptor for the diff of weights applied to the recurrent input.

  • diff_bias_desc: Diff bias memory descriptor.

  • diff_dst_layer_desc: Memory descriptor for the diff of output vector.

  • diff_dst_iter_desc: Memory descriptor for the diff of output recurrent hidden state vector.

  • flags: Unused.

struct primitive_desc : public dnnl::rnn_primitive_desc_base

Primitive descriptor for a GRU backward propagation primitive.

Public Functions

primitive_desc()

Default constructor. Produces an empty object.

primitive_desc(const desc &desc, const engine &engine, const gru_forward::primitive_desc &hint_fwd_pd, bool allow_empty = false)

Constructs a primitive descriptor for a GRU backward propagation primitive.

Parameters
  • desc: Descriptor for a GRU backward propagation primitive.

  • engine: Engine to use.

  • hint_fwd_pd: Primitive descriptor for a GRU forward propagation primitive. It is used as a hint for deciding which memory format to use.

  • allow_empty: A flag signifying whether construction is allowed to fail without throwing an exception. In this case an empty object will be produced. This flag is optional and defaults to false.

primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, const gru_forward::primitive_desc &hint_fwd_pd, bool allow_empty = false)

Constructs a primitive descriptor for a GRU backward propagation primitive.

Parameters
  • desc: Descriptor for a GRU backward propagation primitive.

  • attr: Primitive attributes to use.

  • engine: Engine to use.

  • hint_fwd_pd: Primitive descriptor for a GRU forward propagation primitive. It is used as a hint for deciding which memory format to use.

  • allow_empty: A flag signifying whether construction is allowed to fail without throwing an exception. In this case an empty object will be produced. This flag is optional and defaults to false.

memory::desc src_layer_desc() const

Returns source layer memory descriptor.

Return

Source layer memory descriptor.

memory::desc src_iter_desc() const

Returns source iteration memory descriptor.

Return

Source iteration memory descriptor.

Return

A zero memory descriptor if the primitive does not have a source iteration parameter.

memory::desc weights_layer_desc() const

Returns weights layer memory descriptor.

Return

Weights layer memory descriptor.

memory::desc weights_iter_desc() const

Returns weights iteration memory descriptor.

Return

Weights iteration memory descriptor.

memory::desc bias_desc() const

Returns bias memory descriptor.

Return

Bias memory descriptor.

Return

A zero memory descriptor if the primitive does not have a bias parameter.

memory::desc dst_layer_desc() const

Returns destination layer memory descriptor.

Return

Destination layer memory descriptor.

memory::desc dst_iter_desc() const

Returns destination iteration memory descriptor.

Return

Destination iteration memory descriptor.

Return

A zero memory descriptor if the primitive does not have a destination iteration parameter.

memory::desc workspace_desc() const

Returns the workspace memory descriptor.

Return

Workspace memory descriptor.

Return

A zero memory descriptor if the primitive does not require workspace parameter.

memory::desc diff_src_layer_desc() const

Returns diff source layer memory descriptor.

Return

Diff source layer memory descriptor.

memory::desc diff_src_iter_desc() const

Returns diff source iteration memory descriptor.

Return

Diff source iteration memory descriptor.

Return

A zero memory descriptor if the primitive does not have a diff source iteration parameter.

memory::desc diff_weights_layer_desc() const

Returns diff weights layer memory descriptor.

Return

Diff weights layer memory descriptor.

memory::desc diff_weights_iter_desc() const

Returns diff weights iteration memory descriptor.

Return

Diff weights iteration memory descriptor.

memory::desc diff_bias_desc() const

Returns diff bias memory descriptor.

Return

Diff bias memory descriptor.

Return

A zero memory descriptor if the primitive does not have a diff bias parameter.

memory::desc diff_dst_layer_desc() const

Returns diff destination layer memory descriptor.

Return

Diff destination layer memory descriptor.

memory::desc diff_dst_iter_desc() const

Returns diff destination iteration memory descriptor.

Return

Diff destination iteration memory descriptor.

Return

A zero memory descriptor if the primitive does not have a diff destination iteration parameter.

struct dnnl::lbr_gru_forward : public dnnl::primitive

LBR GRU forward propagation primitive.

Public Functions

lbr_gru_forward()

Default constructor. Produces an empty object.

lbr_gru_forward(const primitive_desc &pd)

Constructs an LBR GRU forward propagation primitive.

Parameters
  • pd: Primitive descriptor for an LBR GRU forward propagation primitive.

struct desc

Descriptor for an LBR GRU forward propagation primitive.

Public Functions

desc(prop_kind prop_kind, rnn_direction direction, const memory::desc &src_layer_desc, const memory::desc &src_iter_desc, const memory::desc &weights_layer_desc, const memory::desc &weights_iter_desc, const memory::desc &bias_desc, const memory::desc &dst_layer_desc, const memory::desc &dst_iter_desc, rnn_flags flags = rnn_flags::undef)

Constructs a descriptor for LBR GRU forward propagation primitive.

The src_iter_desc, bias_desc, and dst_iter, may point to a zero memory descriptor. This would then indicate that the LBR GRU forward propagation primitive should not use them and should default to zero values instead.

Inputs:

Outputs:

Note

All memory descriptors except src_iter_desc may be initialized with an dnnl::memory::format_tag::any value of format_tag.

Parameters
  • prop_kind: Propagation kind. Possible values are dnnl::prop_kind::forward_training, and dnnl::prop_kind::forward_inference.

  • direction: RNN direction. See dnnl::rnn_direction for more info.

  • src_layer_desc: Memory descriptor for the input vector.

  • src_iter_desc: Memory descriptor for the input recurrent hidden state vector.

  • weights_layer_desc: Memory descriptor for the weights applied to the layer input.

  • weights_iter_desc: Memory descriptor for the weights applied to the recurrent input.

  • bias_desc: Bias memory descriptor.

  • dst_layer_desc: Memory descriptor for the output vector.

  • dst_iter_desc: Memory descriptor for the output recurrent hidden state vector.

  • flags: Unused.

struct primitive_desc : public dnnl::rnn_primitive_desc_base

Primitive descriptor for an LBR GRU forward propagation primitive.

Public Functions

primitive_desc()

Default constructor. Produces an empty object.

primitive_desc(const desc &desc, const engine &engine, bool allow_empty = false)

Constructs a primitive descriptor for a LBR GRU forward propagation primitive.

Parameters
  • desc: Descriptor for a LBR GRU forward propagation primitive.

  • engine: Engine to use.

  • allow_empty: A flag signifying whether construction is allowed to fail without throwing an exception. In this case an empty object will be produced. This flag is optional and defaults to false.

primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, bool allow_empty = false)

Constructs a primitive descriptor for a LBR GRU forward propagation primitive.

Parameters
  • desc: Descriptor for a LBR GRU forward propagation primitive.

  • attr: Primitive attributes to use.

  • engine: Engine to use.

  • allow_empty: A flag signifying whether construction is allowed to fail without throwing an exception. In this case an empty object will be produced. This flag is optional and defaults to false.

memory::desc src_layer_desc() const

Returns source layer memory descriptor.

Return

Source layer memory descriptor.

memory::desc src_iter_desc() const

Returns source iteration memory descriptor.

Return

Source iteration memory descriptor.

Return

A zero memory descriptor if the primitive does not have a source iteration parameter.

memory::desc weights_layer_desc() const

Returns weights layer memory descriptor.

Return

Weights layer memory descriptor.

memory::desc weights_iter_desc() const

Returns weights iteration memory descriptor.

Return

Weights iteration memory descriptor.

memory::desc bias_desc() const

Returns bias memory descriptor.

Return

Bias memory descriptor.

Return

A zero memory descriptor if the primitive does not have a bias parameter.

memory::desc dst_layer_desc() const

Returns destination layer memory descriptor.

Return

Destination layer memory descriptor.

memory::desc dst_iter_desc() const

Returns destination iteration memory descriptor.

Return

Destination iteration memory descriptor.

Return

A zero memory descriptor if the primitive does not have a destination iteration parameter.

memory::desc workspace_desc() const

Returns the workspace memory descriptor.

Return

Workspace memory descriptor.

Return

A zero memory descriptor if the primitive does not require workspace parameter.

struct dnnl::lbr_gru_backward : public dnnl::primitive

LBR GRU backward propagation primitive.

Public Functions

lbr_gru_backward()

Default constructor. Produces an empty object.

lbr_gru_backward(const primitive_desc &pd)

Constructs an LBR GRU backward propagation primitive.

Parameters
  • pd: Primitive descriptor for an LBR GRU backward propagation primitive.

struct desc

Descriptor for a LBR GRU backward propagation primitive.

Public Functions

desc(prop_kind prop_kind, rnn_direction direction, const memory::desc &src_layer_desc, const memory::desc &src_iter_desc, const memory::desc &weights_layer_desc, const memory::desc &weights_iter_desc, const memory::desc &bias_desc, const memory::desc &dst_layer_desc, const memory::desc &dst_iter_desc, const memory::desc &diff_src_layer_desc, const memory::desc &diff_src_iter_desc, const memory::desc &diff_weights_layer_desc, const memory::desc &diff_weights_iter_desc, const memory::desc &diff_bias_desc, const memory::desc &diff_dst_layer_desc, const memory::desc &diff_dst_iter_desc, rnn_flags flags = rnn_flags::undef)

Constructs a descriptor for LBR GRU backward propagation primitive.

The src_iter_desc together with diff_src_iter_desc, bias_desc together with diff_bias_desc, and dst_iter together with diff_dst_iter, may point to a zero memory descriptor. This would then indicate that the LBR GRU backward propagation primitive should not use them and should default to zero values instead.

Inputs:

Outputs:

Note

All memory descriptors may be initialized with dnnl::memory::format_tag::any value of format_tag.

Parameters
  • prop_kind: Propagation kind. Must be dnnl::prop_kind::backward.

  • direction: RNN direction. See dnnl::rnn_direction for more info.

  • src_layer_desc: Memory descriptor for the input vector.

  • src_iter_desc: Memory descriptor for the input recurrent hidden state vector.

  • weights_layer_desc: Memory descriptor for the weights applied to the layer input.

  • weights_iter_desc: Memory descriptor for the weights applied to the recurrent input.

  • bias_desc: Bias memory descriptor.

  • dst_layer_desc: Memory descriptor for the output vector.

  • dst_iter_desc: Memory descriptor for the output recurrent hidden state vector.

  • diff_src_layer_desc: Memory descriptor for the diff of input vector.

  • diff_src_iter_desc: Memory descriptor for the diff of input recurrent hidden state vector.

  • diff_weights_layer_desc: Memory descriptor for the diff of weights applied to the layer input.

  • diff_weights_iter_desc: Memory descriptor for the diff of weights applied to the recurrent input.

  • diff_bias_desc: Diff bias memory descriptor.

  • diff_dst_layer_desc: Memory descriptor for the diff of output vector.

  • diff_dst_iter_desc: Memory descriptor for the diff of output recurrent hidden state vector.

  • flags: Unused.

struct primitive_desc : public dnnl::rnn_primitive_desc_base

Primitive descriptor for an LBR GRU backward propagation primitive.

Public Functions

primitive_desc() = default

Default constructor. Produces an empty object.

primitive_desc(const desc &desc, const engine &engine, const lbr_gru_forward::primitive_desc &hint_fwd_pd, bool allow_empty = false)

Constructs a primitive descriptor for an LBR GRU backward propagation primitive.

Parameters
  • desc: Descriptor for an LBR GRU backward propagation primitive.

  • engine: Engine to use.

  • hint_fwd_pd: Primitive descriptor for an LBR GRU forward propagation primitive. It is used as a hint for deciding which memory format to use.

  • allow_empty: A flag signifying whether construction is allowed to fail without throwing an exception. In this case an empty object will be produced. This flag is optional and defaults to false.

primitive_desc(const desc &desc, const primitive_attr &attr, const engine &engine, const lbr_gru_forward::primitive_desc &hint_fwd_pd, bool allow_empty = false)

Constructs a primitive descriptor for an LBR GRU backward propagation primitive.

Parameters
  • desc: Descriptor for an LBR GRU backward propagation primitive.

  • attr: Primitive attributes to use.

  • engine: Engine to use.

  • hint_fwd_pd: Primitive descriptor for an LBR GRU forward propagation primitive. It is used as a hint for deciding which memory format to use.

  • allow_empty: A flag signifying whether construction is allowed to fail without throwing an exception. In this case an empty object will be produced. This flag is optional and defaults to false.

memory::desc src_layer_desc() const

Returns source layer memory descriptor.

Return

Source layer memory descriptor.

memory::desc src_iter_desc() const

Returns source iteration memory descriptor.

Return

Source iteration memory descriptor.

Return

A zero memory descriptor if the primitive does not have a source iteration parameter.

memory::desc weights_layer_desc() const

Returns weights layer memory descriptor.

Return

Weights layer memory descriptor.

memory::desc weights_iter_desc() const

Returns weights iteration memory descriptor.

Return

Weights iteration memory descriptor.

memory::desc bias_desc() const

Returns bias memory descriptor.

Return

Bias memory descriptor.

Return

A zero memory descriptor if the primitive does not have a bias parameter.

memory::desc dst_layer_desc() const

Returns destination layer memory descriptor.

Return

Destination layer memory descriptor.

memory::desc dst_iter_desc() const

Returns destination iteration memory descriptor.

Return

Destination iteration memory descriptor.

Return

A zero memory descriptor if the primitive does not have a destination iteration parameter.

memory::desc workspace_desc() const

Returns the workspace memory descriptor.

Return

Workspace memory descriptor.

Return

A zero memory descriptor if the primitive does not require workspace parameter.

memory::desc diff_src_layer_desc() const

Returns diff source layer memory descriptor.

Return

Diff source layer memory descriptor.

memory::desc diff_src_iter_desc() const

Returns diff source iteration memory descriptor.

Return

Diff source iteration memory descriptor.

Return

A zero memory descriptor if the primitive does not have a diff source iteration parameter.

memory::desc diff_weights_layer_desc() const

Returns diff weights layer memory descriptor.

Return

Diff weights layer memory descriptor.

memory::desc diff_weights_iter_desc() const

Returns diff weights iteration memory descriptor.

Return

Diff weights iteration memory descriptor.

memory::desc diff_bias_desc() const

Returns diff bias memory descriptor.

Return

Diff bias memory descriptor.

Return

A zero memory descriptor if the primitive does not have a diff bias parameter.

memory::desc diff_dst_layer_desc() const

Returns diff destination layer memory descriptor.

Return

Diff destination layer memory descriptor.

memory::desc diff_dst_iter_desc() const

Returns diff destination iteration memory descriptor.

Return

Diff destination iteration memory descriptor.

Return

A zero memory descriptor if the primitive does not have a diff destination iteration parameter.