Inner Product

A primitive to compute an inner product.

API

struct dnnl::inner_product_forward : public dnnl::primitive

Inner product forward propagation primitive.

Public Functions

inner_product_forward()

Default constructor. Produces an empty object.

inner_product_forward(const primitive_desc &pd)

Constructs an inner product forward propagation primitive.

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

struct desc

Descriptor for an inner product forward propagation primitive.

Public Functions

desc(prop_kind prop_kind, const memory::desc &src_desc, const memory::desc &weights_desc, const memory::desc &bias_desc, const memory::desc &dst_desc)

Constructs a descriptor for an inner product forward propagation primitive with bias.

Inputs:

Outputs:

Note

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

Parameters

desc(prop_kind prop_kind, const memory::desc &src_desc, const memory::desc &weights_desc, const memory::desc &dst_desc)

Constructs a descriptor for an inner product forward propagation primitive without bias.

Inputs:

Outputs:

Note

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

Parameters

struct primitive_desc : public dnnl::primitive_desc

Primitive descriptor for an inner product 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 inner product forward propagation primitive.

Parameters
  • desc: Descriptor for an inner product 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 inner product forward propagation primitive.

Parameters
  • desc: Descriptor for an inner product 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_desc() const

Returns a source memory descriptor.

Return

Source memory descriptor.

Return

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

memory::desc weights_desc() const

Returns a weights memory descriptor.

Return

Weights memory descriptor.

Return

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

memory::desc dst_desc() const

Returns a destination memory descriptor.

Return

Destination memory descriptor.

Return

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

memory::desc bias_desc() const

Returns the bias memory descriptor.

Return

The bias memory descriptor.

Return

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

struct dnnl::inner_product_backward_data : public dnnl::primitive

Inner product backward propagation primitive.

Public Functions

inner_product_backward_data()

Default constructor. Produces an empty object.

inner_product_backward_data(const primitive_desc &pd)

Constructs an inner product backward propagation primitive.

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

struct desc

Descriptor for an inner product backward propagation primitive.

Public Functions

desc(const memory::desc &diff_src_desc, const memory::desc &weights_desc, const memory::desc &diff_dst_desc)

Constructs a descriptor for an inner product backward propagation primitive.

Inputs:

Outputs:

Note

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

Parameters
  • diff_src_desc: Memory descriptor for diff src.

  • weights_desc: Memory descriptor for weights.

  • diff_dst_desc: Memory descriptor for diff dst.

struct primitive_desc : public dnnl::primitive_desc

Primitive descriptor for an inner product backward propagation primitive.

Public Functions

primitive_desc()

Default constructor. Produces an empty object.

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

Constructs a primitive descriptor for an inner product backward propagation primitive.

Parameters
  • desc: Descriptor for an inner product backward propagation primitive.

  • engine: Engine to use.

  • hint_fwd_pd: Primitive descriptor for an inner product 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 inner_product_forward::primitive_desc &hint_fwd_pd, bool allow_empty = false)

Constructs a primitive descriptor for an inner product backward propagation primitive.

Parameters
  • desc: Descriptor for an inner product backward propagation primitive.

  • attr: Primitive attributes to use.

  • engine: Engine to use.

  • hint_fwd_pd: Primitive descriptor for an inner product 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 diff_src_desc() const

Returns a diff source memory descriptor.

Return

Diff source memory descriptor.

Return

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

memory::desc weights_desc() const

Returns a weights memory descriptor.

Return

Weights memory descriptor.

Return

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

memory::desc diff_dst_desc() const

Returns a diff destination memory descriptor.

Return

Diff destination memory descriptor.

Return

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

struct dnnl::inner_product_backward_weights : public dnnl::primitive

Inner product weights gradient primitive.

Public Functions

inner_product_backward_weights()

Default constructor. Produces an empty object.

inner_product_backward_weights(const primitive_desc &pd)

Constructs an inner product weights gradient primitive.

Parameters
  • pd: Primitive descriptor for an inner product weights gradient primitive.

struct desc

Descriptor for an inner product weights gradient primitive.

Public Functions

desc(const memory::desc &src_desc, const memory::desc &diff_weights_desc, const memory::desc &diff_bias_desc, const memory::desc &diff_dst_desc)

Constructs a descriptor for an inner product descriptor weights update primitive with bias.

Inputs:

Outputs:

Note

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

Parameters
  • src_desc: Memory descriptor for src.

  • diff_weights_desc: Memory descriptor for diff weights.

  • diff_bias_desc: Memory descriptor for diff bias.

  • diff_dst_desc: Memory descriptor for diff dst.

desc(const memory::desc &src_desc, const memory::desc &diff_weights_desc, const memory::desc &diff_dst_desc)

Constructs a descriptor for an inner product descriptor weights update primitive without bias.

Inputs:

Outputs:

Note

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

Parameters
  • src_desc: Memory descriptor for src.

  • diff_weights_desc: Memory descriptor for diff weights.

  • diff_dst_desc: Memory descriptor for diff dst.

struct primitive_desc : public dnnl::primitive_desc

Primitive descriptor for an inner product weights gradient primitive.

Public Functions

primitive_desc()

Default constructor. Produces an empty object.

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

Constructs a primitive descriptor for an inner product weights update primitive.

Parameters
  • desc: Descriptor for an inner product weights gradient primitive.

  • engine: Engine to use.

  • hint_fwd_pd: Primitive descriptor for an inner product 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 inner_product_forward::primitive_desc &hint_fwd_pd, bool allow_empty = false)

Constructs a primitive descriptor for an inner product weights update primitive.

Parameters
  • desc: Descriptor for an inner product weights gradient primitive.

  • attr: Primitive attributes to use.

  • engine: Engine to use.

  • hint_fwd_pd: Primitive descriptor for an inner product 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_desc() const

Returns a source memory descriptor.

Return

Source memory descriptor.

Return

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

memory::desc diff_weights_desc() const

Returns a diff weights memory descriptor.

Return

Diff weights memory descriptor.

Return

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

memory::desc diff_dst_desc() const

Returns a diff destination memory descriptor.

Return

Diff destination memory descriptor.

Return

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

memory::desc diff_bias_desc() const

Returns the diff bias memory descriptor.

Return

The diff bias memory descriptor.

Return

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