Inner Product

Overview

A primitive to compute an inner product. More…

// structs

struct dnnl::inner_product_backward_data;
struct dnnl::inner_product_backward_weights;
struct dnnl::inner_product_forward;

// global functions

dnnl_status_t DNNL_API dnnl_inner_product_forward_primitive_desc_create(
    dnnl_primitive_desc_t* primitive_desc,
    dnnl_engine_t engine,
    dnnl_prop_kind_t prop_kind,
    const_dnnl_memory_desc_t src_desc,
    const_dnnl_memory_desc_t weights_desc,
    const_dnnl_memory_desc_t bias_desc,
    const_dnnl_memory_desc_t dst_desc,
    const_dnnl_primitive_attr_t attr
    );

dnnl_status_t DNNL_API dnnl_inner_product_backward_data_primitive_desc_create(
    dnnl_primitive_desc_t* primitive_desc,
    dnnl_engine_t engine,
    const_dnnl_memory_desc_t diff_src_desc,
    const_dnnl_memory_desc_t weights_desc,
    const_dnnl_memory_desc_t diff_dst_desc,
    const_dnnl_primitive_desc_t hint_fwd_pd,
    const_dnnl_primitive_attr_t attr
    );

dnnl_status_t DNNL_API dnnl_inner_product_backward_weights_primitive_desc_create(
    dnnl_primitive_desc_t* primitive_desc,
    dnnl_engine_t engine,
    const_dnnl_memory_desc_t src_desc,
    const_dnnl_memory_desc_t diff_weights_desc,
    const_dnnl_memory_desc_t diff_bias_desc,
    const_dnnl_memory_desc_t diff_dst_desc,
    const_dnnl_primitive_desc_t hint_fwd_pd,
    const_dnnl_primitive_attr_t attr
    );

Detailed Documentation

A primitive to compute an inner product.

See also:

Inner Product in developer guide

Global Functions

dnnl_status_t DNNL_API dnnl_inner_product_forward_primitive_desc_create(
    dnnl_primitive_desc_t* primitive_desc,
    dnnl_engine_t engine,
    dnnl_prop_kind_t prop_kind,
    const_dnnl_memory_desc_t src_desc,
    const_dnnl_memory_desc_t weights_desc,
    const_dnnl_memory_desc_t bias_desc,
    const_dnnl_memory_desc_t dst_desc,
    const_dnnl_primitive_attr_t attr
    )

Creates a primitive descriptor for an inner product forward propagation primitive.

Note

Memory descriptors can be initialized with dnnl_format_tag_any or with format_kind set to dnnl_format_kind_any.

Parameters:

primitive_desc

Output primitive_descriptor.

engine

Engine to use.

prop_kind

Propagation kind. Possible values are dnnl_forward_training and dnnl_forward_inference.

src_desc

Source memory descriptor.

weights_desc

Weights memory descriptor.

bias_desc

Bias memory descriptor. Passing NULL, a zero memory descriptor, or a memory descriptor with format_kind set to dnnl_format_kind_undef disables the bias term.

dst_desc

Destination memory descriptor.

attr

Primitive attributes (can be NULL).

Returns:

dnnl_success on success and a status describing the error otherwise.

dnnl_status_t DNNL_API dnnl_inner_product_backward_data_primitive_desc_create(
    dnnl_primitive_desc_t* primitive_desc,
    dnnl_engine_t engine,
    const_dnnl_memory_desc_t diff_src_desc,
    const_dnnl_memory_desc_t weights_desc,
    const_dnnl_memory_desc_t diff_dst_desc,
    const_dnnl_primitive_desc_t hint_fwd_pd,
    const_dnnl_primitive_attr_t attr
    )

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

Note

Memory descriptors can be initialized with dnnl_format_tag_any or with format_kind set to dnnl_format_kind_any.

Parameters:

primitive_desc

Output primitive_descriptor.

engine

Engine to use.

diff_src_desc

Diff source memory descriptor.

weights_desc

Weights memory descriptor.

diff_dst_desc

Diff destination memory descriptor.

hint_fwd_pd

Primitive descriptor for a respective forward propagation primitive.

attr

Primitive attributes (can be NULL).

Returns:

dnnl_success on success and a status describing the error otherwise.

dnnl_status_t DNNL_API dnnl_inner_product_backward_weights_primitive_desc_create(
    dnnl_primitive_desc_t* primitive_desc,
    dnnl_engine_t engine,
    const_dnnl_memory_desc_t src_desc,
    const_dnnl_memory_desc_t diff_weights_desc,
    const_dnnl_memory_desc_t diff_bias_desc,
    const_dnnl_memory_desc_t diff_dst_desc,
    const_dnnl_primitive_desc_t hint_fwd_pd,
    const_dnnl_primitive_attr_t attr
    )

Creates a primitive descriptor for an inner product weights gradient primitive.

Note

Memory descriptors can be initialized with dnnl_format_tag_any or with format_kind set to dnnl_format_kind_any.

Parameters:

primitive_desc

Output primitive_descriptor.

engine

Engine to use.

src_desc

Source memory descriptor.

diff_weights_desc

Diff weights memory descriptor.

diff_bias_desc

Diff bias memory descriptor. Passing NULL, a zero memory descriptor, or a memory descriptor with format_kind set to dnnl_format_kind_undef disables the bias term.

diff_dst_desc

Diff destination memory descriptor.

hint_fwd_pd

Primitive descriptor for a respective forward propagation primitive.

attr

Primitive attributes (can be NULL).

Returns:

dnnl_success on success and a status describing the error otherwise.